Skip to content

e2e: enable goleak check#909

Merged
mmatczuk merged 7 commits intomainfrom
hg/goleak
Oct 17, 2024
Merged

e2e: enable goleak check#909
mmatczuk merged 7 commits intomainfrom
hg/goleak

Conversation

@Choraden
Copy link
Contributor

This patch extends compose with functionality to check exit codes of services. It improves tests quality as it enforces that all services exit with code 0. That allows to correctly assert goleak errors.

Fixes #516

@mmatczuk
Copy link
Contributor

@Choraden what's the status?

@Choraden
Copy link
Contributor Author

I've encountered goleak errors as if the proxy would not close all the goroutines gracefully, but rather a forced shutdown happens. I had no time to investigate it further.

e2e/setups.go Outdated
forwarder.ProxyService().
WithProtocol(proxyScheme)).
WithProtocol(proxyScheme).
WithGoleak()).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, why not enable it by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I enabled goleak in a proxy service by default.

return c.quietRun(c.cmd("stop", args))
}

func (c *Command) ExitedSuccessfully(services []string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more useful to export serviceExitCode and add plain functions to do assertions about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compose.Command now exports ServiceExitCode.

if err := cmd.Stop(); err != nil {
return fmt.Errorf("compose stop: %w", err)
}
if err := cmd.ExitedSuccessfully(r.services(s)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to check exit status of all services?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does check exit code of all services.

@mmatczuk
Copy link
Contributor

This is very good progress.

@Choraden
Copy link
Contributor Author

@mmatczuk I've addressed your comments.

@mmatczuk mmatczuk self-requested a review October 17, 2024 12:14
Copy link
Contributor

@mmatczuk mmatczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mmatczuk mmatczuk merged commit 581e2a2 into main Oct 17, 2024
@mmatczuk mmatczuk deleted the hg/goleak branch October 17, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2e: enable goleak check

2 participants