Skip to content

feat: Providing tests for ComposeDown#50

Merged
Mcrich23 merged 9 commits intoMcrich23:mainfrom
oxisto:feature/compose-down-not-stopping-containers
Feb 4, 2026
Merged

feat: Providing tests for ComposeDown#50
Mcrich23 merged 9 commits intoMcrich23:mainfrom
oxisto:feature/compose-down-not-stopping-containers

Conversation

@oxisto
Copy link
Contributor

@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
Contributor 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

@oxisto oxisto requested a review from Mcrich23 January 31, 2026 22:56
@Mcrich23
Copy link
Owner

Mcrich23 commented Feb 4, 2026

@oxisto I made a couple testing expect changes to be more dynamic. When running tests though, it seems that wordpress is receiving an invalid argument.

container logs Container-Compose_Tests_00C176C4-234A-4D2A-A2A9-BD33F943F99B-wordpress
Error: internalError: " Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument""

But it still works on main's tests, meaning that wordpress didn't change something. Can you please take a look at your tests?

@oxisto
Copy link
Contributor Author

oxisto commented Feb 4, 2026

@oxisto I made a couple testing expect changes to be more dynamic. When running tests though, it seems that wordpress is receiving an invalid argument.

container logs Container-Compose_Tests_00C176C4-234A-4D2A-A2A9-BD33F943F99B-wordpress
Error: internalError: " Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument""

But it still works on main's tests, meaning that wordpress didn't change something. Can you please take a look at your tests?

Thanks! Yeah it's weird, it seems either web or Wordpress is not be able to start but it basically uses the same code as in the "up" test. The only thing I changed is that I extracted the "run" into a utility function and maybe this utility function is doing slightly different things, I'll take a look.

@oxisto
Copy link
Contributor Author

oxisto commented Feb 4, 2026

@oxisto I made a couple testing expect changes to be more dynamic. When running tests though, it seems that wordpress is receiving an invalid argument.

container logs Container-Compose_Tests_00C176C4-234A-4D2A-A2A9-BD33F943F99B-wordpress
Error: internalError: " Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument""

But it still works on main's tests, meaning that wordpress didn't change something. Can you please take a look at your tests?

FYI the wordpress test-case also "fails" on the "up" tests, the wordpress container is not starting correctly because it can no connect other the DB. you can see that on the test logs

Error Domain=ContainerWait Code=1 "Timed out waiting for container 'Container-Compose_Tests_927D9EC3-DAE9-40F4-94B5-DAE69BB4E95F-wordpress' to be running." UserInfo={NSLocalizedDescription=Timed out waiting for container 'Container-Compose_Tests_927D9EC3-DAE9-40F4-94B5-DAE69BB4E95F-wordpress' to be running.}

but the test is actually not asserting that it is running.

@oxisto
Copy link
Contributor Author

oxisto commented Feb 4, 2026

getIPForRunningService is returning the wrong IP address, it returns the address of the gateway, but it should return the address of the container

@Mcrich23
Copy link
Owner

Mcrich23 commented Feb 4, 2026

but the test is actually not asserting that it is running.

how so? It checks that all containers have the running status.

@oxisto
Copy link
Contributor Author

oxisto commented Feb 4, 2026

but the test is actually not asserting that it is running.

how so? It checks that all containers have the running status.

No it does not :) Check testWordPressCompose(), that does NOT check the running status. TestComplexDependencyChain() DOES.

The Wordpress container has several problems and should probably not be used. It tries to copy data into the volume, which fails horribly on named containers because of path issues and it fails even on non-named containers because of permission problems.

@Mcrich23
Copy link
Owner

Mcrich23 commented Feb 4, 2026

Ah yes, you are correct about that check. Thats a bad test

@Mcrich23
Copy link
Owner

Mcrich23 commented Feb 4, 2026

I am going to merge this and then we can replace wordpress as a separate pr.

@Mcrich23 Mcrich23 merged commit dd0b9a1 into Mcrich23:main Feb 4, 2026
1 check passed
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