Skip to content

Commit 6f38932

Browse files
committed
Add return code on scenarios
1 parent 4388a0d commit 6f38932

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/warnet/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ def scenarios_list_running(self) -> list[dict]:
398398
"pid": sc["pid"],
399399
"cmd": sc["cmd"],
400400
"active": sc["proc"].poll() is None,
401+
"return_code": sc["proc"].returncode,
401402
"network": sc["network"],
402403
}
403404
for sc in self.running_scenarios

test/ln_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def run_ln_init_scenario(self):
4343
self.warcli("rpc 0 getblockcount")
4444
self.warcli("scenarios run ln_init")
4545
self.wait_for_all_scenarios()
46+
scenario_return_code = self.get_scenario_return_code("ln_init")
47+
if scenario_return_code != 0:
48+
raise Exception("LN Init scenario failed")
4649

4750
def test_channel_policies(self):
4851
self.log.info("Ensuring node-level channel policy settings")

test/test_base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,10 @@ def check_scenarios():
169169
return all(not scn["active"] for scn in scns)
170170

171171
self.wait_for_predicate(check_scenarios)
172+
173+
def get_scenario_return_code(self, scenario_name):
174+
scns = self.rpc("scenarios_list_running")
175+
scns = [scn for scn in scns if scn["cmd"].strip() == scenario_name]
176+
if len(scns) == 0:
177+
raise Exception(f"Scenario {scenario_name} not found in running scenarios")
178+
return scns[0]["return_code"]

0 commit comments

Comments
 (0)