File tree Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ def load_dynamic_configuration(
154154 from chaoslib .activity import run_activity
155155
156156 secrets = secrets or {}
157-
157+ # output = None
158158 had_errors = False
159159 logger .debug ("Loading dynamic configuration..." )
160160 for (key , value ) in config .items ():
@@ -168,10 +168,10 @@ def load_dynamic_configuration(
168168 value ["provider" ]["secrets" ] = deepcopy (secrets )
169169 try :
170170 output = run_activity (value , config , secrets )
171- except Exception :
171+ except Exception as err :
172172 had_errors = True
173173 logger .debug (f"Failed to load configuration '{ name } '" , exc_info = True )
174- continue
174+ raise err
175175
176176 if provider_type == "python" :
177177 config [key ] = output
Original file line number Diff line number Diff line change @@ -306,22 +306,23 @@ def test_that_environment_variables_are_typed_correctly():
306306
307307
308308def test_dynamic_configuration_exception_means_output_is_missing ():
309- config = load_dynamic_configuration (
310- {
311- "somekey" : "hello world" ,
312- "token" : {
313- "type" : "probe" ,
314- "provider" : {
315- "type" : "python" ,
316- "module" : "fixtures.configprobe" ,
317- "func" : "raise_exception" ,
309+ config = {"somekey" : "hello world" }
310+ with pytest .raises (Exception ):
311+ config = load_dynamic_configuration (
312+ {
313+ "somekey" : "hello world" ,
314+ "token" : {
315+ "type" : "probe" ,
316+ "provider" : {
317+ "type" : "python" ,
318+ "module" : "fixtures.configprobe" ,
319+ "func" : "raise_exception" ,
320+ },
318321 },
319- },
320- }
321- )
322+ }
323+ )
322324
323325 assert config ["somekey" ] == "hello world"
324- assert "token" not in config
325326
326327
327328def test_dynamic_configuration_can_be_used_next_key ():
@@ -350,3 +351,7 @@ def test_dynamic_configuration_can_be_used_next_key():
350351
351352 assert config ["capped" ] == "Hello World From Earth"
352353 assert config ["shorten" ] == "Hello [...]"
354+
355+
356+ if __name__ == "__main__" :
357+ test_dynamic_configuration_exception_means_output_is_missing ()
You can’t perform that action at this time.
0 commit comments