@@ -240,8 +240,8 @@ func (d duplicateEventsEvaluator) testDuplicatedEvents(testName string, flakeOnl
240240 from time.Time
241241 to time.Time
242242 }
243- buildTopologyHintAllowedTimeRange := true
244- topologyHintAllowedTimeRange := []* timeRange {}
243+ buildTopologyHintAllowedTimeRanges := true
244+ topologyHintAllowedTimeRanges := []* timeRange {}
245245
246246 displayToCount := map [string ]* pathologicalEvents {}
247247 for _ , event := range events {
@@ -262,15 +262,16 @@ func (d duplicateEventsEvaluator) testDuplicatedEvents(testName string, flakeOnl
262262 }
263263 if strings .Contains (event .Message , "reason/TopologyAwareHintsDisabled" ) {
264264 // Build the allowed time range only once
265- if buildTopologyHintAllowedTimeRange {
265+ if buildTopologyHintAllowedTimeRanges {
266266 taintManagerTestIntervals := events .Filter (func (eventInterval monitorapi.Interval ) bool {
267267 return eventInterval .Source == monitorapi .SourceE2ETest &&
268268 strings .Contains (eventInterval .StructuredLocator .Keys [monitorapi .LocatorE2ETestKey ], "NoExecuteTaintManager" )
269269 })
270270 // Start the allowed time range from time range of the tests. But events lag behind the tests since the tests do not wait
271271 // until all dns pods are properly scheduled and reach ready state. So we will need to expand the allowed time range after.
272272 for _ , test := range taintManagerTestIntervals {
273- topologyHintAllowedTimeRange = append (topologyHintAllowedTimeRange , & timeRange {from : test .From , to : test .To })
273+ topologyHintAllowedTimeRanges = append (topologyHintAllowedTimeRanges , & timeRange {from : test .From , to : test .To })
274+ logrus .WithField ("from" , test .From ).WithField ("to" , test .To ).Infof ("found time range for test: %s" , testName )
274275 }
275276 dnsUpdateIntervals := events .Filter (func (eventInterval monitorapi.Interval ) bool {
276277 return eventInterval .Source == monitorapi .SourcePodState &&
@@ -280,7 +281,7 @@ func (d duplicateEventsEvaluator) testDuplicatedEvents(testName string, flakeOnl
280281 })
281282
282283 // Now expand the allowed time range until the replacement dns pod gets ready
283- for _ , r := range topologyHintAllowedTimeRange {
284+ for _ , r := range topologyHintAllowedTimeRanges {
284285 var lastReadyTime time.Time
285286 count := 0
286287 for _ , interval := range dnsUpdateIntervals {
@@ -305,11 +306,15 @@ func (d duplicateEventsEvaluator) testDuplicatedEvents(testName string, flakeOnl
305306 }
306307 }
307308 }
308- buildTopologyHintAllowedTimeRange = false
309+ // Log final adjusted time ranges
310+ for _ , test := range taintManagerTestIntervals {
311+ logrus .WithField ("from" , test .From ).WithField ("to" , test .To ).Infof ("adjusted time range for test: %s" , testName )
312+ }
313+ buildTopologyHintAllowedTimeRanges = false
309314 }
310315 // Filter out TopologyAwareHintsDisabled events within allowed time range
311316 var allowed bool
312- for _ , r := range topologyHintAllowedTimeRange {
317+ for _ , r := range topologyHintAllowedTimeRanges {
313318 if r .from .Before (event .From ) && r .to .After (event .To ) {
314319 logrus .Infof ("%s was found to fall into the allowed time range %+v, ignoring pathological event as we expect these during NoExecuteTaintManager test" , event , r )
315320 allowed = true
0 commit comments