@@ -633,7 +633,7 @@ func TestMonitorConfig(t *testing.T) {
633
633
assert .NoError (t , cfg .Validate ())
634
634
635
635
cfg .Monitor .MaxTerminated = - 10
636
- assert .ErrorContains (t , cfg .Validate (), "invalid configuration: invalid monitor max terminated" )
636
+ assert .NoError (t , cfg .Validate (), "invalid configuration: invalid monitor max terminated" )
637
637
638
638
cfg .Monitor .MaxTerminated = 0
639
639
assert .NoError (t , cfg .Validate (), "maxTerminated=0 should be valid (unlimited)" )
@@ -691,9 +691,9 @@ func TestMonitorConfigFlags(t *testing.T) {
691
691
args : []string {"--monitor.max-terminated=0" },
692
692
expected : expect {interval : 5 * time .Second , staleness : 500 * time .Millisecond , maxTerminated : 0 , parseError : nil },
693
693
}, {
694
- name : "invalid -max-terminated" ,
694
+ name : "negative -max-terminated" ,
695
695
args : []string {"--monitor.max-terminated=-10" },
696
- expected : expect {cfgErr : fmt . Errorf ( "invalid configuration: invalid monitor max terminated" ) },
696
+ expected : expect {interval : 5 * time . Second , staleness : 500 * time . Millisecond , maxTerminated : - 10 , parseError : nil },
697
697
}}
698
698
699
699
for _ , tc := range tt {
@@ -746,15 +746,15 @@ monitor:
746
746
assert .Equal (t , 0 , cfg .Monitor .MaxTerminated )
747
747
})
748
748
749
- t .Run ("yaml-config-maxTerminated-invalid " , func (t * testing.T ) {
749
+ t .Run ("yaml-config-maxTerminated-negative " , func (t * testing.T ) {
750
750
yamlData := `
751
751
monitor:
752
752
maxTerminated: -100
753
753
`
754
754
reader := strings .NewReader (yamlData )
755
- _ , err := Load (reader )
756
- assert .Error (t , err )
757
- assert .Contains (t , err . Error (), "invalid monitor max terminated" )
755
+ cfg , err := Load (reader )
756
+ assert .NoError (t , err )
757
+ assert .Equal (t , - 100 , cfg . Monitor . MaxTerminated )
758
758
})
759
759
}
760
760
0 commit comments