def run_method_as_process(self, method, *args, **kwargs):
     methvars = EutesterTestCase.get_meth_arg_names(method)
     daemonize = False
     if "daemonize" in kwargs:
         if "daemonize" in methvars:
             daemonize = kwargs["daemonize"]
         else:
             daemonize = kwargs.pop("daemonize")
     queue = Queue()
     id = uuid.uuid1().hex
     self.queue_pool[id] = queue
     process = Process(target=self.__run_method, args=(method, queue, self.__get_arguments(method, args, kwargs)))
     self.process_pool[id] = process
     process.daemon = daemonize
     process.start()
     return id
Example #2
0
 def run_method_as_process(self, method, *args, **kwargs):
     methvars = EutesterTestCase.get_meth_arg_names(method)
     daemonize = False
     if 'daemonize' in kwargs:
         if 'daemonize' in methvars:
             daemonize = kwargs['daemonize']
         else:
             daemonize = kwargs.pop('daemonize')
     queue = Queue()
     id = uuid.uuid1().hex
     self.queue_pool[id] = queue
     process = Process(target=self.__run_method,
                       args=(
                           method,
                           queue,
                           self.__get_arguments(method, args, kwargs),
                       ))
     self.process_pool[id] = process
     process.daemon = daemonize
     process.start()
     return id
Example #3
0
# 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)
Example #4
0
#        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',
Example #5
0
#        --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)
Example #6
0
#!/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")
Example #7
0
    def modify_property(self, property, value):
        """
        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 = [ ]
Example #8
0
            instance.sys("uname -r", code=0)

    def modify_property(self, property, value):
        """
        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(InstanceRestore)

    ### Either use the list of tests passed from config/command line to determine what subset of tests to run
    list = testcase.args.tests or [ "restore_logic"]

    ### Convert test suite methods to EutesterUnitTest objects
    unit_list = [ ]
Example #9
0
                '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:
Example #10
0
        self.clean_method = self.cleanup

    def cleanup(self):
        if self.reservation:
            self.assertTrue(self.tester.terminate_instances(self.reservation), "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)
Example #11
0
        is an error, the test case will error out; logging the results.
        """
        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)
Example #12
0
 def create_testcase_from_method(self, method, *args):
     testcase = EutesterTestCase(method, args)
     return testcase
Example #13
0
    def modify_property(self, property, value):
        """
        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 = []
Example #14
0
                            "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)
Example #15
0
            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)
Example #16
0
#!/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',
Example #17
0
            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:
Example #18
0
#!/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
Example #19
0
#    @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)
    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()
Example #20
0
#!/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(