From 3e549946e97f528dc875b5744c673cb4540e2b51 Mon Sep 17 00:00:00 2001 From: Anderson Queiroz Date: Mon, 3 Apr 2023 11:59:35 +0200 Subject: [PATCH] Enhance and refactor some integration tests (#34920) * add waitUntilEventCountCtx so it can time out or be cancelled * rename methods to better reflect what they actually do --- filebeat/input/filestream/environment_test.go | 47 +++++++++-- .../filestream/input_integration_test.go | 83 +++++++++---------- .../filestream/parsers_integration_test.go | 28 +++---- 3 files changed, 94 insertions(+), 64 deletions(-) diff --git a/filebeat/input/filestream/environment_test.go b/filebeat/input/filestream/environment_test.go index d30f0a9b551..6af52ded862 100644 --- a/filebeat/input/filestream/environment_test.go +++ b/filebeat/input/filestream/environment_test.go @@ -16,14 +16,12 @@ // under the License. //go:build integration -// +build integration package filestream import ( "context" "fmt" - "io/ioutil" "os" "path/filepath" "sync" @@ -122,15 +120,15 @@ func (e *inputTestingEnvironment) waitUntilInputStops() { e.wg.Wait() } -func (e *inputTestingEnvironment) mustWriteLinesToFile(filename string, lines []byte) { +func (e *inputTestingEnvironment) mustWriteToFile(filename string, data []byte) { path := e.abspath(filename) - err := ioutil.WriteFile(path, lines, 0o644) + err := os.WriteFile(path, data, 0o644) if err != nil { e.t.Fatalf("failed to write file '%s': %+v", path, err) } } -func (e *inputTestingEnvironment) mustAppendLinesToFile(filename string, lines []byte) { +func (e *inputTestingEnvironment) mustAppendToFile(filename string, data []byte) { path := e.abspath(filename) f, err := os.OpenFile(path, os.O_WRONLY|os.O_APPEND, 0o644) if err != nil { @@ -138,9 +136,9 @@ func (e *inputTestingEnvironment) mustAppendLinesToFile(filename string, lines [ } defer f.Close() - _, err = f.Write(lines) + _, err = f.Write(data) if err != nil { - e.t.Fatalf("append lines to file '%s': %+v", path, err) + e.t.Fatalf("append data to file '%s': %+v", path, err) } } @@ -335,6 +333,38 @@ func (e *inputTestingEnvironment) waitUntilEventCount(count int) { } } +// waitUntilEventCountCtx calls waitUntilEventCount, but fails if ctx is cancelled. +func (e *inputTestingEnvironment) waitUntilEventCountCtx(ctx context.Context, count int) { + e.t.Helper() + ch := make(chan struct{}) + + go func() { + e.waitUntilEventCount(count) + ch <- struct{}{} + }() + + select { + case <-ctx.Done(): + logLines := map[string][]string{} + for _, e := range e.pipeline.GetAllEvents() { + flat := e.Fields.Flatten() + pathi, _ := flat.GetValue("log.file.path") + path := pathi.(string) + msgi, _ := flat.GetValue("message") + msg := msgi.(string) + logLines[path] = append(logLines[path], msg) + } + + e.t.Fatalf("waitUntilEventCountCtx: %v. Want %d events, got %d: %v", + ctx.Err(), + count, + len(e.pipeline.GetAllEvents()), + logLines) + case <-ch: + return + } +} + // waitUntilAtLeastEventCount waits until at least count events arrive to the client. func (e *inputTestingEnvironment) waitUntilAtLeastEventCount(count int) { for { @@ -378,7 +408,8 @@ func (e *inputTestingEnvironment) requireEventsReceived(events []string) { } } - require.Equal(e.t, 0, len(missingEvents), "following events are missing: %+v", missingEvents) + require.Equal(e.t, 0, len(missingEvents), + "following events are missing: %+v", missingEvents) } func (e *inputTestingEnvironment) getOutputMessages() []string { diff --git a/filebeat/input/filestream/input_integration_test.go b/filebeat/input/filestream/input_integration_test.go index c57d29dc28d..b5f1c014990 100644 --- a/filebeat/input/filestream/input_integration_test.go +++ b/filebeat/input/filestream/input_integration_test.go @@ -16,7 +16,6 @@ // under the License. //go:build integration -// +build integration package filestream @@ -58,7 +57,7 @@ func TestFilestreamCloseRenamed(t *testing.T) { }) testlines := []byte("first log line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -71,7 +70,7 @@ func TestFilestreamCloseRenamed(t *testing.T) { env.mustRenameFile(testlogName, testlogNameRotated) newerTestlines := []byte("new first log line\nnew second log line\n") - env.mustWriteLinesToFile(testlogName, newerTestlines) + env.mustWriteToFile(testlogName, newerTestlines) env.waitUntilEventCount(3) @@ -97,7 +96,7 @@ func TestFilestreamMetadataUpdatedOnRename(t *testing.T) { }) testline := []byte("log line\n") - env.mustWriteLinesToFile(testlogName, testline) + env.mustWriteToFile(testlogName, testline) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -113,7 +112,7 @@ func TestFilestreamMetadataUpdatedOnRename(t *testing.T) { env.waitUntilMetaInRegistry(testlogNameRenamed, "fake-ID", fileMeta{Source: env.abspath(testlogNameRenamed), IdentifierName: "native"}) env.requireOffsetInRegistry(testlogNameRenamed, "fake-ID", len(testline)) - env.mustAppendLinesToFile(testlogNameRenamed, testline) + env.mustAppendToFile(testlogNameRenamed, testline) env.waitUntilEventCount(2) env.requireOffsetInRegistry(testlogNameRenamed, "fake-ID", len(testline)*2) @@ -136,7 +135,7 @@ func TestFilestreamCloseRemoved(t *testing.T) { }) testlines := []byte("first log line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -176,7 +175,7 @@ func TestFilestreamCloseEOF(t *testing.T) { testlines := []byte("first log line\n") expectedOffset := len(testlines) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -186,7 +185,7 @@ func TestFilestreamCloseEOF(t *testing.T) { env.requireOffsetInRegistry(testlogName, "fake-ID", expectedOffset) // the second log line will not be picked up as scan_interval is set to one day. - env.mustWriteLinesToFile(testlogName, []byte("first line\nsecond log line\n")) + env.mustWriteToFile(testlogName, []byte("first line\nsecond log line\n")) // only one event is read env.waitUntilEventCount(1) @@ -212,13 +211,13 @@ func TestFilestreamEmptyLine(t *testing.T) { env.startInput(ctx, inp) testlines := []byte("first log line\nnext is an empty line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) env.waitUntilEventCount(2) env.requireOffsetInRegistry(testlogName, "fake-ID", len(testlines)) moreTestlines := []byte("\nafter an empty line\n") - env.mustAppendLinesToFile(testlogName, moreTestlines) + env.mustAppendToFile(testlogName, moreTestlines) env.waitUntilEventCount(3) env.requireEventsReceived([]string{ @@ -250,7 +249,7 @@ func TestFilestreamEmptyLinesOnly(t *testing.T) { env.startInput(ctx, inp) testlines := []byte("\n\n\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) cancelInput() env.waitUntilInputStops() @@ -277,7 +276,7 @@ func TestFilestreamBOMUTF8(t *testing.T) { 2016-04-05T00:00:02.052Z,,,,,"MDB:61914740-3f1b-4ddb-94e0-557196870cfa, Mailbox:279f077c-216f-4323-a9ee-48e50ffd3cad, Event:269492708, MessageClass:IPM.Note.StorageQuotaWarning.Warning, CreationTime:2016-04-05T00:00:01.022Z, ClientType:System",,STOREDRIVER,NOTIFYMAPI,,,,,,,,,,,,,,,,,S:ItemEntryId=00-00-00-00-37-DB-F9-F9-B5-F2-42-4F-86-62-E6-5D-FC-0C-A1-41-07-00-0E-D6-03-16-80-DC-8C-44-9D-30-07-23-ED-71-B7-F7-00-00-1F-D4-B5-0E-00-00-2E-EF-F2-59-0E-E8-2D-46-BC-31-02-85-0D-67-98-43-00-00-37-4A-A3-B3-00-00 2016-04-05T00:00:02.145Z,,,,,"MDB:61914740-3f1b-4ddb-94e0-557196870cfa, Mailbox:49cb09c6-5b76-415d-a085-da0ad9079682, Event:269492711, MessageClass:IPM.Note.StorageQuotaWarning.Warning, CreationTime:2016-04-05T00:00:01.038Z, ClientType:System",,STOREDRIVER,NOTIFYMAPI,,,,,,,,,,,,,,,,,S:ItemEntryId=00-00-00-00-97-8F-07-43-51-44-61-4A-AD-BD-29-D4-97-4E-20-A0-07-00-0E-D6-03-16-80-DC-8C-44-9D-30-07-23-ED-71-B7-F7-00-8E-8F-BD-EB-57-00-00-3D-FB-CE-26-A4-8D-46-4C-A4-35-0F-A7-9B-FA-D7-B9-00-00-37-44-2F-CA-00-00 `)...) - env.mustWriteLinesToFile(testlogName, lines) + env.mustWriteToFile(testlogName, lines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -317,7 +316,7 @@ func TestFilestreamUTF16BOMs(t *testing.T) { writer.Write(line) writer.Close() - env.mustWriteLinesToFile(testlogName, buf.Bytes()) + env.mustWriteToFile(testlogName, buf.Bytes()) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -346,7 +345,7 @@ func TestFilestreamCloseTimeout(t *testing.T) { }) testlines := []byte("first line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -355,7 +354,7 @@ func TestFilestreamCloseTimeout(t *testing.T) { env.requireOffsetInRegistry(testlogName, "fake-ID", len(testlines)) env.waitUntilHarvesterIsDone() - env.mustWriteLinesToFile(testlogName, []byte("first line\nsecond log line\n")) + env.mustWriteToFile(testlogName, []byte("first line\nsecond log line\n")) env.waitUntilEventCount(1) @@ -379,7 +378,7 @@ func TestFilestreamCloseAfterInterval(t *testing.T) { }) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -409,7 +408,7 @@ func TestFilestreamCloseAfterIntervalRemoved(t *testing.T) { }) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -441,7 +440,7 @@ func TestFilestreamCloseAfterIntervalRenamed(t *testing.T) { }) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -475,7 +474,7 @@ func TestFilestreamCloseAfterIntervalRotatedAndRemoved(t *testing.T) { }) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -510,7 +509,7 @@ func TestFilestreamCloseAfterIntervalRotatedAndNewRemoved(t *testing.T) { }) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -524,7 +523,7 @@ func TestFilestreamCloseAfterIntervalRotatedAndNewRemoved(t *testing.T) { env.waitUntilHarvesterIsDone() newTestlines := []byte("rotated first line\nrotated second line\nrotated third line\n") - env.mustWriteLinesToFile(testlogName, newTestlines) + env.mustWriteToFile(testlogName, newTestlines) env.waitUntilEventCount(6) @@ -552,7 +551,7 @@ func TestFilestreamTruncatedFileOpen(t *testing.T) { env.startInput(ctx, inp) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) env.waitUntilEventCount(3) env.requireOffsetInRegistry(testlogName, "fake-ID", len(testlines)) @@ -561,7 +560,7 @@ func TestFilestreamTruncatedFileOpen(t *testing.T) { time.Sleep(5 * time.Millisecond) truncatedTestLines := []byte("truncated first line\n") - env.mustWriteLinesToFile(testlogName, truncatedTestLines) + env.mustWriteToFile(testlogName, truncatedTestLines) env.waitUntilEventCount(4) cancelInput() @@ -586,7 +585,7 @@ func TestFilestreamTruncatedFileClosed(t *testing.T) { env.startInput(ctx, inp) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) env.waitUntilEventCount(3) env.requireOffsetInRegistry(testlogName, "fake-ID", len(testlines)) @@ -597,7 +596,7 @@ func TestFilestreamTruncatedFileClosed(t *testing.T) { time.Sleep(5 * time.Millisecond) truncatedTestLines := []byte("truncated first line\n") - env.mustWriteLinesToFile(testlogName, truncatedTestLines) + env.mustWriteToFile(testlogName, truncatedTestLines) env.waitUntilEventCount(4) cancelInput() @@ -623,7 +622,7 @@ func TestFilestreamTruncateWithSymlink(t *testing.T) { }) lines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, lines) + env.mustWriteToFile(testlogName, lines) env.mustSymlink(testlogName, symlinkName) @@ -640,7 +639,7 @@ func TestFilestreamTruncateWithSymlink(t *testing.T) { env.waitUntilOffsetInRegistry(testlogName, "fake-ID", 0) moreLines := []byte("forth line\nfifth line\n") - env.mustWriteLinesToFile(testlogName, moreLines) + env.mustWriteToFile(testlogName, moreLines) env.waitUntilEventCount(5) env.requireOffsetInRegistry(testlogName, "fake-ID", len(moreLines)) @@ -666,7 +665,7 @@ func TestFilestreamTruncateBigScannerInterval(t *testing.T) { env.startInput(ctx, inp) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) env.waitUntilEventCount(3) env.requireOffsetInRegistry(testlogName, "fake-ID", len(testlines)) @@ -674,7 +673,7 @@ func TestFilestreamTruncateBigScannerInterval(t *testing.T) { env.mustTruncateFile(testlogName, 0) truncatedTestLines := []byte("truncated first line\n") - env.mustWriteLinesToFile(testlogName, truncatedTestLines) + env.mustWriteToFile(testlogName, truncatedTestLines) env.waitUntilEventCount(3) @@ -697,7 +696,7 @@ func TestFilestreamTruncateCheckOffset(t *testing.T) { env.startInput(ctx, inp) testlines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) env.waitUntilEventCount(3) env.requireOffsetInRegistry(testlogName, "fake-ID", len(testlines)) @@ -723,7 +722,7 @@ func TestFilestreamTruncateBlockedOutput(t *testing.T) { }) testlines := []byte("first line\nsecond line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -739,7 +738,7 @@ func TestFilestreamTruncateBlockedOutput(t *testing.T) { // extra lines are appended after first line is processed // so it can interfere with the truncation of the file - env.mustAppendLinesToFile(testlogName, []byte("third line\n")) + env.mustAppendToFile(testlogName, []byte("third line\n")) env.mustTruncateFile(testlogName, 0) @@ -751,7 +750,7 @@ func TestFilestreamTruncateBlockedOutput(t *testing.T) { env.pipeline.invertBlocking() truncatedTestLines := []byte("truncated line\n") - env.mustWriteLinesToFile(testlogName, truncatedTestLines) + env.mustWriteToFile(testlogName, truncatedTestLines) env.waitUntilEventCount(3) env.waitUntilOffsetInRegistry(testlogName, "fake-ID", len(truncatedTestLines)) @@ -775,7 +774,7 @@ func TestFilestreamSymlinksEnabled(t *testing.T) { }) testlines := []byte("first line\n") - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) env.mustSymlink(testlogName, symlinkName) @@ -810,7 +809,7 @@ func TestFilestreamSymlinkRotated(t *testing.T) { commonLine := "first line in file " for i, path := range []string{firstTestlogName, secondTestlogName} { - env.mustWriteLinesToFile(path, []byte(commonLine+strconv.Itoa(i)+"\n")) + env.mustWriteToFile(path, []byte(commonLine+strconv.Itoa(i)+"\n")) } env.mustSymlink(firstTestlogName, symlinkName) @@ -828,7 +827,7 @@ func TestFilestreamSymlinkRotated(t *testing.T) { env.mustSymlink(secondTestlogName, symlinkName) moreLines := "second line in file 2\nthird line in file 2\n" - env.mustAppendLinesToFile(secondTestlogName, []byte(moreLines)) + env.mustAppendToFile(secondTestlogName, []byte(moreLines)) env.waitUntilEventCount(4) env.requireOffsetInRegistry(firstTestlogName, "fake-ID", expectedOffset) @@ -858,7 +857,7 @@ func TestFilestreamSymlinkRemoved(t *testing.T) { }) line := []byte("first line\n") - env.mustWriteLinesToFile(testlogName, line) + env.mustWriteToFile(testlogName, line) env.mustSymlink(testlogName, symlinkName) @@ -872,7 +871,7 @@ func TestFilestreamSymlinkRemoved(t *testing.T) { // remove symlink env.mustRemoveFile(symlinkName) - env.mustAppendLinesToFile(testlogName, line) + env.mustAppendToFile(testlogName, line) env.waitUntilEventCount(2) env.requireOffsetInRegistry(testlogName, "fake-ID", 2*len(line)) @@ -900,7 +899,7 @@ func TestFilestreamTruncate(t *testing.T) { }) lines := []byte("first line\nsecond line\nthird line\n") - env.mustWriteLinesToFile(testlogName, lines) + env.mustWriteToFile(testlogName, lines) env.mustSymlink(testlogName, symlinkName) @@ -920,7 +919,7 @@ func TestFilestreamTruncate(t *testing.T) { env.mustSymlink(testlogName, symlinkName) moreLines := []byte("forth line\nfifth line\n") - env.mustWriteLinesToFile(testlogName, moreLines) + env.mustWriteToFile(testlogName, moreLines) env.waitUntilOffsetInRegistry(testlogName, "fake-ID", len(moreLines)) @@ -1009,7 +1008,7 @@ func TestRotatingCloseInactiveLowWriteRate(t *testing.T) { time.Sleep(1 * time.Second) - env.mustWriteLinesToFile(testlogName, []byte("Line 1\n")) + env.mustWriteToFile(testlogName, []byte("Line 1\n")) env.waitUntilEventCount(1) env.mustRenameFile(testlogName, testlogName+".1") @@ -1017,7 +1016,7 @@ func TestRotatingCloseInactiveLowWriteRate(t *testing.T) { env.waitUntilHarvesterIsDone() time.Sleep(2 * time.Second) - env.mustWriteLinesToFile(testlogName, []byte("Line 2\n")) + env.mustWriteToFile(testlogName, []byte("Line 2\n")) // allow for events to be send multiple times due to log rotation env.waitUntilAtLeastEventCount(2) diff --git a/filebeat/input/filestream/parsers_integration_test.go b/filebeat/input/filestream/parsers_integration_test.go index c581a726766..b2280ba875e 100644 --- a/filebeat/input/filestream/parsers_integration_test.go +++ b/filebeat/input/filestream/parsers_integration_test.go @@ -44,7 +44,7 @@ func TestParsersAgentLogs(t *testing.T) { }) testline := []byte("{\"log.level\":\"info\",\"@timestamp\":\"2021-05-12T16:15:09.411+0000\",\"log.origin\":{\"file.name\":\"log/harvester.go\",\"file.line\":302},\"message\":\"Harvester started for file: /var/log/auth.log\",\"ecs.version\":\"1.6.0\"}\n") - env.mustWriteLinesToFile(testlogName, testline) + env.mustWriteToFile(testlogName, testline) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -84,7 +84,7 @@ func TestParsersDockerLogsFiltering(t *testing.T) { {"log":"Fetching dependencies...\n","stream":"stdout","time":"2016-03-02T22:59:04.609292428Z"} {"log":"Execute /scripts/packetbeat_before_build.sh\n","stream":"stdout","time":"2016-03-02T22:59:04.617434682Z"} `) - env.mustWriteLinesToFile(testlogName, testline) + env.mustWriteToFile(testlogName, testline) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -120,7 +120,7 @@ func TestParsersSimpleJSONOverwrite(t *testing.T) { }) testline := []byte("{\"source\": \"hello\", \"message\": \"test source\"}\n") - env.mustWriteLinesToFile(testlogName, testline) + env.mustWriteToFile(testlogName, testline) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -160,7 +160,7 @@ func TestParsersTimestampInJSONMessage(t *testing.T) { {"@timestamp":{"hello": "test"}} `) - env.mustWriteLinesToFile(testlogName, testline) + env.mustWriteToFile(testlogName, testline) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -199,7 +199,7 @@ func TestParsersJavaElasticsearchLogs(t *testing.T) { }) testlines := []byte(elasticsearchMultilineLogs) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -240,7 +240,7 @@ lines In addition it has normal lines The total should be 4 lines covered `) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -285,7 +285,7 @@ connection <0.23893.109>, channel 3 - soft error: "no queue 'bucket-1' in vhost '/'", 'queue.declare'} `) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -321,7 +321,7 @@ func TestParsersMultilineMaxLines(t *testing.T) { }) testlines := []byte(elasticsearchMultilineLongLogs) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -368,7 +368,7 @@ func TestParsersMultilineTimeout(t *testing.T) { First Line Second Line `) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -382,7 +382,7 @@ func TestParsersMultilineTimeout(t *testing.T) { First line again `) - env.mustAppendLinesToFile(testlogName, moreLines) + env.mustAppendToFile(testlogName, moreLines) env.requireEventsReceived([]string{ `[2015] hello world @@ -430,7 +430,7 @@ func TestParsersMultilineMaxBytes(t *testing.T) { }) testlines := []byte(elasticsearchMultilineLongLogs) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -474,7 +474,7 @@ func TestParsersCloseTimeoutWithMultiline(t *testing.T) { First Line Second Line `) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp) @@ -489,7 +489,7 @@ func TestParsersCloseTimeoutWithMultiline(t *testing.T) { First line again `) - env.mustAppendLinesToFile(testlogName, moreLines) + env.mustAppendToFile(testlogName, moreLines) env.requireEventsReceived([]string{ `[2015] hello world @@ -550,7 +550,7 @@ SetAdCodeMiddleware.default_ad_code path /health_check SetAdCodeMiddleware.default_ad_code route ` testlines := append([]byte(line1), []byte(line2)...) - env.mustWriteLinesToFile(testlogName, testlines) + env.mustWriteToFile(testlogName, testlines) ctx, cancelInput := context.WithCancel(context.Background()) env.startInput(ctx, inp)