Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 6556f74

Browse files
committed
Update test_framework.py to support version compatibility tests
1 parent bf6c291 commit 6556f74

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

qa/test_framework/test_framework.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self):
4545
def setup_nodes(self):
4646
for i in range(self.num_nodes):
4747
self.configure_node(i)
48-
self.start_node(self.nodes[i])
48+
self.start_node(i, self.nodes[i])
4949

5050
def setup_network(self):
5151
if self.bitcoind is not None and self.cointype == "BTC":
@@ -64,7 +64,11 @@ def send_bitcoin_cmd(self, *args):
6464

6565
def configure_node(self, n):
6666
dir_path = os.path.join(self.temp_dir, "openbazaar-go", str(n))
67-
args = [self.binary, "init", "-d", dir_path, "--testnet"]
67+
args = []
68+
if self.binaries is not None:
69+
args = [self.binaries[n], "init", "-d", dir_path, "--testnet"]
70+
else:
71+
args = [self.binary, "init", "-d", dir_path, "--testnet"]
6872
if n < 3:
6973
args.extend(["-m", BOOTSTAP_MNEMONICS[n]])
7074
process = subprocess.Popen(args, stdout=PIPE)
@@ -111,8 +115,12 @@ def wait_for_init_success(process):
111115
if "OpenBazaar repo initialized" in str(o):
112116
return
113117

114-
def start_node(self, node):
115-
args = [self.binary, "start", "-v", "-d", node["data_dir"], *self.options]
118+
def start_node(self, n, node):
119+
args = []
120+
if self.binaries is not None:
121+
args = [self.binaries[n], "start", "-v", "-d", node["data_dir"], *self.options]
122+
else:
123+
args = [self.binary, "start", "-v", "-d", node["data_dir"], *self.options]
116124
process = subprocess.Popen(args, stdout=PIPE)
117125
peerId = self.wait_for_start_success(process, node)
118126
node["peerId"] = peerId
@@ -185,12 +193,16 @@ def main(self, options=["--disablewallet", "--testnet", "--disableexchangerates"
185193
description="OpenBazaar Test Framework",
186194
usage="python3 test_framework.py [options]"
187195
)
188-
parser.add_argument('-b', '--binary', required=True, help="the openbazaar-go binary")
196+
parser.add_argument('-b', '--binary', help="the openbazaar-go binary")
197+
parser.add_argument('-i', '--binaries', nargs='*', help="a list of binaries to use. Indexes map to the index of each node in the test.")
198+
parser.add_argument('-v', '--versions', nargs='*', help="a list of versions mapped to the node index")
189199
parser.add_argument('-d', '--bitcoind', help="the bitcoind binary")
190200
parser.add_argument('-t', '--tempdir', action='store_true', help="temp directory to store the data folders", default="/tmp/")
191201
parser.add_argument('-c', '--cointype', help="cointype to test", default="BTC")
192202
args = parser.parse_args(sys.argv[1:])
193203
self.binary = args.binary
204+
self.binaries = args.binaries
205+
self.versions = args.versions
194206
self.temp_dir = args.tempdir
195207
self.bitcoind = args.bitcoind
196208
self.cointype = args.cointype

0 commit comments

Comments
 (0)