Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try tweaking some times to reduce flakiness #558

Merged
merged 5 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 9 additions & 42 deletions operator/builtin/input/file/rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (rt rotationTest) run(tc rotationTest, copyTruncate, sequential bool) func(
select {
case e := <-logReceived:
received = append(received, e.Record.(string))
case <-time.After(100 * time.Millisecond):
case <-time.After(3 * time.Second):
break LOOP
}
}
Expand All @@ -277,74 +277,41 @@ func (rt rotationTest) run(tc rotationTest, copyTruncate, sequential bool) func(
}

func TestRotation(t *testing.T) {

cases := []rotationTest{
{
name: "Fast/NoRotation",
name: "NoRotation",
totalLines: 10,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
},
{
name: "Fast/NoDeletion",
name: "NoDeletion",
totalLines: 20,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
},
{
name: "Fast/Deletion",
name: "Deletion",
totalLines: 30,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
ephemeralLines: true,
},
{
name: "Fast/Deletion/ExceedFingerprint",
name: "Deletion/ExceedFingerprint",
totalLines: 300,
maxLinesPerFile: 100,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
ephemeralLines: true,
},
{
name: "Slow/NoRotation",
totalLines: 10,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: 3 * time.Millisecond,
pollInterval: 20 * time.Millisecond,
},
{
name: "Slow/NoDeletion",
totalLines: 20,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: 3 * time.Millisecond,
pollInterval: 20 * time.Millisecond,
},
{
name: "Slow/Deletion",
totalLines: 30,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: 3 * time.Millisecond,
pollInterval: 20 * time.Millisecond,
},
{
name: "Slow/Deletion/ExceedFingerprint",
totalLines: 100,
maxLinesPerFile: 25, // ~20 is just enough to exceed 1000 bytes fingerprint at 50 chars per line
maxBackupFiles: 2,
writeInterval: 3 * time.Millisecond,
pollInterval: 20 * time.Millisecond,
},
}

for _, tc := range cases {
Expand Down
4 changes: 2 additions & 2 deletions operator/builtin/input/file/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ LOOP:
select {
case e := <-c:
receivedMessages = append(receivedMessages, e.Record.(string))
case <-time.After(time.Second):
case <-time.After(3 * time.Second):
break LOOP
}
}
Expand All @@ -152,7 +152,7 @@ LOOP:
}

func expectNoMessages(t *testing.T, c chan *entry.Entry) {
expectNoMessagesUntil(t, c, 200*time.Millisecond)
expectNoMessagesUntil(t, c, 3*time.Second)
}

func expectNoMessagesUntil(t *testing.T, c chan *entry.Entry, d time.Duration) {
Expand Down
2 changes: 1 addition & 1 deletion operator/flusher/flusher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestFlusher(t *testing.T) {
func TestMaxElapsedTime(t *testing.T) {

// Override setting for test
maxElapsedTime = 100 * time.Millisecond
maxElapsedTime = 1 * time.Second

flusherCfg := NewConfig()
flusher := flusherCfg.Build(zaptest.NewLogger(t).Sugar())
Expand Down