当前位置: 首页>>代码示例>>Python>>正文


Python eutestcase.TestColor类代码示例

本文整理汇总了Python中eutester.eutestcase.TestColor的典型用法代码示例。如果您正苦于以下问题:Python TestColor类的具体用法?Python TestColor怎么用?Python TestColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TestColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pretest7_per_service_restart_attach_vols_to_bfebs_instances

    def pretest7_per_service_restart_attach_vols_to_bfebs_instances(self, volsperinstance=2):
        """
        Definition: Attach all volumes created in this test for bfebs to all bfebs instances created in this test.
        This tests should be completed per zone prior to restarting services.
        """
        self.status(
            "' pretest7_per_service_restart_attach_vols_to_bfebs_instances' starting...",
            testcolor=TestColor.get_canned_color("whiteonblue"),
        )

        for instance in self.bfebs_instances:
            for x in xrange(0, volsperinstance):
                for vol in self.bfebs_volumes:
                    if vol.zone == instance.placement and vol.status == "available":
                        try:
                            instance.attach_volume(vol, timeout=90)
                        except ec2ops.VolumeStateException, vse:
                            self.status(
                                "This is a temp work around for testing, this is to avoid bug euca-5297" + str(vse),
                                testcolor=TestColor.get_canned_color("failred"),
                            )
                            time.sleep(10)
                            self.debug("Monitoring volume post VolumeStateException...")
                            vol.eutest_attached_status = None
                            self.tester.monitor_euvolumes_to_status(
                                [vol], status="in-use", attached_status="attached", timeout=60
                            )
开发者ID:sshamsudheen,项目名称:eutester,代码行数:27,代码来源:ebs_persistance_tests.py

示例2: pretest6_pre_service_restart_create_bfebs_volume_resources

    def pretest6_pre_service_restart_create_bfebs_volume_resources(self, volsperinstance=2, size=1, timepergig=300):
        """
        Definition: Create volumes to be used in this test based upon volsperinstance and size args provided.
         This tests should be completed per zone prior to restarting services.

        :param volsperinstance: integer how many concurrent volumes to create/delete per instance
        :param size: integer size of volume(s) in GB
        :param timepergig: integer time allowed per GB in seconds during creation
        """
        volumes = []
        for zone in self.zones:
            instancecount = 0
            for instance in self.bfebs_instances:
                if instance.placement == zone:
                    instancecount += 1
            volcount = instancecount * volsperinstance
            volumes.extend(
                self.tester.create_volumes(
                    zone, size=size, count=volcount, monitor_to_state=None, timepergig=timepergig
                )
            )
        self.bfebs_volumes = self.tester.monitor_created_euvolumes_to_state(volumes, timepergig=timepergig)
        self.status(
            "pretest6_pre_service_restart_create_bfebs_volume_resources, done",
            testcolor=TestColor.get_canned_color("whiteonblue"),
        )
开发者ID:sshamsudheen,项目名称:eutester,代码行数:26,代码来源:ebs_persistance_tests.py

示例3: test2_post_service_interuption_check_volume_from_snapshots

 def test2_post_service_interuption_check_volume_from_snapshots(self):
     self.status(
         "Checking creation of volumes from pre-existing snapshots post service interruption...",
         testcolor=TestColor.get_canned_color("whiteonblue"),
     )
     vols = []
     if not self.snapshots:
         raise Exception("self.snapshots not populated?")
     for snap in self.snapshots:
         for zone in self.zones:
             vols.extend(self.tester.create_volumes(zone, snapshot=snap, monitor_to_state=None))
     self.volumes.extend(self.tester.monitor_created_euvolumes_to_state(vols, state="available"))
     self.status(
         "Done creating volumes from pre-existing snapshots post service interruption.",
         testcolor=TestColor.get_canned_color("whiteonblue"),
     )
开发者ID:hspencer77,项目名称:eutester,代码行数:16,代码来源:ebs_persistance_tests.py

