File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -37,21 +37,23 @@ def setup_and_tear_down() -> None:
3737 # run the tests here
3838 yield
3939
40- # delete the cluster
41- client = gke .ClusterManagerClient ()
42- cluster_location = client .common_location_path (PROJECT_ID , ZONE )
43- cluster_name = f"{ cluster_location } /clusters/{ CLUSTER_NAME } "
44- op = client .delete_cluster ({"name" : cluster_name })
45- op_id = f"{ cluster_location } /operations/{ op .name } "
46-
47- # schedule a retry to ensure the cluster is deleted
48- @backoff .on_predicate (
49- backoff .expo , lambda x : x != gke .Operation .Status .DONE , max_tries = 20
50- )
51- def wait_for_delete () -> gke .Operation .Status :
52- return client .get_operation ({"name" : op_id }).status
53-
54- wait_for_delete ()
40+ try :
41+ # delete the cluster
42+ client = gke .ClusterManagerClient ()
43+ cluster_location = client .common_location_path (PROJECT_ID , ZONE )
44+ cluster_name = f"{ cluster_location } /clusters/{ CLUSTER_NAME } "
45+ op = client .delete_cluster ({"name" : cluster_name })
46+ op_id = f"{ cluster_location } /operations/{ op .name } "
47+
48+ finally :
49+ # schedule a retry to ensure the cluster is deleted
50+ @backoff .on_predicate (
51+ backoff .expo , lambda x : x != gke .Operation .Status .DONE , max_tries = 20
52+ )
53+ def wait_for_delete () -> gke .Operation .Status :
54+ return client .get_operation ({"name" : op_id }).status
55+
56+ wait_for_delete ()
5557
5658
5759def test_create_clusters (capsys : object ) -> None :
You can’t perform that action at this time.
0 commit comments