Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Dec 12, 2024
1 parent 09002a1 commit 9758447
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
11 changes: 8 additions & 3 deletions filebeat/input/filestream/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,14 @@ func (e *inputTestingEnvironment) waitUntilAtLeastEventCount(count int) {
// waitUntilHarvesterIsDone detects Harvester stop by checking if the last client has been closed
// as when a Harvester stops the client is closed.
func (e *inputTestingEnvironment) waitUntilHarvesterIsDone() {
for !e.pipeline.clients[len(e.pipeline.clients)-1].closed {
time.Sleep(10 * time.Millisecond)
}
require.Eventually(
e.t,
func() bool {
return e.pipeline.clients[len(e.pipeline.clients)-1].closed
},
time.Second*10,
time.Millisecond*10,
"The last connected client has not closed it's connection")
}

// requireEventsReceived requires that the list of messages has made it into the output.
Expand Down
10 changes: 6 additions & 4 deletions filebeat/input/filestream/input_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,12 @@ func TestFilestreamCloseEOF(t *testing.T) {
testlogName := "test.log"
id := "fake-ID-" + uuid.Must(uuid.NewV4()).String()
inp := env.mustCreateInput(map[string]interface{}{
"id": id,
"paths": []string{env.abspath(testlogName)},
"prospector.scanner.check_interval": "24h",
"close.reader.on_eof": "true",
"id": id,
"paths": []string{env.abspath(testlogName)},
"prospector.scanner.check_interval": "24h",
"prospector.scanner.fingerprint.enabled": false,
"file_identity.native": map[string]any{},
"close.reader.on_eof": "true",
})

testlines := []byte("first log line\n")
Expand Down

0 comments on commit 9758447

Please sign in to comment.