Skip to content

Commit 847a131

Browse files
Fix TestEventLogFile (#5341) (#5350)
Fix TestEventLogFile by updating the string that needs to be searched in the logs. (cherry picked from commit b96a4ca) Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
1 parent d3205ec commit 847a131

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

testing/integration/container_cmd_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ func TestContainerCMDEventToStderr(t *testing.T) {
378378
agentOutputStr := agentOutput.String()
379379
scanner := bufio.NewScanner(strings.NewReader(agentOutputStr))
380380
for scanner.Scan() {
381-
if strings.Contains(scanner.Text(), "Cannot index event publisher.Event") {
381+
if strings.Contains(scanner.Text(), "Cannot index event") {
382382
return true
383383
}
384384
}

testing/integration/event_logging_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ func TestEventLogOutputConfiguredViaFleet(t *testing.T) {
163163
},
164164
Group: "container",
165165
})
166-
t.Skip("Flaky test: https://github.com/elastic/elastic-agent/issues/5159")
167166

168167
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
169168
defer cancel()
@@ -255,7 +254,7 @@ func TestEventLogOutputConfiguredViaFleet(t *testing.T) {
255254
agentOutputStr := agentOutput.String()
256255
scanner := bufio.NewScanner(strings.NewReader(agentOutputStr))
257256
for scanner.Scan() {
258-
if strings.Contains(scanner.Text(), "Cannot index event publisher.Event") {
257+
if strings.Contains(scanner.Text(), "Cannot index event") {
259258
return true
260259
}
261260
}
@@ -341,7 +340,7 @@ func requireEventLogFileExistsWithData(t *testing.T, agentFixture *atesting.Fixt
341340
}
342341

343342
logEntry := string(logEntryBytes)
344-
expectedStr := "Cannot index event publisher.Event"
343+
expectedStr := "Cannot index event"
345344
if !strings.Contains(logEntry, expectedStr) {
346345
t.Errorf(
347346
"did not find the expected log entry ('%s') in the events log file",

0 commit comments

Comments
 (0)