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

e2e: enable goleak check #909

Merged
merged 7 commits into from
Oct 17, 2024
Merged

e2e: enable goleak check #909

merged 7 commits into from
Oct 17, 2024

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
@@ -66,7 +66,8 @@ func SetupDefaults(l *setupList) {
WithProtocol(httpbinScheme)).
AddService(
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.

@@ -106,6 +107,41 @@ func (c *Command) Stop(args ...string) error {
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
6 checks passed
@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