示例4: test2_post_service_interuption_check_volume_from_snapshots

    def test2_post_service_interuption_check_volume_from_snapshots(self):

        """
        Definition: Attempts to check volume creation from snapshots created before SC restart.
        """
        self.status("Checking creation of volumes from pre-existing snapshots post service interruption...",
                    testcolor=TestColor.get_canned_color('whiteonblue'))
        vols = []
        if not self.snapshots:
            raise Exception("self.snapshots not populated?")
        for snap in self.snapshots:
            for zone in self.zones:
                vols.extend(self.tester.create_volumes(zone, snapshot=snap, monitor_to_state=None))
        #Now monitor created volumes to state available, use a large timeout per gig here.
        self.volumes.extend(self.tester.monitor_created_euvolumes_to_state(vols, state='available', timepergig=360))
        self.status("Done creating volumes from pre-existing snapshots post service interruption.",
                    testcolor=TestColor.get_canned_color('whiteonblue'))
开发者ID:euca-nightfury,项目名称:eutester,代码行数:17,代码来源:ebs_persistance_tests.py

示例5: test3_post_service_interuption_check_volume_attachment_of_new_vols_from_old_snaps

    def test3_post_service_interuption_check_volume_attachment_of_new_vols_from_old_snaps(self):
        vols = []
        errmsg = ""
        for snap in self.snapshots:
            vols.extend(self.tester.get_volumes(status='available', snapid=snap.id))

        if not vols:
            raise Exception("No vols were found as created from previous snapshots")
        if not self.instances:
            raise Exception('No instances to use for this test')
        if not self.snapshots:
            raise Exception('No snapshots to use for this test')
        for vol in vols:
            vol.update()
        availvols = copy.copy(vols)
        self.status('Attempting to attach the following volumes:',testcolor=TestColor.get_canned_color('whiteonblue'))
        self.tester.show_volumes(availvols)
        #Iterate through the volumes, and attach them all to at least one instance in each zone.
        for instance in self.instances:
            if not availvols:
                break
            for vol in availvols:
                if vol.zone == instance.placement:
                    availvols.remove(vol)
                    try:
                        try:
                            instance.attach_volume(vol, timeout=90)
                        except ec2ops.VolumeStateException, vse:
                            self.status("This is a temp work around for testing, this is to avoid bug euca-5297"+str(vse),
                                        testcolor=TestColor.get_canned_color('failred'))
                            time.sleep(10)
                            self.tester.monitor_euvolumes_to_status([vol],status='in-use',attached_status='attached',timeout=60)
                        for snap in self.snapshots:
                            snap.update()
                            if vol.snapshot_id == snap.id:
                                if vol.md5len != snap.eutest_volume_md5len:
                                    self.debug('Need to adjust md5sum for length of snapshot...')
                                    vol.md5len = snap.eutest_volume_md5len
                                    instance.vol_write_random_data_get_md5(vol,length=snap.eutest_volume_md5len)
                                if vol.md5 != snap.eutest_volume_md5:
                                    errmsg += "Volume:" + str(vol.id) + " MD5 did not match snapshots " \
                                              + str(snap.id) + ": snapmd5:" + str(snap.eutest_volume_md5) \
                                              + " --vs volmd5:-- " + str(vol.md5)
                    except Exception, e:
                        errmsg += str(instance.id) +"Volume:" + str(vol.id) \
                              + " error when attaching and comparing md5, err:" + str(e)
开发者ID:euca-nightfury,项目名称:eutester,代码行数:46,代码来源:ebs_persistance_tests.py

示例6: print_all_test_resources

 def print_all_test_resources(self):
     self.status(
         "Printing test resources prior to service interruption...",
         testcolor=TestColor.get_canned_color("whiteonblue"),
     )
     self.tester.print_euinstance_list(self.instances)
     self.tester.print_euvolume_list(self.volumes)
     self.tester.print_eusnapshot_list(self.snapshots)
开发者ID:sshamsudheen,项目名称:eutester,代码行数:8,代码来源:ebs_persistance_tests.py

