testcase.args.worker_password = testcase.args.worker_password or testcase.args.password testcase.args.worker_keypath = testcase.args.worker_keypath or testcase.args.keypair if not testcase.args.upload_manifest and not testcase.args.bundle_manifest: if (not testcase.args.url and not testcase.args.filepath) or (testcase.args.url and testcase.args.filepath): raise Exception('If manifest not provieded, either a URL or FILE path is required to create image ') def make_image_public(): emi = image_utils.tester.test_resources['images'][0] emi.set_launch_permissions(group_names=['all']) testcase.debug('\n---------------------------\nCreated EMI:' + str(emi) +'\n---------------------------') #Create an ImageUtils helper from the arguments provided in this testcase... image_utils = testcase.do_with_args(ImageUtils) #Create a single testcase to wrap and run the EMI creation task. Note by default all the overlapping args from # this testcase are fed to the testunit method when ran. test1 = testcase.create_testunit_from_method(image_utils.create_emi) test2 = testcase.create_testunit_from_method(make_image_public) result = testcase.run_test_case_list([test1, test2], eof=True, clean_on_exit=False, printresults=True) #By default created resources are stored in the eucaops/tester object's test_resources dict. See if our image is #prsent. If so print it out... if image_utils.tester.test_resources['images']: emi = image_utils.tester.test_resources['images'][0] testcase.debug('\n---------------------------\nCreated EMI:' + str(emi) +'\n---------------------------') exit(result)
'due to EOF(End On Failure) set for a failed testcase' ''' testcase.debug('This test should show a failure of a test which never gets to run' 'due to EOF(End On Failure) set for a failed testcase') ################################################################################################## # Create our test list of test units... # # this can be done by using a method or the name of a method within the testcase class... # # by passing a method. # # # # # # First test is a vanilla passing testcase, created by adding a 'method' from above # # This first test case is using autoarg=True, this will populate the test method using # # any args/kwargs from testcase.args which match the methods(*args, **kwargs). # ################################################################################################## test0 = testcase.create_testunit_from_method(my_first_test_method) ################################################################################################## # Next run the same method disabling autoarg. Set end of failure flag to false to continue # # Running the test suite upon failure # ################################################################################################## test1 = testcase.create_testunit_from_method(my_first_test_method, autoarg=False, eof=False) # Add Another test by method test2 = testcase.create_testunit_from_method(too_lazy_to_run) ################################################################################################## # Create this testunit obj by passing a name of a method local to the testcase object. # # Setting eof to True here will abort any remaining nephoria_unit_tests if this unit fails. This can also be # # set globally for all test units # # during run_test_case_list() #