self.clean_created_resources(zonelist=self.zonelist, timeout=360) def clean_created_resources(self, zonelist=None, timeout=360): self.tester.cleanup_artifacts() #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)
from eutester.eutestcase import EutesterTestCase from eutester.eutestcase import EutesterTestResult from ebstestsuite import EbsTestSuite import argparse import os if __name__ == "__main__": ## If given command line arguments, use them as test names to launch #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...
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # from eutester.eutestcase import EutesterTestCase from testcases.cloud_user.images.imageutils import ImageUtils machine=None testcase = EutesterTestCase() testcase.setup_parser(testname='load_hvm_image.py', description='Loads an hvm image from either a remote url or local file path', emi=False, testlist=False) testcase.parser.add_argument('--url',help='URL containing remote windows image to create EMI from', default=None) testcase.parser.add_argument('--filepath',dest='filepath', help='File path to create windows EMI from', default=None) testcase.parser.add_argument('--workerip',dest='worker_machine', help='The ip/hostname of the machine that the operation will be performed on', default=None) testcase.parser.add_argument('--worker_username',dest='worker_username', help='The username of the machine that the operation will be performed on, default:"root"', default='root') testcase.parser.add_argument('--worker_password',dest='worker_password', help='The password of the machine that the operation will be performed on', default=None) testcase.parser.add_argument('--worker_keypath',dest='worker_keypath', help='The ssh keypath 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('--virtualization_type', help='virtualization type, hvm or pv', default=None) testcase.parser.add_argument('--bucket',dest='bucketname', help='bucketname', default=None)
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)
#!/usr/bin/python from eutester.eutestcase import EutesterTestCase, EutesterTestUnit, EutesterTestResult from testcases.cloud_user.images.windows.windowstests import WindowsTests from eutester.euconfig import EuConfig from eutester.machine import Machine 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")
# # @author: clarkmatthew import unittest from eutester.eutestcase import EutesterTestCase from eutester.eutestcase import EutesterTestResult from ebstestsuite import EbsTestSuite import argparse import os if __name__ == "__main__": ## If given command line arguments, use them as test names to launch testcase = EutesterTestCase(name='multi_node_churn') 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( '--count', type=int, help='Number of times to run attach/detach churn', default=None) testcase.parser.add_argument('--nodecount', type=int, help='Number of nodes in env', default=None) testcase.parser.add_argument( '--fof', dest='fof', help="Freeze test on fail, do not remove or tear down test items", action='store_true',
#!/usr/bin/python from eutester.eutestcase import EutesterTestCase, EutesterTestUnit, EutesterTestResult from testcases.cloud_user.images.windows.windowstests import WindowsTests from eutester.euconfig import EuConfig from eutester.machine import Machine machine = None testcase = EutesterTestCase() testcase.setup_parser( testname="load_windows_image.py", description="Loads a windows image from either a remote url or local file path", emi=False, testlist=False, ) 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
Modify a eucalyptus property through the command line euca-modify-property tool property Property to modify value Value to set it too """ command = "source " + self.tester.credpath + "/eucarc && " + self.tester.eucapath + "/usr/sbin/euca-modify-property -p " + str(property) + "=" + str(value) if self.clc.found(command, property): self.debug("Properly modified property " + property) else: raise Exception("Setting property " + property + " failed") if __name__ == "__main__": testcase = EutesterTestCase() #### Adds argparse to testcase and adds some defaults args testcase.setup_parser() ### Get all cli arguments and any config arguments and merge them testcase.get_args() ### Instantiate an object of your test suite class using args found from above instance_basics_tests = testcase.do_with_args(ReportingBasics) ### Either use the list of tests passed from config/command line to determine what subset of tests to run list = testcase.args.tests or ["instance"] ### Convert test suite methods to EutesterUnitTest objects unit_list = [ ] for test in list: unit_list.append( instance_basics_tests.create_testunit_by_name(test) )
instance.connect_to_instance() ending_uptime = instance.get_uptime() if ending_uptime > starting_uptime: raise Exception("Instance did not get stopped then started") bundled_image_reservation = self.tester.run_image( **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))
""" prev_address = None if self.reservation: self.tester.terminate_instances(self.reservation) self.set_reservation(None) for i in xrange(5): reservation = self.tester.run_instance(**self.run_instance_params) for instance in reservation.instances: if prev_address is not None: self.assertTrue(re.search(str(prev_address) ,str(instance.ip_address)), str(prev_address) +" Address did not get reused but rather " + str(instance.public_dns_name)) prev_address = instance.ip_address self.tester.terminate_instances(reservation) 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 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 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)
property Property to modify value Value to set it too """ command = "source " + self.tester.credpath + "/eucarc && " + self.tester.eucapath + "/usr/sbin/euca-modify-property -p " + str( property) + "=" + str(value) if self.clc.found(command, property): self.debug("Properly modified property " + property) else: raise Exception("Setting property " + property + " failed") if __name__ == "__main__": testcase = EutesterTestCase() #### Adds argparse to testcase and adds some defaults args testcase.setup_parser() ### Get all cli arguments and any config arguments and merge them testcase.get_args() ### Instantiate an object of your test suite class using args found from above instance_basics_tests = testcase.do_with_args(ReportingBasics) ### Either use the list of tests passed from config/command line to determine what subset of tests to run list = testcase.args.tests or ["instance"] ### Convert test suite methods to EutesterUnitTest objects unit_list = [] for test in list: unit_list.append(instance_basics_tests.create_testunit_by_name(test))
self.assertTrue(self.tester.start_instances(instances)) if self.keypair.name == instance.key_name: instance = self.tester.convert_instance_to_euisntance(instance, keypair=self.keypair) instance.sys("uname -r", code=0) else: self.assertTrue(self.tester.ping(instance.ip_address)) finally: self.tester.terminate_instances(instances) if self.volume: self.tester.wait_for_volume(self.volume, status="available") self.tester.delete_volume(self.volume) self.volume = None 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)
#!/usr/bin/python from eutester.eutestcase import EutesterTestCase, EutesterTestUnit, EutesterTestResult from testcases.cloud_user.images.windows.windowstests import WindowsTests from eutester.euconfig import EuConfig from eutester.machine import Machine 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(