@@ -845,14 +845,15 @@ def test_add_pod_annotations_for_autodown_with_launch():
845
845
# Autodown is set.
846
846
f'sky launch -y -c { name } -i 10 --down --num-nodes 2 --cpus=1 --cloud kubernetes' ,
847
847
# Get names of the pods containing cluster name.
848
- f'pod_1=$(kubectl get pods -o name | grep { name } | sed -n 1p)' ,
849
- f'pod_2=$(kubectl get pods -o name | grep { name } | sed -n 2p)' ,
848
+ f'pod_1=$(kubectl get pods -o name | grep { name } | sed -n 1p) && '
850
849
# Describe the first pod and check for annotations.
851
- 'kubectl describe pod $pod_1 | grep -q skypilot.co/autodown' ,
852
- 'kubectl describe pod $pod_1 | grep -q skypilot.co/idle_minutes_to_autostop' ,
850
+ 'pod_tag=$(kubectl describe $pod_1); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/autodown && '
851
+ 'pod_tag=$(kubectl describe $pod_1); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/idle_minutes_to_autostop' ,
852
+ # Get names of the pods containing cluster name.
853
+ f'pod_2=$(kubectl get pods -o name | grep { name } | sed -n 2p) && '
853
854
# Describe the second pod and check for annotations.
854
- 'kubectl describe pod $pod_2 | grep -q skypilot.co/autodown' ,
855
- 'kubectl describe pod $pod_2 | grep -q skypilot.co/idle_minutes_to_autostop'
855
+ 'pod_tag=$( kubectl describe $pod_2); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/autodown && '
856
+ 'pod_tag=$( kubectl describe $pod_2); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/idle_minutes_to_autostop'
856
857
],
857
858
f'sky down -y { name } ' ,
858
859
)
@@ -870,22 +871,24 @@ def test_add_and_remove_pod_annotations_with_autostop():
870
871
# Set autodown on the cluster with 'autostop' command.
871
872
f'sky autostop -y { name } -i 20 --down' ,
872
873
# Get names of the pods containing cluster name.
873
- f'pod_1=$(kubectl get pods -o name | grep { name } | sed -n 1p)' ,
874
- f'pod_2=$(kubectl get pods -o name | grep { name } | sed -n 2p)' ,
874
+ f'pod_1=$(kubectl get pods -o name | grep { name } | sed -n 1p) && '
875
875
# Describe the first pod and check for annotations.
876
- 'kubectl describe pod $pod_1 | grep -q skypilot.co/autodown' ,
877
- 'kubectl describe pod $pod_1 | grep -q skypilot.co/idle_minutes_to_autostop' ,
876
+ 'pod_tag=$( kubectl describe $pod_1); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/autodown && '
877
+ 'pod_tag=$( kubectl describe $pod_1); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/idle_minutes_to_autostop' ,
878
878
# Describe the second pod and check for annotations.
879
- 'kubectl describe pod $pod_2 | grep -q skypilot.co/autodown' ,
880
- 'kubectl describe pod $pod_2 | grep -q skypilot.co/idle_minutes_to_autostop' ,
879
+ f'pod_2=$(kubectl get pods -o name | grep { name } | sed -n 2p) && '
880
+ 'pod_tag=$(kubectl describe $pod_2); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/autodown && '
881
+ 'pod_tag=$(kubectl describe $pod_2); echo "$pod_tag"; echo "$pod_tag" | grep -q skypilot.co/idle_minutes_to_autostop' ,
881
882
# Cancel the set autodown to remove the annotations from the pods.
882
883
f'sky autostop -y { name } --cancel' ,
883
884
# Describe the first pod and check if annotations are removed.
884
- '! kubectl describe pod $pod_1 | grep -q skypilot.co/autodown' ,
885
- '! kubectl describe pod $pod_1 | grep -q skypilot.co/idle_minutes_to_autostop' ,
885
+ f'pod_1=$(kubectl get pods -o name | grep { name } | sed -n 1p) && '
886
+ 'pod_tag=$(kubectl describe $pod_1); echo "$pod_tag"; ! echo "$pod_tag" | grep -q skypilot.co/autodown && '
887
+ 'pod_tag=$(kubectl describe $pod_1); echo "$pod_tag"; ! echo "$pod_tag" | grep -q skypilot.co/idle_minutes_to_autostop' ,
886
888
# Describe the second pod and check if annotations are removed.
887
- '! kubectl describe pod $pod_2 | grep -q skypilot.co/autodown' ,
888
- '! kubectl describe pod $pod_2 | grep -q skypilot.co/idle_minutes_to_autostop' ,
889
+ f'pod_2=$(kubectl get pods -o name | grep { name } | sed -n 2p) && '
890
+ 'pod_tag=$(kubectl describe $pod_2); echo "$pod_tag"; ! echo "$pod_tag" | grep -q skypilot.co/autodown && '
891
+ 'pod_tag=$(kubectl describe $pod_2); echo "$pod_tag"; ! echo "$pod_tag" | grep -q skypilot.co/idle_minutes_to_autostop' ,
889
892
],
890
893
f'sky down -y { name } ' ,
891
894
)
0 commit comments