#create a eutester testcase object... testcase= EutesterTestCase(name='ebs_extended_test') #add/remove arguements to the default cli and config file argument list, see testcase class for all default cli args testcase.setup_parser(description="Attempts to test and provide info on focused areas related to Eucalyptus EBS related functionality.", testlist=False) testcase.parser.add_argument('--snap_count', type=int, help='Number of snapshots to create per zone',default=5) testcase.parser.add_argument('--snap_delay', type=int, help='Delay in seconds between each snapshot created',default=0) testcase.parser.add_argument('--snap_progress', type=int, help='Number of 10 second polls to allow without increase in snapshot progress',default=60) testcase.parser.add_argument('--timepergig', type=int, help='Time allowed per gig size of volume during volume creation',default=300) testcase.parser.add_argument('--snap_attached', dest='snap_attached', action='store_true', default=False) testcase.parser.add_argument('--delete_to', type=int, help="Timeout for volume deletion", default=120) testcase.parser.add_argument('--root_device_type', help="Type of instance to run, 'ebs' or 'instance-store'", default='instance-store') #Get arguments passed in through cli and/or config file(s), these will be stored in testcase.args testcase.get_args() #create the EbsTestSuite object, use 'do_with_args' to auto populate the object's init with testcase.args ebstestsuite= testcase.do_with_args(EbsTestSuite) #register a test cleanup method with the testcase... testcase.clean_method = ebstestsuite.clean_created_resources #add test methods and their arguments to be run to a list... testlist = ebstestsuite.test_consecutive_concurrent(run=False, count=int(testcase.args.snap_count), delay=testcase.args.snap_delay, tpg=testcase.args.timepergig, snap_attached = testcase.args.snap_attached, delete_to = testcase.args.delete_to, poll_progress=testcase.args.snap_progress)
if ending_uptime > starting_uptime: raise Exception("Instance did not get stopped then started") 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)
machine=None testcase = EutesterTestCase() testcase.setup_parser(testname='windows_basic_test.py', vmtype=False, description='Run basic functionality test suite against a windows guest') testcase.parser.add_argument('--vmtype', help='vmtype to use when running windows instance', default='m1.xlarge') testcase.parser.add_argument('--win_proxy_hostname', help='powershell proxy hostname or ip', default=None) testcase.parser.add_argument('--win_proxy_username', help='powershell proxy ssh username', default='Administrator') testcase.parser.add_argument('--win_proxy_password', help='powershell proxy ssh password', default=None) testcase.parser.add_argument('--win_proxy_keypath', help='powershell proxy ssh keypath', default=None) testcase.parser.add_argument('--fof', help='freeze on failure, will not clean up test if set', default=False) testcase.parser.add_argument('--instance_id', dest='instance', help='Instance id. Must be a running instance and keyfile is local to this script', default=None) testcase.parser.add_argument('--recycle', help="re-use an instance who's keyfile is local to this test script",dest='recycle', action='store_true', default=None) args = testcase.get_args() 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 = []
#self.terminate_test_instances_for_zones(zonelist=zonelist, timeout=timeout) #self.delete_volumes_in_zones(zonelist=zonelist, timeout=timeout) #self.delete_snapshots_in_zones(zonelist=zonelist, timeout=timeout) if __name__ == "__main__": ## If given command line arguments, use them as test names to launch tc = EutesterTestCase() tc.setup_parser(testname='ebstestsuite.py', description='collection of ebs related tests', testlist=False) tc.parser.add_argument('--inst_pass', help="Instance password for ssh session if not key enabled", default=None) args = tc.get_args() #if file was not provided or is not found if not os.path.exists(args.config): print "Error: Mandatory Config File '"+str(args.config)+"' not found." tc.parser.print_help() exit(1) #ebssuite = EbsTestSuite(zone=args.zone, config_file= args.config, password=args.password,credpath=args.credpath, keypair=args.keypair, group=args.group, image=args.emi) ebssuite = tc.do_with_args(EbsTestSuite) kbtime=time.time() try: list = ebssuite.ebs_basic_test_suite(run=False) tc.run_test_case_list(list) except KeyboardInterrupt: ebssuite.debug("Caught keyboard interrupt...") if ((time.time()-kbtime) < 2): ebssuite.clean_created_resources()
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,