Skip to content

Commit 0f408ec

Browse files
committed
add rudimentary hooks test
1 parent 6568aa9 commit 0f408ec

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test/hooks_test.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
from pathlib import Path
5+
6+
import pexpect
7+
from test_base import TestBase
8+
9+
10+
class HooksTest(TestBase):
11+
def __init__(self):
12+
super().__init__()
13+
self.network_dir = Path(os.path.dirname(__file__)) / "data" / "12_node_ring"
14+
15+
def run_test(self):
16+
try:
17+
os.chdir(self.tmpdir)
18+
self.setup_network()
19+
self.generate_plugin_dir()
20+
21+
finally:
22+
self.cleanup()
23+
24+
def setup_network(self):
25+
self.log.info("Setting up network")
26+
self.log.info(self.warnet(f"deploy {self.network_dir}"))
27+
self.wait_for_all_tanks_status(target="running")
28+
self.wait_for_all_edges()
29+
30+
def generate_plugin_dir(self):
31+
self.log.info("Generating the plugin directroy")
32+
self.sut = pexpect.spawn("warnet init")
33+
self.sut.expect("Do you want to create a custom network?", timeout=10)
34+
self.sut.sendline("n")
35+
plugin_dir = Path(os.getcwd()) / "plugins"
36+
assert plugin_dir.exists()
37+
38+
39+
if __name__ == "__main__":
40+
test = HooksTest()
41+
test.run_test()

0 commit comments

Comments
 (0)