Skip to content

Commit c1f5ae6

Browse files
committed
test: become bob; become minikube
1 parent cf0e1d9 commit c1f5ae6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/namespace_admin_test.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from test_base import TestBase
99

1010
from warnet.k8s import get_kubeconfig_value
11+
from warnet.process import run_command
1112

1213

1314
class NamespaceAdminTest(TestBase):
@@ -26,10 +27,17 @@ def run_test(self):
2627
self.setup_namespaces()
2728
self.setup_service_accounts()
2829
self.deploy_network_in_team_namespaces()
29-
self.authenticate_bob()
30+
self.authenticate_and_become_bob()
31+
self.become_minikube_once_again()
3032
finally:
3133
self.cleanup()
3234

35+
def become_minikube_once_again(self):
36+
minikube = "minikube"
37+
cmd = f"kubectl config use-context {minikube}"
38+
self.log.info(run_command(cmd))
39+
self.wait_for_predicate(self.this_is_the_current_context(minikube))
40+
3341
def this_is_the_current_context(self, context: str) -> Callable[[], bool]:
3442
cmd = "kubectl config current-context"
3543
current_context = run_command(cmd).strip()
@@ -80,10 +88,11 @@ def deploy_network_in_team_namespaces(self):
8088
self.log.info(f"Deploying network into: {namespace}")
8189
self.log.info(self.warnet(f"deploy networks/{network_name}/ --namespace {namespace}"))
8290
self.wait_for_all_tanks_status()
91+
self.log.info("Waiting for all edges")
8392
self.wait_for_all_edges()
8493

85-
def authenticate_bob(self):
86-
self.log.info("Authenticating bob...")
94+
def authenticate_and_become_bob(self):
95+
self.log.info("Authenticating and becoming bob...")
8796
assert get_kubeconfig_value("{.current-context}") == "minikube"
8897
self.log.info(self.warnet("auth kubeconfigs/bob-wargames-red-team-kubeconfig"))
8998
assert get_kubeconfig_value("{.current-context}") == "bob-wargames-red-team"

0 commit comments

Comments
 (0)