instance.sys('ls -la', code=0) not_rebooted_image = self.tester.create_image(instance, "BFEBS-test-create-image-noreboot-" + current_time, no_reboot=True) ending_uptime = instance.get_uptime() if ending_uptime < starting_uptime: raise Exception("Instance did get stopped then started when it shouldn't have") self.run_instance_params['image'] = not_rebooted_image new_image_reservation = self.tester.run_instance(**self.run_instance_params) for new_instance in new_image_reservation.instances: ## Check that our temp file exists new_instance.sys("ls -la") new_instance.sys("ls " + temp_file, code=0) self.tester.terminate_instances(new_image_reservation) if __name__ == "__main__": testcase= EutesterTestCase(name='bfebstest') testcase.setup_parser(description="Test the Eucalyptus EC2 BFEBS image functionality.") testcase.parser.add_argument('--imgurl', help="BFEBS Image to splat down", default=None) testcase.get_args() bfebstestsuite = testcase.do_with_args(BFEBSBasics) ### Either use the list of tests passed from config/command line to determine what subset of tests to run list = testcase.args.tests or ["RegisterImage", "StopStart", "MultipleBFEBSInstances"] ### Convert test suite methods to EutesterUnitTest objects unit_list = [] for test in list: test = getattr(bfebstestsuite,test) unit_list.append(testcase.create_testunit_from_method(test)) testcase.clean_method = bfebstestsuite.clean_method result = testcase.run_test_case_list(unit_list) exit(result)
bundled_image_reservation = self.tester.run_instance( **self.run_instance_params) for new_instance in bundled_image_reservation.instances: new_instance.sys("ls " + temp_file, code=0) self.tester.terminate_instances(bundled_image_reservation) self.run_instance_params['image'] = original_image if __name__ == "__main__": testcase = EutesterTestCase(name='instancetest') testcase.setup_parser( description= "Test the Eucalyptus EC2 instance store image functionality.") testcase.get_args() instancetestsuite = testcase.do_with_args(InstanceBasics) ### Either use the list of tests passed from config/command line to determine what subset of tests to run test_list = testcase.args.tests or [ "BasicInstanceChecks", "DNSResolveCheck", "Reboot", "MetaData", "ElasticIps", "MultipleInstances", "LargestInstance", "PrivateIPAddressing", "Churn" ] ### Convert test suite methods to EutesterUnitTest objects unit_list = [] for test in test_list: test = getattr(instancetestsuite, test) unit_list.append(testcase.create_testunit_from_method(test)) testcase.clean_method = instancetestsuite.clean_method result = testcase.run_test_case_list(unit_list) exit(result)
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.url and not testcase.args.filepath) or (testcase.args.url and testcase.args.filepath): raise Exception('Must specify either a URL or FILE path to create Windows EMI from') #Set kernel to 'windows'. This result in the platform type resulting in 'windows' after registration. if str(testcase.args.image_type).lower() == "windows": testcase.args.kernel = "windows" 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'].pop() testcase.debug('\n---------------------------\nCreated EMI:' + str(emi) +'\n---------------------------') exit(result)
recycle = testcase.args.recycle if testcase.args.fof is not None else False if not args.emi: raise Exception("Need a windows EMI to test against") if not (args.win_proxy_hostname and args.win_proxy_username and (args.win_proxy_password or args.win_proxy_keypath)): raise Exception("Need windows proxy hostname, and login credentials") WinTests = testcase.do_with_args(WindowsTests,work_component=machine) #WinTests = WindowsTests() emi = WinTests.tester.get_emi(args.emi) tests = [] if recycle or args.instance: tests.append(testcase.create_testunit_from_method(WinTests.get_windows_instance, eof=True)) else: tests.append(testcase.create_testunit_from_method(WinTests.test_run_windows_emi, eof=True)) tests.append(testcase.create_testunit_from_method(WinTests.test_get_windows_instance_password, eof=True)) tests.append(testcase.create_testunit_from_method(WinTests.update_proxy_info, eof=True)) tests.append(testcase.create_testunit_from_method(WinTests.test_wait_for_instance_boot)) tests.append(testcase.create_testunit_from_method(WinTests.test_poll_for_rdp_port_status, eof=True)) tests.append(testcase.create_testunit_from_method(WinTests.proxy.ps_login_test, eof=True)) tests.append(testcase.create_testunit_from_method(WinTests.proxy.ps_ephemeral_test)) tests.append(testcase.create_testunit_from_method(WinTests.proxy.ps_hostname_test)) tests.append(testcase.create_testunit_from_method(WinTests.proxy.ps_virtio_test)) ret = testcase.run_test_case_list(tests, clean_on_exit=args.fof, printresults=True) print "Windows basic test exiting:"+str(ret) exit(ret)
testcase.parser.add_argument("--url", help="URL containing remote windows image to create EMI from", default=None) testcase.parser.add_argument("--file", dest="image_file", help="File path to create windows EMI from", default=None) testcase.parser.add_argument( "--workip", help="The IP of the machine that the operation will be performed on", default=None ) testcase.parser.add_argument( "--destpath", help="The path on the workip, that this operation will be performed on", default="/disk1/storage" ) testcase.parser.add_argument( "--urlpass", dest="wget_password", help="Password needed to retrieve remote url", default=None ) testcase.parser.add_argument("--urluser", dest="wget_user", help="Username needed to retrieve remote url", default=None) testcase.parser.add_argument( "--gigtime", dest="time_per_gig", help="Time allowed per gig size of image to be used", default=300 ) testcase.parser.add_argument("--interbundletime", dest="inter_bundle_timeout", help="Inter-bundle timeout", default=120) testcase.parser.add_argument("--bucket", dest="bucketname", help="bucketname", default=None) args = testcase.get_args() if (not args.url and not args.image_file) or (args.url and args.image_file): raise Exception("Must specify either a URL or FILE path to create Windows EMI from") if args.workip: machine = Machine(hostname=args.workip, password=args.password) WinTests = testcase.do_with_args(WindowsTests, work_component=machine) test = testcase.create_testunit_from_method(WinTests.create_windows_emi_from_url) testcase.run_test_case_list([test], eof=True, clean_on_exit=False, printresults=True)
'--gigtime', dest='time_per_gig', help='Time allowed per gig size of image to be used', default=300) testcase.parser.add_argument('--interbundletime', dest='inter_bundle_timeout', help='Inter-bundle timeout', default=120) testcase.parser.add_argument('--bucket', dest='bucketname', help='bucketname', default=None) args = testcase.get_args() if (not args.url and not args.image_file) or (args.url and args.image_file): raise Exception( 'Must specify either a URL or FILE path to create Windows EMI from') if args.workip: machine = Machine(hostname=args.workip, password=args.password) WinTests = testcase.do_with_args(WindowsTests, work_component=machine) test = testcase.create_testunit_from_method( WinTests.create_windows_emi_from_url) testcase.run_test_case_list([test], eof=True, clean_on_exit=False, printresults=True)
if not args.emi: raise Exception("Need a windows EMI to test against") if not (args.win_proxy_hostname and args.win_proxy_username and (args.win_proxy_password or args.win_proxy_keypath)): raise Exception("Need windows proxy hostname, and login credentials") WinTests = testcase.do_with_args(WindowsTests, work_component=machine) #WinTests = WindowsTests() emi = WinTests.tester.get_emi(args.emi) tests = [] if recycle or args.instance: tests.append( testcase.create_testunit_from_method(WinTests.get_windows_instance, eof=True)) else: tests.append( testcase.create_testunit_from_method(WinTests.test_run_windows_emi, eof=True)) tests.append( testcase.create_testunit_from_method( WinTests.test_get_windows_instance_password, eof=True)) tests.append( testcase.create_testunit_from_method(WinTests.update_proxy_info, eof=True)) tests.append( testcase.create_testunit_from_method(WinTests.test_wait_for_instance_boot)) tests.append( testcase.create_testunit_from_method( WinTests.test_poll_for_rdp_port_status, eof=True)) tests.append(