zones = self.zones def clean_method(self): 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:
'image'] = self.tester.bundle_instance_monitor_and_register( instance) 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_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:
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # 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)
instance.sys("touch " + temp_file + " && sync", code=0) 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)
# Cleanup: # --if 'fof' flag is not set, will remove all volumes, instance, and snapshots created during this test # # @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',
# --remove all volumes, instance, and snapshots created during this test # # @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 #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)
def create_testcase_from_method(self, method, *args): testcase = EutesterTestCase(method, args) return testcase
"Unable to terminate instance(s)") self.tester.delete_group(self.group) self.tester.delete_keypair(self.keypair) def MyTestUnit(self): """ A test description must go here...... This test will simply run an instance and check that it is reachable via ssh """ self.reservation = self.tester.run_instance(self.image, keypair=self.keypair.name, group=self.group.name) for instance in self.reservation.instances: instance.sys("uname -r") if __name__ == "__main__": ### Load a generic test case object to parse generic_testcase = EutesterTestCase() #### Adds args from config files and command line generic_testcase.compile_all_args() ### Initialize test suite using args found from above my_testcase = MyTestCase(config_file=generic_testcase.args.config_file, password=generic_testcase.args.password) ### List of test methods to run list = ["MyTestUnit"] ### Convert test suite methods to EutesterUnitTest objects result = my_testcase.run_test_list_by_name(list)
from eutester.eutestcase import EutesterTestResult from ebstestsuite import EbsTestSuite import argparse import os ebssuite = None zone = None config_file = None password = None credpath = None keypair = None group = None vmtype = None emi = None if __name__ == "__main__": ## If given command line arguments, use them as test names to launch testcase = EutesterTestCase(name='ebs_basic_test') testcase.setup_parser( description= "Attempts to test and provide info on focused areas related to Eucalyptus EBS related functionality.", testlist=False) testcase.get_args() ebstestsuite = testcase.do_with_args(EbsTestSuite) testcase.clean_method = ebstestsuite.clean_created_resources testlist = ebstestsuite.ebs_basic_test_suite(run=False) ret = testcase.run_test_case_list(testlist) print "ebs_basic_test exiting:(" + str(ret) + ")" exit(ret)