|
7 | 7 |
|
8 | 8 | from test_base import TestBase
|
9 | 9 |
|
| 10 | +from warnet.control import stop_scenario |
10 | 11 | from warnet.k8s import get_mission
|
| 12 | +from warnet.status import _get_deployed_scenarios as scenarios_deployed |
11 | 13 |
|
12 | 14 |
|
13 | 15 | class ConfTest(TestBase):
|
14 | 16 | def __init__(self):
|
15 | 17 | super().__init__()
|
16 | 18 | self.network_dir = Path(os.path.dirname(__file__)) / "data" / "bitcoin_conf"
|
| 19 | + self.scen_dir = Path(os.path.dirname(__file__)).parent / "resources" / "scenarios" |
17 | 20 |
|
18 | 21 | def run_test(self):
|
19 | 22 | try:
|
20 | 23 | self.setup_network()
|
21 | 24 | self.check_uacomment()
|
| 25 | + self.check_single_miner() |
22 | 26 | finally:
|
23 | 27 | self.cleanup()
|
24 | 28 |
|
@@ -52,6 +56,22 @@ def get_uacomment():
|
52 | 56 |
|
53 | 57 | self.wait_for_predicate(get_uacomment)
|
54 | 58 |
|
| 59 | + def check_single_miner(self): |
| 60 | + scenario_file = self.scen_dir / "miner_std.py" |
| 61 | + self.log.info(f"Running scenario from: {scenario_file}") |
| 62 | + # Mine from a tank that is not first or last and |
| 63 | + # is one of the only few in the network that even |
| 64 | + # has rpc reatewallet method! |
| 65 | + self.warnet(f"run {scenario_file} --tank=tank-0026 --interval=1") |
| 66 | + self.wait_for_predicate( |
| 67 | + lambda: int(self.warnet("bitcoin rpc tank-0026 getblockcount")) >= 10 |
| 68 | + ) |
| 69 | + running = scenarios_deployed() |
| 70 | + assert len(running) == 1, f"Expected one running scenario, got {len(running)}" |
| 71 | + assert running[0]["status"] == "running", "Scenario should be running" |
| 72 | + stop_scenario(running[0]["name"]) |
| 73 | + self.wait_for_all_scenarios() |
| 74 | + |
55 | 75 |
|
56 | 76 | if __name__ == "__main__":
|
57 | 77 | test = ConfTest()
|
|
0 commit comments