@@ -22,19 +22,19 @@ def run_test(self):
22
22
try :
23
23
self .setup_namespaces ()
24
24
self .setup_service_accounts ()
25
- except Exception as e :
26
- self .log .info (e )
27
25
finally :
28
26
self .cleanup ()
29
27
30
28
def setup_namespaces (self ):
31
29
self .log .info ("Setting up the namespaces" )
32
30
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" )
34
33
35
34
def setup_service_accounts (self ):
35
+ self .log .info ("Creating service accounts..." )
36
36
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 )
38
38
39
39
def get_service_accounts (self ) -> Optional [list [dict [str , str ]]]:
40
40
self .log .info ("Setting up service accounts" )
@@ -54,23 +54,23 @@ def get_service_accounts(self) -> Optional[list[dict[str, str]]]:
54
54
return service_accounts
55
55
56
56
def service_accounts_are_validated (self ) -> bool :
57
+ self .log .info ("Checking service accounts" )
57
58
maybe_service_accounts = self .get_service_accounts ()
58
59
expected = {
59
- "gary" : [],
60
60
"wargames-blue-team" : ["carol" , "default" , "mallory" ],
61
61
"wargames-red-team" : ["alice" , "bob" , "default" ],
62
62
}
63
63
return maybe_service_accounts == expected
64
64
65
65
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" )
67
68
if resp == "No warnet namespaces found." :
68
69
return None
69
-
70
70
namespaces = []
71
- self .log .info (namespaces )
72
71
for line in resp .splitlines ():
73
- namespaces .append (line .lstrip ("- " ))
72
+ if line .startswith ("- " ):
73
+ namespaces .append (line .lstrip ("- " ))
74
74
self .log .info (f"Namespaces: { namespaces } " )
75
75
return namespaces
76
76
0 commit comments