@@ -77,9 +77,10 @@ type feature struct {
77
77
maxNodeAPILoopTimes int
78
78
// If true and the test case has expected loghook.LastEntry set to
79
79
//'none', it will validate if it indeed was a successful message.
80
- validateLastMessage bool
81
- badWatchObject bool
82
- utilMock * utils.Mock
80
+ validateLastMessage bool
81
+ badWatchObject bool
82
+ utilMock * utils.Mock
83
+ validateWatcherMessage bool
83
84
}
84
85
85
86
func (f * feature ) aControllerMonitorUnity () error {
@@ -355,7 +356,18 @@ func (f *feature) theLastLogMessageContains(errormsg string) error {
355
356
return fmt .Errorf ("expected error message to contain: %s, but last log entry was nil" , errormsg )
356
357
} else if strings .Contains (lastEntry .Message , errormsg ) {
357
358
return nil
359
+ } else if f .validateWatcherMessage {
360
+ possibleLastMsg := []string {
361
+ "PodMonitor.Mode not set" , "PodWatcher stopped..." , "Setup of PodWatcher complete" , "node name: node1" ,
362
+ "Setup of NodeWatcher complete" , "NodeWatcher stopped..." , "labelSelector:" , "attempting to start" ,
363
+ }
364
+ for _ , msg := range possibleLastMsg {
365
+ if strings .Contains (lastEntry .Message , msg ) {
366
+ return nil
367
+ }
368
+ }
358
369
}
370
+
359
371
return fmt .Errorf ("expected error message to contain: %s, but it was %s" , errormsg , lastEntry .Message )
360
372
}
361
373
@@ -752,6 +764,7 @@ func (f *feature) iCallAPIMonitorLoop(nodeName string) error {
752
764
func (f * feature ) iCallStartPodMonitorWithKeyAndValue (key , value string ) error {
753
765
MonitorRestartTimeDelay = 5 * time .Millisecond
754
766
client := fake .NewSimpleClientset ()
767
+ f .validateWatcherMessage = true
755
768
go StartPodMonitor (K8sAPI , client , key , value , MonitorRestartTimeDelay )
756
769
return nil
757
770
}
@@ -792,6 +805,7 @@ func (f *feature) podMonitorMode(mode string) error {
792
805
func (f * feature ) iCallStartNodeMonitorWithKeyAndValue (key , value string ) error {
793
806
MonitorRestartTimeDelay = 5 * time .Millisecond
794
807
client := fake .NewSimpleClientset ()
808
+ f .validateWatcherMessage = true
795
809
go StartNodeMonitor (K8sAPI , client , key , value , MonitorRestartTimeDelay )
796
810
return nil
797
811
}
0 commit comments