Repository navigation
test(e2e): cover the lifecycle of kind: container services - #14167
Merged
Merged
Conversation
Drive three container services, one per readiness mode, through the SDK, the bundle's OpenTofu, and the real Docker provider against a fake engine: bounded readiness, unchanged reapply, actionable failures and retries, interruption, replacement, refused removal, and destroy. Part of #12568.
Collaborator
Author
Authoring session — opening
|
Contributor
The interruption test cancelled when the web health endpoint received any request, while other containers could still be in creation. An interrupt during the Docker provider's container create loses the provider's record of a container the engine created, so the retry created a second one, as in darwin CI. Deploy only the web service, give its health path a unique token so only its readiness check counts, and assert that the interrupted apply kept its record before checking that the retry creates nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure
#13093 added
kind: containerservices and said it fixed #12568, but only compile tests, one state test, and the provider'shost_container_healthtests covered them. Nothing applied a container service through the SDK and the real Docker provider, so these #12568 criteria had no coverage: bounded readiness, unchanged reapply, failures and retries, replacement, and cleanup.Decision
Add
container_service, a Rust system test incrates/nemoclaw-e2e/tests/integration/rust. It deploys a managed Docker gateway, one agent, and three container services, one for each readiness mode: HTTPpath,runtimeStatus, and Docker HEALTHCHECK. The tests run through the SDK, the bundle's OpenTofu, and the real Docker provider. The engine is a fake that keeps what the provider creates and reusestest-support/docker_engine.rsfor the gateway's storage. Thetofu testscenarios mock the Docker provider, so they can't show what it creates, replaces, or deletes, or the provider errors thatexpect_failurescan't catch. The module runs on Unix only, like the other managed Docker gateway tests. No VoiceClaw image, real container, or credential is used.apply_waits_for_each_readiness_mode_then_exits_and_reapply_keeps_the_containersunhealthy_or_unknown_readiness_fails_apply_and_retry_keeps_the_created_containers,readiness_that_never_arrives_times_out_within_its_bound_and_retry_completes,interrupted_setup_is_unfinished_and_retry_completes_without_duplicatesa_changed_application_is_replaced_alone_and_keeps_its_volumeenvironmentplans delete-then-create for that container only. The old container is deleted before the new one is created. The new container mounts the same data volume and readiness is checked again. The other containers and the agent don't change.apply_refuses_removal_and_destroy_deletes_owned_applications_keeping_other_resourcesAll six tests passed on their first run against
v1and found no product bug. They stay as regression coverage. The fake engine is not real Docker, so these tests don't establish Docker or VoiceClaw behavior.The #13093 description reports that retained-state recreation failed during gateway observation in a live run. With container services, destroy followed by apply over the retained gateway storage succeeds against these fixtures. That run doesn't reproduce the live failure, so it doesn't rule it out.
An interrupt during the Docker provider's container create is different. The first version of the interruption test could cancel there, and darwin CI failed: the retry created a second web container. Locally, holding the fake engine's create response and cancelling during it reproduced the same result. OpenTofu stops the Docker provider, which abandons the create request. The engine had already created the container, so the provider never recorded it, and the retry created another. Real Docker would refuse the retry's create because the name is in use. The provider owns its create, so this is outside this PR. Cancelling during the readiness wait never duplicated a container in 36 local runs, 16 of them under CPU load. I didn't observe the darwin run's exact cancellation point.
Part of #12568; depends on the declaration from #12567 (#13093). These criteria remain open:
apply cannot remove a managed runtimeand changes nothing.runtime_bindingsincrates/nemoclaw-sdk/src/deployment/runtime.rsrefuses any removeddocker_volumebinding, including the disposablecontainer_storagevolume. So no operation removes an application while keeping the agent. The test pins the current refusal. Maintainers need to decide whether apply should remove a container service whose only storage is disposable. I didn't change the policy.Validation
NEMOCLAW_TEST_BUNDLE=$PWD/dist/linux_arm64 cargo test -p nemoclaw-e2e --test integration container_service:: -- --ignored: 6 passed in 11.5 s.cargo cion Linux ARM64 (baseorigin/v1): fmt, Clippy, build, 1,812 unit tests, schema, bundle, and 102 lifecycle tests passed. The 6container_servicetests took 44.1 s summed, with the slowest at 11.4 s.cargo ci live-dockerdidn't run. The change adds only fixture tests and contributor docs and doesn't change what runs in images.