示例7: test1_post_service_interruption_check_attached_volumes

    def test1_post_service_interruption_check_attached_volumes(self, check_vols=None, check_instances=None):
        """
        Definition: Attempts to verify that volumes maintained their attached state through the SC reboot.
        """
        check_vols = check_vols or self.volumes
        check_instances = check_instances or self.instances
        write_length = 10000
        errmsg = ""
        self.tester.show_volumes(check_vols)

        for vol in check_vols:
            vol.update()
            if vol.status == "in-use" and (vol.attach_data and vol.attach_data.status == 'attached' ):
                for instance in check_instances:
                    if instance.id == vol.attach_data.instance_id:
                        if not vol in instance.attached_vols:
                            errmsg += "Volume:" + str(vol.id) \
                                      + " is attached to " + str(instance.id) + ", but not in instance attached list?"
                        break
            else:
                errmsg += "Volume:" + str(vol.id) + ", status:" + str(vol.status) \
                          + " was not attached post service interruption \n"

        if errmsg:
            raise Exception(errmsg)

        self.status("Attached state passed. Now checking read/write with attached volumes...",
                    testcolor=TestColor.get_canned_color('whiteonblue'))
        for instance in check_instances:
            instance.update()
            instance.reset_ssh_connection()
            try:
                bad_vols = instance.get_unsynced_volumes()
                if bad_vols:
                    errmsg = str(instance.id) + "Unsynced vols found:"
                    for bad_vol in bad_vols:
                        errmsg = errmsg + str(bad_vol.id) + ":" + str(bad_vol.status) + ","
                    errmsg = errmsg + "\n"
            except Exception, ve:
                errmsg = errmsg + "\n" + str(ve)
            if errmsg:
                raise Exception(errmsg)
            for vol in instance.attached_vols:
                try:
                    md5before = vol.md5
                    md5now = instance.md5_attached_euvolume(vol,updatevol=False)
                    if md5before != md5now:
                        errmsg += str(instance.id) +"Volume:" + str(vol.id) \
                                    + "has different md5 sum after service interruption. Before:'" \
                                    + str(md5before) + "' - vs - '" + str(md5now) + "'"
                    vol.length = write_length
                    instance.vol_write_random_data_get_md5(vol,length=write_length, overwrite=True)
                    instance.sys('sync',code=0)
                except Exception, e:
                    errmsg += str(instance.id) + "Volume:" + \
                              str(vol.id) + ", error while using vol post service interruption, err: "+str(e)
开发者ID:euca-nightfury,项目名称:eutester,代码行数:56,代码来源:ebs_persistance_tests.py

示例8: test3_post_service_interuption_check_volume_attachment_of_new_vols_from_old_snaps

 def test3_post_service_interuption_check_volume_attachment_of_new_vols_from_old_snaps(self):
     vols = []
     errmsg = ""
     for snap in self.snapshots:
         vols.extend(self.tester.get_volumes(snapid=snap.id))
     if not vols:
         raise Exception("No vols were found as created from previous snapshots")
     if not self.instances:
         raise Exception("No instances to use for this test")
     if not self.snapshots:
         raise Exception("No snapshots to use for this test")
     self.tester.print_euvolume_list(vols)
     for instance in self.instances:
         for vol in vols:
             if vol.zone == instance.placement:
                 try:
                     try:
                         instance.attach_volume(vol, timeout=90)
                     except ec2ops.VolumeStateException, vse:
                         self.status(
                             "This is a temp work around for testing, this is to avoid bug euca-5297" + str(vse),
                             testcolor=TestColor.get_canned_color("failred"),
                         )
                         time.sleep(10)
                         self.tester.monitor_euvolumes_to_status(
                             [vol], status="in-use", attached_status="attached", timeout=60
                         )
                     for snap in self.snapshots:
                         snap.update()
                         if vol.snapshot_id == snap.id:
                             if vol.md5len != snap.eutest_volume_md5len:
                                 self.debug("Need to adjust md5sum for length of snapshot...")
                                 vol.md5len = snap.eutest_volume_md5len
                                 instance.vol_write_random_data_get_md5(vol, length=snap.eutest_volume_md5len)
                             if vol.md5 != snap.eutest_volume_md5:
                                 errmsg += (
                                     "Volume:"
                                     + str(vol.id)
                                     + " MD5 did not match snapshots "
                                     + str(snap.id)
                                     + ": snapmd5:"
                                     + str(snap.eutest_volume_md5)
                                     + " --vs volmd5:-- "
                                     + str(vol.md5)
                                 )
                 except Exception, e:
                     errmsg += (
                         str(instance.id)
                         + "Volume:"
                         + str(vol.id)
                         + " error when attaching and comparing md5, err:"
                         + str(e)
                     )
开发者ID:hspencer77,项目名称:eutester,代码行数:53,代码来源:ebs_persistance_tests.py

