@@ -45,7 +45,7 @@ def __init__(self):
45
45
def setup_nodes (self ):
46
46
for i in range (self .num_nodes ):
47
47
self .configure_node (i )
48
- self .start_node (self .nodes [i ])
48
+ self .start_node (i , self .nodes [i ])
49
49
50
50
def setup_network (self ):
51
51
if self .bitcoind is not None and self .cointype == "BTC" :
@@ -64,7 +64,11 @@ def send_bitcoin_cmd(self, *args):
64
64
65
65
def configure_node (self , n ):
66
66
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" ]
68
72
if n < 3 :
69
73
args .extend (["-m" , BOOTSTAP_MNEMONICS [n ]])
70
74
process = subprocess .Popen (args , stdout = PIPE )
@@ -111,8 +115,12 @@ def wait_for_init_success(process):
111
115
if "OpenBazaar repo initialized" in str (o ):
112
116
return
113
117
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 ]
116
124
process = subprocess .Popen (args , stdout = PIPE )
117
125
peerId = self .wait_for_start_success (process , node )
118
126
node ["peerId" ] = peerId
@@ -185,12 +193,16 @@ def main(self, options=["--disablewallet", "--testnet", "--disableexchangerates"
185
193
description = "OpenBazaar Test Framework" ,
186
194
usage = "python3 test_framework.py [options]"
187
195
)
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" )
189
199
parser .add_argument ('-d' , '--bitcoind' , help = "the bitcoind binary" )
190
200
parser .add_argument ('-t' , '--tempdir' , action = 'store_true' , help = "temp directory to store the data folders" , default = "/tmp/" )
191
201
parser .add_argument ('-c' , '--cointype' , help = "cointype to test" , default = "BTC" )
192
202
args = parser .parse_args (sys .argv [1 :])
193
203
self .binary = args .binary
204
+ self .binaries = args .binaries
205
+ self .versions = args .versions
194
206
self .temp_dir = args .tempdir
195
207
self .bitcoind = args .bitcoind
196
208
self .cointype = args .cointype
0 commit comments