Skip to content

Commit cf0e1d9

Browse files
committed
test: ensure current-context
1 parent b39b666 commit cf0e1d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/namespace_admin_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44
from pathlib import Path
5-
from typing import Optional
5+
from typing import Callable, Optional
66

77
import pexpect
88
from test_base import TestBase
@@ -30,6 +30,12 @@ def run_test(self):
3030
finally:
3131
self.cleanup()
3232

33+
def this_is_the_current_context(self, context: str) -> Callable[[], bool]:
34+
cmd = "kubectl config current-context"
35+
current_context = run_command(cmd).strip()
36+
self.log.info(f"Current context: {current_context} {context == current_context}")
37+
return lambda: current_context == context
38+
3339
def setup_namespaces(self):
3440
self.log.info("Setting up the namespaces")
3541
self.log.info(self.warnet(f"deploy {self.namespace_dir}"))

0 commit comments

Comments
 (0)