Skip to content

Commit d193794

Browse files
fix: Remove flakiness in the logs test (#3956)
1 parent f966c49 commit d193794

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/integration/features.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ import (
3131
type MetricsCollector string
3232

3333
const (
34-
tickDuration = 3 * time.Second
35-
waitDuration = 2 * time.Minute
34+
tickDuration = 3 * time.Second
35+
waitDuration = 2 * time.Minute
36+
waitBeforeLogsGeneration = 5 * time.Second
3637
// number determined experimentally
3738
expectedEventCount uint = 50
3839
logsGeneratorCount uint = 1000
@@ -486,6 +487,12 @@ func GetAllLogsFeature(waitFunction stepfuncs.WaitForLogs, generate bool) featur
486487
feature := features.New("logs")
487488
if generate {
488489
feature = feature.
490+
Setup(func(ctx context.Context, t *testing.T, c *envconf.Config) context.Context {
491+
// Wait before generating logs to help with flakiness
492+
t.Log("Waiting 5 seconds before generating logs...")
493+
time.Sleep(waitBeforeLogsGeneration) // Adjust as needed
494+
return ctx
495+
}).
489496
Setup(generateDeploymentLogs()).
490497
Setup(generateDaemonsetLogs())
491498
}

0 commit comments

Comments
 (0)