Repository navigation
Conversation
Mcrich23
left a comment
There was a problem hiding this comment.
This looks great! Thank you
Would it be possible to add a new dynamic test for this? You can just make a new file in Tests/Container-Compose-DynamicTests called ComposeDownTests.swift. It could probably just bring up a container and then shut it down and make sure that everything goes up and down.
This provies the missing tests for PR Mcrich23#39
This provies the missing tests for PR Mcrich23#39
I took the liberty of adding said test in #50, also with a little bit of a test hardness to quickly copy the YAML stuff in the correct folder. |
|
Thanks! I've been hit with the real life bug and haven't had time to get back to these PRs, but I appreciate the help of adding the test! |
* Handle compose down with container_name case * Providing tests for `container-compose down` This provies the missing tests for PR #39 * Correctly asserting up/down * Added copyYamlToTemporaryLocation as test helper * Addressing code review * test expect cleanup for containers running and stopping * Update ComposeDownTests.swift * Update ComposeDownTests.swift * Update ComposeDownTests.swift --------- Co-authored-by: rtoohil <[email protected]> Co-authored-by: Morris Richman <[email protected]>
|
Merged this with #50. |
* Handle compose down with container_name case * Providing tests for `container-compose down` This provies the missing tests for PR Mcrich23#39 * Correctly asserting up/down * Added copyYamlToTemporaryLocation as test helper * Addressing code review * test expect cleanup for containers running and stopping * Update ComposeDownTests.swift * Update ComposeDownTests.swift * Update ComposeDownTests.swift --------- Co-authored-by: rtoohil <[email protected]> Co-authored-by: Morris Richman <[email protected]>
* Handle compose down with container_name case * Providing tests for `container-compose down` This provies the missing tests for PR Mcrich23#39 * Correctly asserting up/down * Added copyYamlToTemporaryLocation as test helper * Addressing code review * test expect cleanup for containers running and stopping * Update ComposeDownTests.swift * Update ComposeDownTests.swift * Update ComposeDownTests.swift --------- Co-authored-by: rtoohil <[email protected]> Co-authored-by: Morris Richman <[email protected]>
ComposeUp had three places (getIPForRunningService, waitUntilServiceIsRunning, stopOldStuff) that hard-coded the container name as "\(projectName)-\(serviceName)" instead of reading service.container_name. When a compose file set an explicit container_name, the container started correctly (container run --name used the right value), but the post-start lookups waited for the wrong name and timed out after 30s. Extract a single Service.containerName(projectName:serviceName:) helper and replace all five call sites (four in ComposeUp, one in ComposeDown) with it. ComposeDown already had the equivalent inline logic from PR Mcrich23#39; this commit replaces that with the same helper for consistency. Fixes Mcrich23#38 (upstream issue; the down side was fixed in PR Mcrich23#39, the up side was not addressed until now).
ComposeUp had three places (getIPForRunningService, waitUntilServiceIsRunning, stopOldStuff) that hard-coded the container name as "\(projectName)-\(serviceName)" instead of reading service.container_name. When a compose file set an explicit container_name, the container started correctly (container run --name used the right value), but the post-start lookups waited for the wrong name and timed out after 30s. Extract a single Service.containerName(projectName:serviceName:) helper and replace all five call sites (four in ComposeUp, one in ComposeDown) with it. ComposeDown already had the equivalent inline logic from PR Mcrich23#39; this commit replaces that with the same helper for consistency. Fixes Mcrich23#38
ComposeUp had three places (getIPForRunningService, waitUntilServiceIsRunning, stopOldStuff) that hard-coded the container name as "\(projectName)-\(serviceName)" instead of reading service.container_name. When a compose file set an explicit container_name, the container started correctly (container run --name used the right value), but the post-start lookups waited for the wrong name and timed out after 30s. Extract a single Service.containerName(projectName:serviceName:) helper and replace all five call sites (four in ComposeUp, one in ComposeDown) with it. ComposeDown already had the equivalent inline logic from PR Mcrich23#39; this commit replaces that with the same helper for consistency.
If you use container_name: with a custom name in your compose file, compose up properly handles that, but compose down does not, and defaults to its internal naming, will fail to stop the container, and will not throw an error, because it eats the error.
See #38
This should resolve that case. PR contributed to with Claude.