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

Fix stop services in docker compose #918

Merged
merged 4 commits into from
Mar 8, 2023

Conversation

sko00o
Copy link
Contributor

@sko00o sko00o commented Mar 6, 2023

What does this PR do?

  1. Add a test to demonstrate the issue problem.
  2. Add logger in dockerCompose struct to fix the panic problem.

Why is it important?

I need to restart services in some test cases.

Related issues

@sko00o sko00o requested a review from a team as a code owner March 6, 2023 16:52
@netlify
Copy link

netlify bot commented Mar 6, 2023

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit a26b25c
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/6407fe514682830008d9c5ed
😎 Deploy Preview https://deploy-preview-918--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@mdelapenya
Copy link
Collaborator

We are going to merge #910 very soon, which could cause a merge conflict with this one. Will ping you here once that PR is merged, so you can update it 🙏 (or I can do it myself if they are not that severe)

@sko00o
Copy link
Contributor Author

sko00o commented Mar 6, 2023

I saw that PR. And I could deal with conflict after that merged.

@mdelapenya
Copy link
Collaborator

#910 was merged, no merge conflicts :)

@@ -101,6 +102,42 @@ func TestDockerComposeAPIWithRunServices(t *testing.T) {
assert.Contains(t, serviceNames, "nginx")
}

func TestDockerComposeAPIWithStopServices(t *testing.T) {
compose, err := NewDockerComposeWith(
WithStackFiles("./testresources/docker-compose-complex.yml"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you use filepath to build an OS-agnostic path?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is also a constant for the yaml file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. And I rebase onto the latest main branch.

@sonarcloud
Copy link

sonarcloud bot commented Mar 8, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
30.8% 30.8% Duplication

Copy link
Collaborator

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks @sko00o for your contribution. Even though sonarcloud complains on the duplicated code, I'm going to merge it as, for me, in tests, some duplication comes with readability.

I'd like to thank you for your dedication to testcontainers-go! 🚀

@mdelapenya mdelapenya merged commit 13c7521 into testcontainers:main Mar 8, 2023
@mdelapenya mdelapenya self-assigned this Mar 8, 2023
@mdelapenya mdelapenya added the bug An issue with the library label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants