2
2
import json
3
3
import os
4
4
from pathlib import Path
5
- from subprocess import run
6
5
from time import sleep
7
6
8
7
import pexpect
13
12
14
13
lightning_selector = "mission=lightning"
15
14
15
+ UP = "\033 [A"
16
+ DOWN = "\033 [B"
17
+ ENTER = "\n "
16
18
17
- class LNTest (TestBase ):
19
+
20
+ class SimLNTest (TestBase ):
18
21
def __init__ (self ):
19
22
super ().__init__ ()
20
23
self .network_dir = Path (os .path .dirname (__file__ )) / "data" / "ln"
@@ -40,7 +43,36 @@ def run_plugin(self):
40
43
self .sut .sendline ("n" )
41
44
self .sut .close ()
42
45
43
- self .log .info (run (["warnet" , "plugin" , "run" , "simln" , "run_simln" ]))
46
+ cmd = "warnet plugin run"
47
+ self .log .info (cmd )
48
+ self .sut = pexpect .spawn (cmd )
49
+ self .sut .expect ("simln" , timeout = 10 )
50
+ self .sut .send (ENTER )
51
+ self .sut .expect ("run_simln" , timeout = 10 )
52
+ self .sut .send (DOWN )
53
+ self .sut .send (DOWN )
54
+ self .sut .send (DOWN )
55
+ self .sut .send (DOWN )
56
+ self .sut .send (DOWN )
57
+ self .sut .send (DOWN )
58
+ self .sut .send (DOWN )
59
+ self .sut .send (DOWN ) # run_simln
60
+ self .sut .send (ENTER )
61
+ self .sut .expect ("Sent command" , timeout = 60 * 3 )
62
+ self .sut .close ()
63
+
64
+ cmd = "warnet plugin run simln get_example_activity"
65
+ self .log .info (cmd )
66
+ self .sut = pexpect .spawn (cmd )
67
+ self .sut .expect ("amount_msat" , timeout = 10 )
68
+ self .sut .close ()
69
+
70
+ cmd = 'warnet plugin run simln launch_activity --params "$(warnet plugin run simln get_example_activity)"'
71
+ self .log .info (f"/bin/bash -c '{ cmd } '" )
72
+ self .sut = pexpect .spawn (f"/bin/bash -c '{ cmd } '" )
73
+ self .sut .expect ("install simln" , timeout = 10 )
74
+ self .sut .close ()
75
+
44
76
sleep (10 )
45
77
46
78
def copy_results (self ) -> bool :
@@ -83,5 +115,5 @@ def wait_for_gossip_sync(self, expected: int):
83
115
84
116
85
117
if __name__ == "__main__" :
86
- test = LNTest ()
118
+ test = SimLNTest ()
87
119
test .run_test ()
0 commit comments