From e32b3e1ea38c4e9a8c143f02935daa76585eb42d Mon Sep 17 00:00:00 2001 From: Dan Jaglowski Date: Wed, 16 Nov 2022 12:55:11 -0500 Subject: [PATCH] [chore] Disable flaky windows file rotation tests --- pkg/stanza/fileconsumer/file_test.go | 4 ++++ pkg/stanza/fileconsumer/rotation_test.go | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pkg/stanza/fileconsumer/file_test.go b/pkg/stanza/fileconsumer/file_test.go index c187dd0c69c67..8c3c8fe87ab4d 100644 --- a/pkg/stanza/fileconsumer/file_test.go +++ b/pkg/stanza/fileconsumer/file_test.go @@ -19,6 +19,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "strconv" "sync" "testing" @@ -466,6 +467,9 @@ func TestStartAtEnd(t *testing.T) { // a file created after the operator has been started is read from the // beginning func TestStartAtEndNewFile(t *testing.T) { + if runtime.GOOS != windowsOS { + t.Skip("Rotation tests have been flaky on Windows. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16331") + } t.Parallel() tempDir := t.TempDir() diff --git a/pkg/stanza/fileconsumer/rotation_test.go b/pkg/stanza/fileconsumer/rotation_test.go index 02e967cc81a67..215e91858d121 100644 --- a/pkg/stanza/fileconsumer/rotation_test.go +++ b/pkg/stanza/fileconsumer/rotation_test.go @@ -149,6 +149,9 @@ func TestMultiFileRotateSlow(t *testing.T) { } func TestMultiCopyTruncateSlow(t *testing.T) { + if runtime.GOOS != windowsOS { + t.Skip("Rotation tests have been flaky on Windows. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16331") + } tempDir := t.TempDir() cfg := NewConfig().includeDir(tempDir) cfg.StartAt = "beginning" @@ -305,6 +308,9 @@ func (rt rotationTest) run(tc rotationTest, copyTruncate, sequential bool) func( } func TestRotation(t *testing.T) { + if runtime.GOOS != windowsOS { + t.Skip("Rotation tests have been flaky on Windows. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16331") + } cases := []rotationTest{ { name: "NoRotation", @@ -471,6 +477,9 @@ func TestTrackRotatedFilesLogOrder(t *testing.T) { // TruncateThenWrite tests that, after a file has been truncated, // any new writes are picked up func TestTruncateThenWrite(t *testing.T) { + if runtime.GOOS != windowsOS { + t.Skip("Rotation tests have been flaky on Windows. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16331") + } t.Parallel() tempDir := t.TempDir() @@ -505,6 +514,9 @@ func TestTruncateThenWrite(t *testing.T) { // we get the unread logs on the copy as well as any new logs // written to the truncated file func TestCopyTruncateWriteBoth(t *testing.T) { + if runtime.GOOS != windowsOS { + t.Skip("Rotation tests have been flaky on Windows. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16331") + } t.Parallel() tempDir := t.TempDir() @@ -545,6 +557,9 @@ func TestCopyTruncateWriteBoth(t *testing.T) { } func TestFileMovedWhileOff_BigFiles(t *testing.T) { + if runtime.GOOS != windowsOS { + t.Skip("Rotation tests have been flaky on Windows. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16331") + } t.Parallel() tempDir := t.TempDir()