@@ -43,7 +43,7 @@ def __init__(
4343 check_name = "sonobuoy_handler" ,
4444 kubeconfig = None ,
4545 result_dir_name = "sonobuoy_results" ,
46- sonobuoy_config = "kaas/sonobuoy-config.yaml" ,
46+ scs_sonobuoy_config_yaml = "kaas/sonobuoy-config.yaml" ,
4747 args = (),
4848 ):
4949 self .check_name = check_name
@@ -57,9 +57,9 @@ def __init__(
5757 logger .debug (f"working from { self .working_directory } " )
5858 logger .debug (f"placing results at { self .result_dir_name } " )
5959 logger .debug (f"sonobuoy executable at { self .sonobuoy } " )
60- if not os .path .exists (sonobuoy_config ):
61- raise RuntimeError (f"sonobuoy_config { sonobuoy_config } does not exist." )
62- self .sonobuoy_config = sonobuoy_config
60+ if not os .path .exists (scs_sonobuoy_config_yaml ):
61+ raise RuntimeError (f"scs_sonobuoy_config_yaml { scs_sonobuoy_config_yaml } does not exist." )
62+ self .scs_sonobuoy_config_yaml = scs_sonobuoy_config_yaml
6363 self .args = (arg0 for arg in args for arg0 in shlex .split (str (arg )))
6464
6565 def _invoke_sonobuoy (self , * args , ** kwargs ):
@@ -104,7 +104,7 @@ def _sonobuoy_retrieve_result(self, plugin='e2e'):
104104 yaml_path = os .path .join (result_dir , 'plugins' , plugin , 'sonobuoy_results.yaml' )
105105 logger .debug (f"parsing results from { yaml_path } " )
106106
107- return sonobuoy_parse_result (plugin , yaml_path , self .sonobuoy_config )
107+ return sonobuoy_parse_result (plugin , yaml_path , self .scs_sonobuoy_config_yaml )
108108
109109 def run (self ):
110110 """
@@ -125,8 +125,8 @@ def run(self):
125125 self ._sonobuoy_delete ()
126126
127127
128- def sonobuoy_parse_result (plugin , sonobuoy_results_yaml_path , sonobuoy_config ):
129- ok_to_fail_regex_list = _load_ok_to_fail_regex_list (sonobuoy_config )
128+ def sonobuoy_parse_result (plugin , sonobuoy_results_yaml_path , scs_sonobuoy_config_yaml ):
129+ ok_to_fail_regex_list = _load_ok_to_fail_regex_list (scs_sonobuoy_config_yaml )
130130 with open (sonobuoy_results_yaml_path , "r" ) as fileobj :
131131 result_obj = yaml .load (fileobj .read (), yaml .SafeLoader )
132132
@@ -149,42 +149,42 @@ def sonobuoy_parse_result(plugin, sonobuoy_results_yaml_path, sonobuoy_config):
149149 return counter
150150
151151
152- def _load_ok_to_fail_regex_list (sonobuoy_config ):
153- with open (sonobuoy_config , "r" ) as fileobj :
152+ def _load_ok_to_fail_regex_list (scs_sonobuoy_config_yaml ):
153+ with open (scs_sonobuoy_config_yaml , "r" ) as fileobj :
154154 config_obj = yaml .load (fileobj .read (), yaml .SafeLoader ) or {}
155155 if not isinstance (config_obj , dict ):
156- raise ValueError (f"Invalid sonobuoy config format in { sonobuoy_config } : top-level YAML object must be a mapping" )
156+ raise ValueError (f"Invalid sonobuoy config format in { scs_sonobuoy_config_yaml } : top-level YAML object must be a mapping" )
157157 allowed_top_level_keys = {"okToFail" }
158158 unknown_top_level_keys = set (config_obj ) - allowed_top_level_keys
159159 if unknown_top_level_keys :
160160 raise ValueError (
161- f"Invalid sonobuoy config format in { sonobuoy_config } : unknown top-level keys: { sorted (unknown_top_level_keys )} "
161+ f"Invalid sonobuoy config format in { scs_sonobuoy_config_yaml } : unknown top-level keys: { sorted (unknown_top_level_keys )} "
162162 )
163163 ok_to_fail_items = config_obj .get ("okToFail" , ())
164164 if not isinstance (ok_to_fail_items , list ):
165- raise ValueError (f"Invalid sonobuoy config format in { sonobuoy_config } : okToFail must be a list" )
165+ raise ValueError (f"Invalid sonobuoy config format in { scs_sonobuoy_config_yaml } : okToFail must be a list" )
166166
167167 ok_to_fail_regex_list = []
168168 for idx , entry in enumerate (ok_to_fail_items ):
169169 if not isinstance (entry , dict ):
170170 raise ValueError (
171- f"Invalid sonobuoy config format in { sonobuoy_config } : okToFail[{ idx } ] must be a mapping"
171+ f"Invalid sonobuoy config format in { scs_sonobuoy_config_yaml } : okToFail[{ idx } ] must be a mapping"
172172 )
173173 allowed_entry_keys = {"regex" , "reason" }
174174 unknown_entry_keys = set (entry ) - allowed_entry_keys
175175 if unknown_entry_keys :
176176 raise ValueError (
177- f"Invalid sonobuoy config format in { sonobuoy_config } : okToFail[{ idx } ] has unknown keys: { sorted (unknown_entry_keys )} "
177+ f"Invalid sonobuoy config format in { scs_sonobuoy_config_yaml } : okToFail[{ idx } ] has unknown keys: { sorted (unknown_entry_keys )} "
178178 )
179179 regex = entry .get ("regex" )
180180 if not isinstance (regex , str ) or not regex .strip ():
181181 raise ValueError (
182- f"Invalid sonobuoy config format in { sonobuoy_config } : okToFail[{ idx } ].regex must be a non-empty string"
182+ f"Invalid sonobuoy config format in { scs_sonobuoy_config_yaml } : okToFail[{ idx } ].regex must be a non-empty string"
183183 )
184184 reason = entry .get ("reason" )
185185 if not isinstance (reason , str ) or not reason .strip ():
186186 raise ValueError (
187- f"Invalid sonobuoy config format in { sonobuoy_config } : okToFail[{ idx } ].reason must be a non-empty string"
187+ f"Invalid sonobuoy config format in { scs_sonobuoy_config_yaml } : okToFail[{ idx } ].reason must be a non-empty string"
188188 )
189189 ok_to_fail_regex_list .append ((regex , reason ))
190190 return ok_to_fail_regex_list
@@ -198,7 +198,7 @@ def ok_to_fail(ok_to_fail_regex_list, test_name):
198198 return False
199199
200200
201- def check_sonobuoy_result (sonobuoy_config , result_yaml ):
202- counter = sonobuoy_parse_result ("" , result_yaml , sonobuoy_config )
201+ def check_sonobuoy_result (scs_sonobuoy_config_yaml , result_yaml ):
202+ counter = sonobuoy_parse_result ("" , result_yaml , scs_sonobuoy_config_yaml )
203203 for key , value in counter .items ():
204204 print (f"{ key } : { value } " )
0 commit comments