Skip to content

Commit e40ea68

Browse files
committed
testing: finish replacing minikube logic
1 parent 1feed7a commit e40ea68

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

test/namespace_admin_test.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@ def run_test(self):
2929
os.chdir(self.tmpdir)
3030
self.log.info(f"Running test in: {self.tmpdir}")
3131
self.setup_namespaces()
32-
self.current_context = get_kubeconfig_value("{.current-context}")
32+
self.initial_context = get_kubeconfig_value("{.current-context}")
3333
self.setup_service_accounts()
3434
self.deploy_network_in_team_namespaces()
3535
self.authenticate_and_become_bob()
36-
self.become_minikube_once_again()
36+
self.return_to_intial_context()
3737
finally:
3838
self.cleanup()
3939

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}"
4342
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))
4544

4645
def this_is_the_current_context(self, context: str) -> Callable[[], bool]:
4746
cmd = "kubectl config current-context"
@@ -69,7 +68,7 @@ def deploy_network_in_team_namespaces(self):
6968

7069
def authenticate_and_become_bob(self):
7170
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
7372
self.log.info(self.warnet("auth kubeconfigs/bob-wargames-red-team-kubeconfig"))
7473
assert get_kubeconfig_value("{.current-context}") == "bob-wargames-red-team"
7574

0 commit comments

Comments
 (0)