From 633feba3ea963b4794d366fc6ad85983e459530b Mon Sep 17 00:00:00 2001 From: pranav Date: Tue, 28 Apr 2026 11:48:41 +0000 Subject: [PATCH] fix Python 3.8 type hint in dns_probe + tear down cluster after deploy 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) --- stack_orchestrator/deploy/dns_probe.py | 4 ++-- tests/k8s-deploy/run-deploy-test.sh | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/stack_orchestrator/deploy/dns_probe.py b/stack_orchestrator/deploy/dns_probe.py index e04b4ea2..6363a72e 100644 --- a/stack_orchestrator/deploy/dns_probe.py +++ b/stack_orchestrator/deploy/dns_probe.py @@ -6,7 +6,7 @@ import secrets import socket import time -from typing import Optional +from typing import List, Optional import requests from kubernetes import client @@ -18,7 +18,7 @@ def get_server_egress_ip() -> str: return response.text.strip() -def resolve_hostname(hostname: str) -> list[str]: +def resolve_hostname(hostname: str) -> List[str]: """Resolve hostname to list of IP addresses.""" try: _, _, ips = socket.gethostbyname_ex(hostname) diff --git a/tests/k8s-deploy/run-deploy-test.sh b/tests/k8s-deploy/run-deploy-test.sh index 08a89c6a..7feb8038 100755 --- a/tests/k8s-deploy/run-deploy-test.sh +++ b/tests/k8s-deploy/run-deploy-test.sh @@ -413,14 +413,16 @@ if [ "$restored_value" != "$fake_cert_value" ]; then fi echo "caddy cert restore test: passed" -# Final teardown: --delete-namespace nukes the namespace after labeled cleanup. -# Verify the namespace is actually gone. +# Final teardown: --delete-namespace nukes the namespace, and +# --perform-cluster-management tears down the Kind cluster so the next test +# step in this CI workflow (e.g. run-restart-test.sh) starts from a clean +# host. $TEST_TARGET_SO deployment --dir $test_deployment_dir \ - stop --delete-volumes --delete-namespace --skip-cluster-management -if kubectl get namespace ${deployment_ns} >/dev/null 2>&1; then - echo "delete-namespace test: FAILED (namespace still present)" + stop --delete-volumes --delete-namespace --perform-cluster-management +if kind get clusters 2>/dev/null | grep -q .; then + echo "cluster teardown test: FAILED (kind cluster still present)" exit 1 fi -echo "delete-namespace test: passed" +echo "cluster teardown test: passed" echo "Test passed"