Skip to content

Commit fa1b713

Browse files
author
MarcoFalke
committed
test: Assume node is running in subtests
Every (sub)test in the framework assumes the node is running, except for the (sub)tests in this file. Remove that confusion by stopping the node at the start of every subtest, instead of at the end.
1 parent 828bb77 commit fa1b713

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

test/functional/feature_config_args.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def set_test_params(self):
1919
self.wallet_names = []
2020

2121
def test_config_file_parser(self):
22-
# Assume node is stopped
22+
self.stop_node(0)
2323

2424
inc_conf_file_path = os.path.join(self.nodes[0].datadir, 'include.conf')
2525
with open(os.path.join(self.nodes[0].datadir, 'bitcoin.conf'), 'a', encoding='utf-8') as conf:
@@ -89,11 +89,12 @@ def test_invalid_command_line_options(self):
8989
)
9090

9191
def test_log_buffer(self):
92+
self.stop_node(0)
9293
with self.nodes[0].assert_debug_log(expected_msgs=['Warning: parsed potentially confusing double-negative -connect=0\n']):
9394
self.start_node(0, extra_args=['-noconnect=0'])
94-
self.stop_node(0)
9595

9696
def test_args_log(self):
97+
self.stop_node(0)
9798
self.log.info('Test config args logging')
9899
with self.nodes[0].assert_debug_log(
99100
expected_msgs=[
@@ -120,37 +121,37 @@ def test_args_log(self):
120121
'-rpcuser=secret-rpcuser',
121122
'-torpassword=secret-torpassword',
122123
])
123-
self.stop_node(0)
124124

125125
def test_networkactive(self):
126126
self.log.info('Test -networkactive option')
127+
self.stop_node(0)
127128
with self.nodes[0].assert_debug_log(expected_msgs=['SetNetworkActive: true\n']):
128129
self.start_node(0)
129-
self.stop_node(0)
130130

131+
self.stop_node(0)
131132
with self.nodes[0].assert_debug_log(expected_msgs=['SetNetworkActive: true\n']):
132133
self.start_node(0, extra_args=['-networkactive'])
133-
self.stop_node(0)
134134

135+
self.stop_node(0)
135136
with self.nodes[0].assert_debug_log(expected_msgs=['SetNetworkActive: true\n']):
136137
self.start_node(0, extra_args=['-networkactive=1'])
137-
self.stop_node(0)
138138

139+
self.stop_node(0)
139140
with self.nodes[0].assert_debug_log(expected_msgs=['SetNetworkActive: false\n']):
140141
self.start_node(0, extra_args=['-networkactive=0'])
141-
self.stop_node(0)
142142

143+
self.stop_node(0)
143144
with self.nodes[0].assert_debug_log(expected_msgs=['SetNetworkActive: false\n']):
144145
self.start_node(0, extra_args=['-nonetworkactive'])
145-
self.stop_node(0)
146146

147+
self.stop_node(0)
147148
with self.nodes[0].assert_debug_log(expected_msgs=['SetNetworkActive: false\n']):
148149
self.start_node(0, extra_args=['-nonetworkactive=1'])
149-
self.stop_node(0)
150150

151151
def test_seed_peers(self):
152152
self.log.info('Test seed peers')
153153
default_data_dir = self.nodes[0].datadir
154+
self.stop_node(0)
154155

155156
# No peers.dat exists and -dnsseed=1
156157
# We expect the node will use DNS Seeds, but Regtest mode has 0 DNS seeds
@@ -201,12 +202,9 @@ def test_seed_peers(self):
201202
with self.nodes[0].assert_debug_log(expected_msgs=[
202203
"Adding fixed seeds as 60 seconds have passed and addrman is empty"]):
203204
self.nodes[0].setmocktime(start + 65)
204-
self.stop_node(0)
205205

206206

207207
def run_test(self):
208-
self.stop_node(0)
209-
210208
self.test_log_buffer()
211209
self.test_args_log()
212210
self.test_seed_peers()

0 commit comments

Comments
 (0)