@@ -86,9 +86,13 @@ def _double_writeln(fileo, message):
8686#
8787# run a single test, possibly in parallel
8888#
89- def run_test (region , distro , scheduler , instance_type , key_name , key_path ):
89+ def run_test (region , distro , scheduler , instance_type , key_name , extra_args ):
9090 testname = '%s-%s-%s-%s-%s' % (region , distro , scheduler , instance_type .replace ('.' , '' ), _timestamp )
9191 test_filename = "%s-config.cfg" % testname
92+ key_path = extra_args ['key_path' ]
93+ custom_cookbook = extra_args ['custom_cookbook_url' ]
94+ custom_node = extra_args ['custom_node_url' ]
95+ custom_template = extra_args ['custom_template_url' ]
9296
9397 print ("--> %s: Starting" % (testname ))
9498
@@ -105,6 +109,12 @@ def run_test(region, distro, scheduler, instance_type, key_name, key_path):
105109 file .write ("maintain_initial_size = true\n " )
106110 file .write ("scheduler = %s\n " % (scheduler ))
107111 file .write ("scaling_settings = custom\n " )
112+ if custom_template :
113+ file .write ("template_url = %s\n " % custom_template )
114+ if custom_cookbook :
115+ file .write ("custom_chef_cookbook = %s\n " % custom_cookbook )
116+ if custom_node :
117+ file .write ('extra_json = { "cfncluster" : { "custom_node_package" : "%s" } }\n ' % custom_node )
108118 file .write ("[vpc public]\n " )
109119 file .write ("master_subnet_id = %s\n " % (setup [region ]['subnet' ]))
110120 file .write ("vpc_id = %s\n " % (setup [region ]['vpc' ]))
@@ -212,7 +222,7 @@ def run_test(region, distro, scheduler, instance_type, key_name, key_path):
212222# worker thread, there will be config['parallelism'] of these running
213223# per region, dispatching work from the work queue
214224#
215- def test_runner (region , q , key_name , key_path ):
225+ def test_runner (region , q , key_name , extra_args ):
216226 global success
217227 global failure
218228 global results_lock
@@ -225,7 +235,7 @@ def test_runner(region, q, key_name, key_path):
225235 try :
226236 if not prochelp .termination_caught ():
227237 run_test (region = region , distro = item ['distro' ], scheduler = item ['scheduler' ],
228- instance_type = item ['instance_type' ], key_name = key_name , key_path = key_path )
238+ instance_type = item ['instance_type' ], key_name = key_name , extra_args = extra_args )
229239 retval = 0
230240 except (ReleaseCheckException , prochelp .ProcessHelperError , sub .CalledProcessError ):
231241 pass
@@ -315,7 +325,10 @@ def _main_child():
315325 'distros' : 'alinux,centos6,centos7,ubuntu1404,ubuntu1604' ,
316326 'schedulers' : 'sge,slurm,torque' ,
317327 'instance_types' : 'c4.xlarge' ,
318- 'key_path' : '' }
328+ 'key_path' : '' ,
329+ 'custom_node_url' : None ,
330+ 'custom_cookbook_url' : None ,
331+ 'custom_template_url' : None }
319332
320333 parser = argparse .ArgumentParser (description = 'Test runner for CfnCluster' )
321334 parser .add_argument ('--parallelism' , help = 'Number of tests per region to run in parallel' ,
@@ -332,6 +345,12 @@ def _main_child():
332345 type = str , required = True )
333346 parser .add_argument ('--key-path' , help = 'Key path to use for SSH connections' ,
334347 type = str )
348+ parser .add_argument ('--custom-node-url' , help = 'S3 URL to a custom cfncluster-node package' ,
349+ type = str )
350+ parser .add_argument ('--custom-cookbook-url' , help = 'S3 URL to a custom cfncluster-cookbook package' ,
351+ type = str )
352+ parser .add_argument ('--custom-template-url' , help = 'S3 URL to a custom cfncluster CloudFormation template' ,
353+ type = str )
335354
336355 for key , value in vars (parser .parse_args ()).iteritems ():
337356 if not value == None :
@@ -349,8 +368,15 @@ def _main_child():
349368 print ("==> Parallelism: %d" % (config ['parallelism' ]))
350369 print ("==> Key Pair: %s" % (config ['key_name' ]))
351370
371+ # Optional params
352372 if config ['key_path' ]:
353373 print ("==> Key Path: %s" % (config ['key_path' ]))
374+ if config ['custom_cookbook_url' ]:
375+ print ("==> Custom cfncluster-cookbook URL: %s" % (config ['custom_cookbook_url' ]))
376+ if config ['custom_node_url' ]:
377+ print ("==> Custom cfncluster-node URL: %s" % (config ['custom_node_url' ]))
378+ if config ['custom_template_url' ]:
379+ print ("==> Custom cfncluster template URL: %s" % (config ['custom_template_url' ]))
354380
355381 # Populate subnet / vpc data for all regions we're going to test.
356382 for region in region_list :
@@ -386,7 +412,7 @@ def _main_child():
386412 for region in region_list :
387413 for i in range (0 , config ['parallelism' ]):
388414 t = threading .Thread (target = test_runner ,
389- args = (region , work_queues [region ], config ['key_name' ], config [ 'key_path' ] ))
415+ args = (region , work_queues [region ], config ['key_name' ], config ))
390416 t .daemon = True
391417 t .start ()
392418
0 commit comments