mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-09-08 09:47:17 +00:00
* test: add node_scenarios pytest migration under tests_v2 Migrate the node chaos coverage from the legacy CI/tests/test_node.sh into the v2 pytest framework at CI/tests_v2/scenarios/node_scenarios/. - test_node_scenarios.py (TestNodeScenarios extends BaseScenarioTest): reboot and stop/start happy paths, node_name vs label_selector targeting, node recovery with finalizer, a control-plane safety guard, and negative cases (invalid selector, invalid node, missing actions, unsupported cloud type, unknown action). - scenario_base.yaml: single node_scenarios entry (cloud_type docker, worker-only) patched per test. - Register the node_scenarios marker in pytest.ini and document the scenario in CI/tests_v2/README.md. Part of #1398. The coupled legacy move + workflow edit is left for a maintainer (the bot lacks GitHub App workflows permission); see PR description. * test: address node_scenarios review feedback - Reboot happy path now runs with kube_check: True so Krkn waits for the node to go Unknown then Ready, eliminating the race where wait_node_ready could pass against a stale Ready=True before the disruption propagated. - Finalizer ensure_node_container_running now polls for Ready (bounded) when given k8s_core and logs non-zero 'start' exits, matching the docstring contract so a rerun never picks up an unrecovered node. - Clarify the parallelism note: first/last worker separation only applies on multi-worker clusters (CI's 2-worker kind-config.yml); single-worker dev clusters share the node and rely on test ordering. * fix: make node happy-path tests resilient to KinD multi-CP API LB The reboot/stop_start happy paths failed in the Tests v2 job with "Response ended prematurely": with kube_check enabled, Krkn's docker node plugin polls the kube API (wait_for_unknown_status/wait_for_ready_status) for ~40-50s after the disruption, and krkn-lib does not retry a transient connection drop from the multi-control-plane KinD haproxy API load balancer. The docker action itself succeeded in <0.5s. Run both happy paths with kube_check: False so Krkn performs the action and exits cleanly, and prove real disruption deterministically via the node container's State.StartedAt advancing (runtime-level evidence, independent of node-status timing). Recovery is still verified with the resilient test-side wait_node_ready poll. README updated to match. * refactor: move reusable node/container test helpers to lib/utils Per review feedback, relocate the generic node-level helpers out of the node_scenarios test module into the shared CI/tests_v2/lib/utils.py so future node/container tests can reuse them: wait_node_ready, container_runtime, container_started_at, assert_container_cycled, ensure_node_container_running, and assert_kraken_marker. The test module now imports them; behavior is unchanged and all 8 tests still collect. * docs: fix duplicated word in tests_v2 README scenario list * test: skip redundant container start in node finalizer to avoid noisy warnings * test: honor KIND_EXPERIMENTAL_PROVIDER when selecting container runtime * docs: align node finalizer wording with start-if-stopped behavior * docs: align node test module docstring with start-if-stopped finalizer * test: sort schedulable worker nodes for deterministic targeting * test: assert combined node_stop_start_scenario marker in stop/start happy path --------- Co-authored-by: augmentcode[bot] <185243770+augmentcode[bot]@users.noreply.github.com>