Skip to content

Commit

Permalink
try tweaking some times to reduce flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
BinaryFissionGames committed Feb 16, 2022
1 parent 55abccb commit 92c9be3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 8 additions & 8 deletions operator/builtin/input/file/rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,23 +285,23 @@ func TestRotation(t *testing.T) {
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
},
{
name: "Fast/NoDeletion",
totalLines: 20,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
},
{
name: "Fast/Deletion",
totalLines: 30,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
ephemeralLines: true,
},
{
Expand All @@ -310,7 +310,7 @@ func TestRotation(t *testing.T) {
maxLinesPerFile: 100,
maxBackupFiles: 1,
writeInterval: time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
ephemeralLines: true,
},
{
Expand All @@ -319,31 +319,31 @@ func TestRotation(t *testing.T) {
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: 3 * time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
},
{
name: "Slow/NoDeletion",
totalLines: 20,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: 3 * time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * time.Millisecond,
},
{
name: "Slow/Deletion",
totalLines: 30,
maxLinesPerFile: 10,
maxBackupFiles: 1,
writeInterval: 3 * time.Millisecond,
pollInterval: 20 * time.Millisecond,
pollInterval: 10 * 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,
pollInterval: 10 * time.Millisecond,
},
}

Expand Down
6 changes: 5 additions & 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 All @@ -55,3 +55,7 @@ func TestMaxElapsedTime(t *testing.T) {
})
require.WithinDuration(t, start.Add(maxElapsedTime), time.Now(), maxElapsedTime)
}

func TestTime(t *testing.T) {
require.WithinDuration(t, time.Now(), time.Now().Add(10*time.Second), time.Second)
}

0 comments on commit 92c9be3

Please sign in to comment.