Skip to content

Conversation

@oxisto
Copy link

@oxisto oxisto commented Jan 30, 2026

This PR adds a dynamic tests for ComposeDown and incorporates the fix of #39 to correctly handle container_name.

@oxisto oxisto force-pushed the feature/compose-down-not-stopping-containers branch from d4a37ab to 5991999 Compare January 30, 2026 16:49
@oxisto oxisto changed the title feature/compose down not stopping containers feat: Providing tests for ComposeDown Jan 30, 2026
@oxisto oxisto marked this pull request as ready for review January 30, 2026 17:12
@Mcrich23
Copy link
Owner

This looks great! Thank you so much. Going to do a quick code review right now.

Copy link
Owner

@Mcrich23 Mcrich23 left a comment

Choose a reason for hiding this comment

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

After taking a deeper look, it mostly feels good, but I have some specific requests regarding tests to make sure our tests are robust and strong to bring into the future of Container-Compose.

containers.count == 2,
"Expected 2 containers for \(project.name), found \(containers.count)")
#expect(
containers[0].status == .running,
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please make this check that all of these containers are running instead of just the first one?

Copy link
Author

Choose a reason for hiding this comment

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

adjusted it, but somehow this fails on my machine now, since it can't start the Wordpress container, but that might be a different bug :(

Copy link
Owner

Choose a reason for hiding this comment

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

Interesting. Try manually restarting the container subsystem

containers.count == 2,
"Expected 2 containers for \(project.name), found \(containers.count)")
#expect(
containers[0].status == .stopped,
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please make this check that all of these containers are stopped instead of just the first one?

Copy link
Author

Choose a reason for hiding this comment

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

adjusted it, but somehow this fails on my machine now, since it can't start the Wordpress container, but that might be a different bug :(

containers.count == 1,
"Expected 1 container with the name \(containerName), found \(containers.count)")
#expect(
containers[0].status == .running,
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please make this check that all of these containers are running instead of just the first one?

Copy link
Author

Choose a reason for hiding this comment

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

There should only be one for this particular test-case :)

Copy link
Owner

Choose a reason for hiding this comment

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

But still, best practice would be all containers. Just in case there is a future where this changes.

Copy link
Author

Choose a reason for hiding this comment

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

so I should do a loop from 0 to 1? I am not quite sure how you would imagine the perfect solution to be. free for any suggestions :)

Copy link
Owner

@Mcrich23 Mcrich23 Feb 1, 2026

Choose a reason for hiding this comment

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

Maybe just do a filter for all that have a status of stopped and check that the count of that array is 0

Something like:

containers.filter { $0.status == .stopped }.count == 1

containers.count == 1,
"Expected 1 container with the name \(containerName), found \(containers.count)")
#expect(
containers[0].status == .stopped,
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please make this check that all of these containers are stopped instead of just the first one?

Copy link
Author

@oxisto oxisto Jan 31, 2026

Choose a reason for hiding this comment

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

There should only be one for this particular test-case :)

@oxisto oxisto requested a review from Mcrich23 January 31, 2026 22:56
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.

3 participants