diff --git a/tests/test_smoke.py b/tests/test_smoke.py index c3dd56d850eb..2f65458a0cc2 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -2054,9 +2054,9 @@ def test_container_logs_multinode_kubernetes(): 'container_logs_multinode_kubernetes', [ f'sky launch -y -c {name} {task_yaml} --num-nodes 2', - 'kubectl get pods -o jsonpath="{.items[*].metadata.name}" | tr " " "\n" | grep worker' + f'kubectl get pods -l skypilot-cluster-name={name} " -o jsonpath="{.items[*].metadata.name}" | tr " " "\n" | grep worker' '| xargs -I {} kubectl logs {} | wc -l | grep 9', - 'kubectl get pods -o jsonpath="{.items[*].metadata.name}" | tr " " "\n" | grep head' + f'kubectl get pods -l skypilot-cluster-name={name} -o jsonpath="{.items[*].metadata.name}" | tr " " "\n" | grep head' '| xargs -I {} kubectl logs {} | wc -l | grep 9', ], f'sky down -y {name}', @@ -2069,7 +2069,8 @@ def test_container_logs_two_jobs_kubernetes(): name = _get_cluster_name() task_yaml = 'tests/test_yamls/test_k8s_logs.yaml' pod_logs = ( - 'kubectl get pods -o jsonpath="{.items[*].metadata.name}"| grep head | xargs -I {} kubectl logs {}' + f'kubectl get pods -l skypilot-cluster-name={name}' + '-o jsonpath="{.items[*].metadata.name}"| grep head | xargs -I {} kubectl logs {}' ) with tempfile.NamedTemporaryFile(suffix='.yaml', mode='w') as f: test = Test( @@ -2099,7 +2100,8 @@ def test_container_logs_two_simultaneous_jobs_kubernetes(): name = _get_cluster_name() task_yaml = 'tests/test_yamls/test_k8s_logs.yaml' pod_logs = ( - 'kubectl get pods -o jsonpath="{.items[*].metadata.name}"| grep head | xargs -I {} kubectl logs {}' + f'kubectl get pods -l skypilot-cluster-name={name}' + '-o jsonpath="{.items[*].metadata.name}"| grep head | xargs -I {} kubectl logs {}' ) with tempfile.NamedTemporaryFile(suffix='.yaml', mode='w') as f: test = Test(