Skip to content

Commit

Permalink
fix(fleet): Fix flaky test (#30248)
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteFoy authored Oct 21, 2024
1 parent 5144429 commit 70e0419
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 0 additions & 3 deletions flakes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ test/new-e2e/tests/containers:
- TestECSSuite/TestCPU/metric___container.cpu.usage{^ecs_container_name:stress-ng$}
- TestEKSSuite/TestCPU/metric___container.cpu.usage{^kube_deployment:stress-ng$,^kube_namespace:workload-cpustress$}
- TestKindSuite/TestCPU/metric___container.cpu.usage{^kube_deployment:stress-ng$,^kube_namespace:workload-cpustress$}

test/new-e2e/tests/installer:
- TestPackages/upgrade_scenario_ubuntu_22_04_x86_64/TestUpgradeSuccessful
2 changes: 1 addition & 1 deletion test/new-e2e/tests/installer/host/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (h *Host) AssertSystemdEvents(since JournaldTimestamp, events SystemdEventS
}
lastSearchedEvents = searchedEvents
return j == len(events.Events)
}, 30*time.Second, 1*time.Second)
}, 60*time.Second, 1*time.Second)

if !success {
logs := h.journaldLogsSince(since)
Expand Down
5 changes: 5 additions & 0 deletions test/new-e2e/tests/installer/unix/all_packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ func envForceVersion(pkg, version string) string {
}

func (s *packageBaseSuite) Purge() {
// Reset the systemctl failed counter, best effort as they may not be loaded
for _, service := range []string{agentUnit, agentUnitXP, traceUnit, traceUnitXP, processUnit, processUnitXP, probeUnit, probeUnitXP, securityUnit, securityUnitXP} {
s.Env().RemoteHost.Execute(fmt.Sprintf("sudo systemctl reset-failed %s", service))
}

s.Env().RemoteHost.MustExecute("sudo apt-get remove -y --purge datadog-installer || sudo yum remove -y datadog-installer || sudo zypper remove -y datadog-installer")
}

Expand Down
6 changes: 5 additions & 1 deletion test/new-e2e/tests/installer/unix/package_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ func (s *packageAgentSuite) TestExperimentStopped() {
s.host.Run(`sudo systemctl start datadog-agent-exp --no-block`)

// ensure experiment is running
s.host.WaitForUnitActive(
"datadog-agent-trace-exp.service",
"datadog-agent-process-exp.service",
)
s.host.AssertSystemdEvents(timestamp, host.SystemdEvents().Started(traceUnitXP))
s.host.AssertSystemdEvents(timestamp, host.SystemdEvents().Started(processUnitXP))
s.host.AssertSystemdEvents(timestamp, host.SystemdEvents().Skipped(securityUnitXP))
Expand All @@ -370,7 +374,7 @@ func (s *packageAgentSuite) TestExperimentStopped() {
Unordered(host.SystemdEvents().
Started(traceUnit).
Started(processUnit).
SkippedIf(probeUnitXP, s.installMethod != InstallMethodAnsible).
SkippedIf(probeUnit, s.installMethod != InstallMethodAnsible).
Skipped(securityUnit),
),
)
Expand Down

0 comments on commit 70e0419

Please sign in to comment.