Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Integration Test Framework] Dump process list on first failure #4935

Closed
ycombinator opened this issue Jun 13, 2024 · 1 comment · Fixed by #4942
Closed

[Integration Test Framework] Dump process list on first failure #4935

ycombinator opened this issue Jun 13, 2024 · 1 comment · Fixed by #4942
Labels
Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Testing

Comments

@ycombinator
Copy link
Contributor

Currently, when an integration test fails, we dump the process list to help debug the failure, by registering a t.Cleanup() callback:

f.t.Cleanup(func() {
if f.t.Failed() {
procs := getProcesses(f.t, `.*`)
dir, err := findProjectRoot(f.caller)
if err != nil {
f.t.Logf("failed to dump process; failed to find project root: %s", err)
return
}

However, this callback registration is happening after the test attempts to install Elastic Agent:

if installOpts == nil {
// default options when not provided
installOpts = &InstallOpts{}
}
installArgs := []string{"install"}
installOptsArgs, err := installOpts.toCmdArgs(f.operatingSystem)
if err != nil {
return nil, err
}
installArgs = append(installArgs, installOptsArgs...)
out, err := f.Exec(ctx, installArgs, opts...)
if err != nil {
return out, fmt.Errorf("error running agent install command: %w", err)
}

Consequently, if the install itself fails, we do not get a dump of the process list.

We should make it so the process list is dumped on the earliest failure of any integration test.

@ycombinator ycombinator added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Testing labels Jun 13, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants