Skip to content

Commit 57e8208

Browse files
committed
fixup test
1 parent eaa2754 commit 57e8208

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/namespace_admin_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ def run_test(self):
2222
try:
2323
self.setup_namespaces()
2424
self.setup_service_accounts()
25-
except Exception as e:
26-
self.log.info(e)
2725
finally:
2826
self.cleanup()
2927

3028
def setup_namespaces(self):
3129
self.log.info("Setting up the namespaces")
3230
self.log.info(self.warnet(f"deploy {self.namespace_dir}"))
33-
self.wait_for_predicate(lambda: self.two_namespaces_are_validated)
31+
self.wait_for_predicate(self.two_namespaces_are_validated)
32+
self.log.info("Namespace setup complete")
3433

3534
def setup_service_accounts(self):
35+
self.log.info("Creating service accounts...")
3636
self.log.info(self.warnet("admin create-kubeconfigs"))
37-
self.wait_for_predicate(lambda: self.service_accounts_are_validated)
37+
self.wait_for_predicate(self.service_accounts_are_validated)
3838

3939
def get_service_accounts(self) -> Optional[list[dict[str, str]]]:
4040
self.log.info("Setting up service accounts")
@@ -54,23 +54,23 @@ def get_service_accounts(self) -> Optional[list[dict[str, str]]]:
5454
return service_accounts
5555

5656
def service_accounts_are_validated(self) -> bool:
57+
self.log.info("Checking service accounts")
5758
maybe_service_accounts = self.get_service_accounts()
5859
expected = {
59-
"gary": [],
6060
"wargames-blue-team": ["carol", "default", "mallory"],
6161
"wargames-red-team": ["alice", "bob", "default"],
6262
}
6363
return maybe_service_accounts == expected
6464

6565
def get_namespaces(self) -> Optional[list[str]]:
66-
resp = self.warnet("warnet admin namespaces list")
66+
self.log.info("Querying the namespaces...")
67+
resp = self.warnet("admin namespaces list")
6768
if resp == "No warnet namespaces found.":
6869
return None
69-
7070
namespaces = []
71-
self.log.info(namespaces)
7271
for line in resp.splitlines():
73-
namespaces.append(line.lstrip("- "))
72+
if line.startswith("- "):
73+
namespaces.append(line.lstrip("- "))
7474
self.log.info(f"Namespaces: {namespaces}")
7575
return namespaces
7676

0 commit comments

Comments
 (0)