示例9: pretest3_pre_service_restart_attach_all_volumes

    def pretest3_pre_service_restart_attach_all_volumes(self):
        '''
        Definition: Attach all volumes created in this test to all instances created in this test.
        This tests should be completed per zone prior to restarting services.
        '''
        self.status("\'pre_service_restart_attach_all_volumes\' starting...",
                    testcolor=TestColor.get_canned_color('whiteonblue'))

        for instance in self.instances:
            for x in xrange(0,self.args.volsperinstance):
                for vol in self.volumes:
                    if vol.zone == instance.placement and vol.status == 'available':
                        try:
                            instance.attach_volume(vol,timeout=90)
                        except ec2ops.VolumeStateException, vse:
                            self.status("This is a temp work around for testing, this is to avoid bug euca-5297"+str(vse),
                                        testcolor=TestColor.get_canned_color('failred'))
                            time.sleep(10)
                            self.debug('Monitoring volume post VolumeStateException...')
                            vol.eutest_attached_status = None
                            self.tester.monitor_euvolumes_to_status([vol],status='in-use',attached_status='attached',timeout=60)
开发者ID:euca-nightfury,项目名称:eutester,代码行数:21,代码来源:ebs_persistance_tests.py

示例10: test4_post_service_interuption_check_snapshot_creation

 def test4_post_service_interuption_check_snapshot_creation(self):
     self.status('Attempting to verify snapshot creation post reboot',\
                 testcolor=TestColor.get_canned_color('whiteonblue'))
     testvols = []
     testsnaps = []
     for zone in self.zones:
         for vol in self.volumes:
             if vol.zone == zone:
                 testvols.append(vol)
                 break
     for vol in testvols:
         testsnaps.extend(self.tester.create_snapshots(vol, monitor_to_completed=False))
     wait_on_progress = int(len(testsnaps)*25)
     self.tester.monitor_eusnaps_to_completed(testsnaps,wait_on_progress=wait_on_progress)
     self.snapshots.extend(testsnaps)
开发者ID:euca-nightfury,项目名称:eutester,代码行数:15,代码来源:ebs_persistance_tests.py

示例11: attach_all_avail_vols_to_instances_in_zones

 def attach_all_avail_vols_to_instances_in_zones(self, zonelist=None, timeout=360, overwrite=False):
     """
     Description:
                 Iterates though zones and attempts to attach volumes to an instance within each zone.  
                 
     :parram zonelist: list of zones to include in test
     :param timeout: timeout used for attach volume method
     :param overwrite: boolean to indicate whether a non-zero filled volume should have new unique data prepended for md5sum. 
                       This should be used when zero fill volume property is not in use upon volume first attach. 
                       It should not be used after the 1st attach and volume has been converted to a euvolume within this test. 
     """
     zonelist = zonelist or self.zonelist
     if not zonelist:
         raise Exception("attach_all_avail_vols_to_instances_in_zones: Zonelist is empty")
     for zone in zonelist:
         if not zone.volumes:
             raise Exception('attach_all_avail_vols_to_instances_in_zones: Zone.volumes is empty')
         if not zone.instances:
             raise Exception('attach_all_avail_vols_to_instances_in_zones: Instance list is empty')
         i=0
         for volume in zone.volumes:
             volume.update()
             if (volume.status == "available"):
                     if i > (len(zone.instances)-1):
                         i = 0
                     self.debug("Attempting to attach to "+str(i)+"/"+str(len(zone.instances))+" instances in zone:"+str(zone))
                     instance = zone.instances[i]
                     try:
                         instance.attach_euvolume(volume,timeout=timeout, overwrite=overwrite)
                     except ec2ops.VolumeStateException, vse:
                         self.status("This is a temp work around for testing, this is to avoid bug euca-5297"+str(vse),
                                     testcolor=TestColor.get_canned_color('failred'))
                         time.sleep(10)
                         self.debug('Monitoring volume post VolumeStateException...')
                         volume.eutest_attached_status = None
                         self.tester.monitor_euvolumes_to_status([volume],status='in-use',attached_status='attached',timeout=60)
                     except Exception, e:
                         self.debug("attach_all_vols_to_instances_in_zones failed to attach volume")
                         raise e
                     i += 1
开发者ID:gregdek,项目名称:eutester,代码行数:40,代码来源:ebstestsuite.py

