@@ -29,19 +29,18 @@ def run_test(self):
29
29
os .chdir (self .tmpdir )
30
30
self .log .info (f"Running test in: { self .tmpdir } " )
31
31
self .setup_namespaces ()
32
- self .current_context = get_kubeconfig_value ("{.current-context}" )
32
+ self .initial_context = get_kubeconfig_value ("{.current-context}" )
33
33
self .setup_service_accounts ()
34
34
self .deploy_network_in_team_namespaces ()
35
35
self .authenticate_and_become_bob ()
36
- self .become_minikube_once_again ()
36
+ self .return_to_intial_context ()
37
37
finally :
38
38
self .cleanup ()
39
39
40
- def become_minikube_once_again (self ):
41
- minikube = "minikube"
42
- cmd = f"kubectl config use-context { minikube } "
40
+ def return_to_intial_context (self ):
41
+ cmd = f"kubectl config use-context { self .initial_context } "
43
42
self .log .info (run_command (cmd ))
44
- self .wait_for_predicate (self .this_is_the_current_context (minikube ))
43
+ self .wait_for_predicate (self .this_is_the_current_context (self . initial_context ))
45
44
46
45
def this_is_the_current_context (self , context : str ) -> Callable [[], bool ]:
47
46
cmd = "kubectl config current-context"
@@ -69,7 +68,7 @@ def deploy_network_in_team_namespaces(self):
69
68
70
69
def authenticate_and_become_bob (self ):
71
70
self .log .info ("Authenticating and becoming bob..." )
72
- assert get_kubeconfig_value ("{.current-context}" ) == self .current_context
71
+ assert get_kubeconfig_value ("{.current-context}" ) == self .initial_context
73
72
self .log .info (self .warnet ("auth kubeconfigs/bob-wargames-red-team-kubeconfig" ))
74
73
assert get_kubeconfig_value ("{.current-context}" ) == "bob-wargames-red-team"
75
74
0 commit comments