From b1bbd587d4adc89f9cbc34754c4e67123d8e5283 Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Wed, 8 May 2024 12:38:49 -0500 Subject: [PATCH] [chore][fileconsumer] Skip flaky TestFlushPeriodEOF on windows (#32946) See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32715 This also adds a bit more debugging info for other tests which fail on the same expectation, since it's not very obvious what was expected vs actually found. --- pkg/stanza/fileconsumer/internal/emittest/sink.go | 2 +- pkg/stanza/fileconsumer/internal/reader/reader_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/stanza/fileconsumer/internal/emittest/sink.go b/pkg/stanza/fileconsumer/internal/emittest/sink.go index 879bc0f2c36e..c836e41fd40b 100644 --- a/pkg/stanza/fileconsumer/internal/emittest/sink.go +++ b/pkg/stanza/fileconsumer/internal/emittest/sink.go @@ -119,7 +119,7 @@ func (s *Sink) ExpectTokens(t *testing.T, expected ...[]byte) { return } } - require.ElementsMatch(t, expected, actual) + require.ElementsMatch(t, expected, actual, fmt.Sprintf("expected: %v, actual: %v", expected, actual)) } func (s *Sink) ExpectCall(t *testing.T, expected []byte, attrs map[string]any) { diff --git a/pkg/stanza/fileconsumer/internal/reader/reader_test.go b/pkg/stanza/fileconsumer/internal/reader/reader_test.go index b26bd6a61c1f..97160e4ffc5f 100644 --- a/pkg/stanza/fileconsumer/internal/reader/reader_test.go +++ b/pkg/stanza/fileconsumer/internal/reader/reader_test.go @@ -6,6 +6,7 @@ package reader import ( "context" "fmt" + "runtime" "strings" "testing" "time" @@ -188,6 +189,9 @@ func TestFingerprintChangeSize(t *testing.T) { } func TestFlushPeriodEOF(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("Skipping test on Windows; See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32715") + } tempDir := t.TempDir() temp := filetest.OpenTemp(t, tempDir) // Create a long enough initial token, so the scanner can't read the whole file at once