Make deployments self-sufficient and add E2E restart test#750
Merged
Conversation
Covers two scenarios on a single Kind cluster: - Single-repo: deploy create copies commands.py into hooks/, deployment start runs it, mutating the stack-source working tree to v2 + deployment restart re-copies and re-executes v2. - Multi-repo: stack with two pod repos produces hooks/commands_0.py + commands_1.py, deployment start invokes both pod start() hooks. The test stages stack files into a temp git clone (bare + working) so restart's git pull has a real upstream. busybox pods keep the harness trivial. Phase 2 uses kubectl wait directly because deployment ps's substring filter (deploy_k8s.py:1366) doesn't list multi-pod stacks. Also tightens the _copy_hooks docstring to spell out that only call_stack_deploy_start loads from the copied location. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rename the stack and script accordingly:
- test-restart-hook stack → test-restart
- test-restart-hook-multi stack → test-restart-multi
- run-restart-hook-test.sh → run-restart-test.sh
- start-hook-marker file → marker
- pod-repo dirs test-restart-hook-pod-{a,b} → test-restart-pod-{a,b}
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…y test dns_probe.py used 'list[str]' (PEP 585 generic alias for builtins), which only parses on Python 3.9+. CI runs Python 3.8, so any caller of 'deployment restart' (which lazy-imports dns_probe) crashed at module load with 'TypeError: type object is not subscriptable'. Use 'List[str]' from typing to keep 3.8 compatibility, matching the rest of the file's imports. run-deploy-test.sh previously ended with --skip-cluster-management, leaving the Kind cluster running for the next CI step to inherit. Switch the final stop to --perform-cluster-management so subsequent tests (e.g. run-restart-test.sh) start from a clean host, and replace the now-trivial namespace assertion with a real check that the kind cluster is actually gone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
deploy createnow copies each pod'scommands.pyinto<deployment>/hooks/.call_stack_deploy_startloads from there, sodeployment start/restartno longer need the live stack source on disk to run thestart()hookstart()hook is affected.init,setup, andcreatestill load from the live source — they only run atdeploy createtime, when the source is guaranteed to be presenthooks/commands_0.py,hooks/commands_1.py, …;call_stack_deploy_startloads them all in sorted ordertests/k8s-deploy/run-restart-test.shcovering the full single-repo restart cycle (v1 -> mutate working tree ->restartre-copies and re-executes v2) and the multi-repo file-naming + multi-hook invocation. Wired into the existing K8s Deploy Test workflow