Skip to content

Commit e46e362

Browse files
committed
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
1 parent 2b3ec5b commit e46e362

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

chaoslib/run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ def run_gate_hypothesis(experiment: Experiment, journal: Journal,
469469
"Steady state probe '{p}' is not in the given "
470470
"tolerance so failing this experiment".format(
471471
p=p["activity"]["name"]))
472+
return
472473
event_registry.hypothesis_before_completed(experiment, state, journal)
473474
return state
474475

tests/fixtures/experiments.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,3 +933,39 @@
933933
}
934934
]
935935
}
936+
937+
938+
SimpleExperimentWithFailingHypothesis = {
939+
"version": "1.0.0",
940+
"title": "Hello world!",
941+
"description": "Say hello world.",
942+
"steady-state-hypothesis": {
943+
"title": "World needs politeness",
944+
"probes": [
945+
{
946+
"type": "probe",
947+
"name": "has-world",
948+
"tolerance": 1,
949+
"provider": {
950+
"type": "process",
951+
"path": "echo",
952+
"arguments": "hello"
953+
}
954+
}
955+
]
956+
},
957+
"method": [
958+
{
959+
"type": "action",
960+
"name": "say-hello",
961+
"provider": {
962+
"type": "process",
963+
"path": "echo",
964+
"arguments": "world"
965+
},
966+
"pauses": {
967+
"after": 1
968+
}
969+
}
970+
]
971+
}

tests/test_run.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,15 @@ def test_exceptions_does_not_stop_handler_registry():
238238
"hypothesis_after_completed",
239239
"start_cooldown", "cooldown_completed"
240240
]
241+
242+
243+
def test_do_not_ruin_method_on_failing_before_ssh():
244+
experiment = experiments.SimpleExperimentWithFailingHypothesis.copy()
245+
journal = run_experiment(experiment, strategy=Strategy.DEFAULT)
246+
assert journal is not None
247+
assert journal["steady_states"]["before"] is not None
248+
assert journal["steady_states"]["after"] is None
249+
assert journal["steady_states"]["during"] == []
250+
assert journal["status"] == "failed"
251+
assert journal["deviated"] == False
252+
assert len(journal["run"]) == 0

0 commit comments

Comments
 (0)