示例12: start_all_services_on_storage_controllers

    def start_all_services_on_storage_controllers(self, sc_list):
        self.status("Waiting for storage controller's services to start...",
                    testcolor=TestColor.get_canned_color('whiteonblue'))
        all_services_on_sc = []
        if not sc_list:
            raise Exception("sc_list was empty in: start_all_services_on_storage_controllers")
        #wait = 10 * 60
        for sc in sc_list:
            self.debug('Getting all services co-existing on sc: ' + str(sc.hostname))
            all_services_on_sc.extend(self.tester.service_manager.get_all_services_by_filter(hostname=sc.hostname))

        for service in all_services_on_sc:
            service.start()
        self.debug('Issued start to all services, now wait for: all_services_operational')
        self.tester.service_manager.all_services_operational()
        try:
            for service in all_services_on_sc:
                self.tester.service_manager.wait_for_service(service)
        except Exception, e:
            dbgout = self.tester.get_traceback()
            self.tester.service_manager.print_services_list(all_services_on_sc)
            dbgout += "\nFailed waiting for all services on rebooted machines to recover\n"
            raise Exception(dbgout + str(e))
开发者ID:euca-nightfury,项目名称:eutester,代码行数:23,代码来源:ebs_persistance_tests.py

示例13: print_all_test_resources

 def print_all_test_resources(self):
     self.status('Printing test resources prior to service interruption...',
                 testcolor=TestColor.get_canned_color('whiteonblue'))
     self.tester.show_instances(self.instances)
     self.tester.show_volumes(self.volumes)
     self.tester.show_snapshots(self.snapshots)
开发者ID:euca-nightfury,项目名称:eutester,代码行数:6,代码来源:ebs_persistance_tests.py

示例14: qa_214_test2

 def qa_214_test2(self, testcount=20, size=1,volcount=1):
     '''
     Definition: create volumes Y, then  repeat ( attach volumes Y-> detach volumes Y)
     
     :param testcount: integer times to run this test
     :param size: integer size of volume(s) to create in GB
     :param volcount: number of volumes to create for this test
     '''
     instance = self.instance or self.launch_test_instance()
     volumes = self.tester.create_volumes(self.zone, size=size, count=volcount)
     for x in xrange(0,testcount):
         self.status("\'qa_214_test2\' number:"+str(x)+"/"+str(testcount))
         for volume in volumes:
             instance.attach_volume(volume)
             time.sleep(1)
             instance.detach_euvolume(volume)
         self.status('qa_214_test2: Completed:'+str(x)+'/'+str(testcount)+' tests',testcolor=TestColor.get_canned_color('whiteonblue'))
开发者ID:ccassler,项目名称:eutester,代码行数:17,代码来源:qa-214-volume-churn.py

示例15: str

                    if vol.zone == instance.placement and vol.status == "available":
                        try:
                            instance.attach_volume(vol, timeout=90)
                        except ec2ops.VolumeStateException, vse:
                            self.status(
                                "This is a temp work around for testing, this is to avoid bug euca-5297" + str(vse),
                                testcolor=TestColor.get_canned_color("failred"),
                            )
                            time.sleep(10)
                            self.debug("Monitoring volume post VolumeStateException...")
                            vol.eutest_attached_status = None
                            self.tester.monitor_euvolumes_to_status(
                                [vol], status="in-use", attached_status="attached", timeout=60
                            )
        self.status(
            "'pre_service_restart_attach_all_volumes' done", testcolor=TestColor.get_canned_color("whiteonblue")
        )

    def pretest4_pre_service_restart_create_snap_per_zone(self, timepergig=300):
        """
        Definition: Create a single snapshot. This tests should be completed per zone prior to restarting services.
        :param timepergig: integer time allowed per GB in seconds during creation
        :param deletetimeout: integer timeout in seconds waiting for volume to transition to 'deleted' state
        """
        snaps = []
        snapvols = []
        # Add one volume from each zone...
        for zone in self.zones:
            for vol in self.volumes:
                if vol.zone == zone:
                    snapvols.append(vol)
开发者ID:sshamsudheen,项目名称:eutester,代码行数:31,代码来源:ebs_persistance_tests.py


注:本文中的eutester.eutestcase.TestColor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。