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


Python CONFIG.get_report方法代码示例

本文整理汇总了Python中trove.tests.config.CONFIG.get_report方法的典型用法代码示例。如果您正苦于以下问题:Python CONFIG.get_report方法的具体用法?Python CONFIG.get_report怎么用?Python CONFIG.get_report使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trove.tests.config.CONFIG的用法示例。


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

示例1: test_delete

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
    def test_delete(self):
        if do_not_delete_instance():
            CONFIG.get_report().log("TESTS_DO_NOT_DELETE_INSTANCE=True was "
                                    "specified, skipping delete...")
            raise SkipTest("TESTS_DO_NOT_DELETE_INSTANCE was specified.")
        global dbaas
        if not hasattr(instance_info, "initial_result"):
            raise SkipTest("Instance was never created, skipping test...")
        # Update the report so the logs inside the instance will be saved.
        CONFIG.get_report().update()
        dbaas.instances.delete(instance_info.id)
        instance_info.deleted_at = timeutils.utcnow().isoformat()

        attempts = 0
        try:
            time.sleep(1)
            result = True
            while result is not None:
                attempts += 1
                time.sleep(1)
                result = dbaas.instances.get(instance_info.id)
                assert_equal(200, dbaas.last_http_code)
                assert_equal("SHUTDOWN", result.status)
        except exceptions.NotFound:
            pass
        except Exception as ex:
            fail("A failure occured when trying to GET instance %s for the %d"
                 " time: %s" % (str(instance_info.id), attempts, str(ex)))
开发者ID:jeredding,项目名称:trove,代码行数:30,代码来源:instances.py

示例2: resize_should_not_delete_users

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
 def resize_should_not_delete_users(self):
     """Resize should not delete users."""
     # Resize has an incredibly weird bug where users are deleted after
     # a resize. The code below is an attempt to catch this while proceeding
     # with the rest of the test (note the use of runs_after).
     if USE_IP:
         self.connection.connect()
         if not self.connection.is_connected():
             # Ok, this is def. a failure, but before we toss up an error
             # lets recreate to see how far we can get.
             CONFIG.get_report().log("Having to recreate the test_user! Resizing killed it!")
             self.log_current_users()
             self.create_user()
             fail("Somehow, the resize made the test user disappear.")
开发者ID:ReVolly,项目名称:trove,代码行数:16,代码来源:instances_actions.py

示例3: test_create

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
    def test_create(self):
        databases = []
        databases.append({"name": "firstdb", "character_set": "latin2",
                          "collate": "latin2_general_ci"})
        databases.append({"name": "db2"})
        instance_info.databases = databases
        users = []
        users.append({"name": "lite", "password": "litepass",
                      "databases": [{"name": "firstdb"}]})
        instance_info.users = users
        if VOLUME_SUPPORT:
            instance_info.volume = {'size': 1}
        else:
            instance_info.volume = None

        if create_new_instance():
            instance_info.initial_result = dbaas.instances.create(
                instance_info.name,
                instance_info.dbaas_flavor_href,
                instance_info.volume,
                databases,
                users,
                availability_zone="nova")
            assert_equal(200, dbaas.last_http_code)
        else:
            id = existing_instance()
            instance_info.initial_result = dbaas.instances.get(id)

        result = instance_info.initial_result
        instance_info.id = result.id

        report = CONFIG.get_report()
        report.log("Instance UUID = %s" % instance_info.id)
        if create_new_instance():
            assert_equal("BUILD", instance_info.initial_result.status)

        else:
            report.log("Test was invoked with TESTS_USE_INSTANCE_ID=%s, so no "
                       "instance was actually created." % id)

        # Check these attrs only are returned in create response
        expected_attrs = ['created', 'flavor', 'addresses', 'id', 'links',
                          'name', 'status', 'updated']
        if ROOT_ON_CREATE:
            expected_attrs.append('password')
        if VOLUME_SUPPORT:
            expected_attrs.append('volume')
        if CONFIG.trove_dns_support:
            expected_attrs.append('hostname')

        with CheckInstance(result._info) as check:
            if create_new_instance():
                check.attrs_exist(result._info, expected_attrs,
                                  msg="Create response")
            # Don't CheckInstance if the instance already exists.
            check.flavor()
            check.links(result._info['links'])
            if VOLUME_SUPPORT:
                check.volume()
开发者ID:jeredding,项目名称:trove,代码行数:61,代码来源:instances.py

示例4: __init__

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
 def __init__(self, sleep_time=10, timeout=1200):
     self.def_sleep_time = sleep_time
     self.def_timeout = timeout
     self.instance_info = instance_info
     self.auth_client = create_dbaas_client(self.instance_info.user)
     self.unauth_client = None
     self.report = CONFIG.get_report()
     self._test_helper = None
开发者ID:jjmob,项目名称:trove,代码行数:10,代码来源:test_runners.py

示例5: test_assign_name_to_instance_using_patch

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
 def test_assign_name_to_instance_using_patch(self):
     # test assigning a name to an instance
     new_name = 'new_name_1'
     report = CONFIG.get_report()
     report.log("instance_info.id: %s" % instance_info.id)
     report.log("instance name:%s" % instance_info.name)
     report.log("instance new name:%s" % new_name)
     instance_info.dbaas.instances.edit(instance_info.id, name=new_name)
     assert_equal(202, instance_info.dbaas.last_http_code)
     check = instance_info.dbaas.instances.get(instance_info.id)
     assert_equal(200, instance_info.dbaas.last_http_code)
     assert_equal(check.name, new_name)
     # Restore instance name
     instance_info.dbaas.instances.edit(instance_info.id,
                                        name=instance_info.name)
     assert_equal(202, instance_info.dbaas.last_http_code)
开发者ID:tangguochang,项目名称:trove,代码行数:18,代码来源:configurations.py

示例6: test_assign_config_and_name_to_instance_using_patch

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
    def test_assign_config_and_name_to_instance_using_patch(self):
        # test assigning a configuration and name to an instance
        new_name = 'new_name'
        report = CONFIG.get_report()
        report.log("instance_info.id: %s" % instance_info.id)
        report.log("configuration_info: %s" % configuration_info)
        report.log("configuration_info.id: %s" % configuration_info.id)
        report.log("instance name:%s" % instance_info.name)
        report.log("instance new name:%s" % new_name)
        saved_name = instance_info.name
        config_id = configuration_info.id
        instance_info.dbaas.instances.edit(instance_info.id,
                                           configuration=config_id,
                                           name=new_name)
        assert_equal(202, instance_info.dbaas.last_http_code)
        check = instance_info.dbaas.instances.get(instance_info.id)
        assert_equal(200, instance_info.dbaas.last_http_code)
        assert_equal(check.name, new_name)

        # restore instance name
        instance_info.dbaas.instances.edit(instance_info.id,
                                           name=saved_name)
        assert_equal(202, instance_info.dbaas.last_http_code)

        instance = instance_info.dbaas.instances.get(instance_info.id)
        assert_equal('RESTART_REQUIRED', instance.status)
        # restart to be sure configuration is applied
        instance_info.dbaas.instances.restart(instance_info.id)
        assert_equal(202, instance_info.dbaas.last_http_code)
        sleep(2)

        def result_is_active():
            instance = instance_info.dbaas.instances.get(
                instance_info.id)
            if instance.status == "ACTIVE":
                return True
            else:
                assert_equal("REBOOT", instance.status)
                return False
        poll_until(result_is_active)
        # test assigning a configuration to an instance that
        # already has an assigned configuration with patch
        config_id = configuration_info.id
        assert_raises(exceptions.BadRequest,
                      instance_info.dbaas.instances.edit,
                      instance_info.id, configuration=config_id)
开发者ID:tangguochang,项目名称:trove,代码行数:48,代码来源:configurations.py

示例7: test_instance_created

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
    def test_instance_created(self):
        # This version just checks the REST API status.
        def result_is_active():
            instance = dbaas.instances.get(instance_info.id)
            if instance.status == "ACTIVE":
                return True
            else:
                # If its not ACTIVE, anything but BUILD must be
                # an error.
                assert_equal("BUILD", instance.status)
                if instance_info.volume is not None:
                    assert_equal(instance.volume.get('used', None), None)
                return False

        poll_until(result_is_active)
        dbaas.instances.get(instance_info.id)

        report = CONFIG.get_report()
        report.log("Created an instance, ID = %s." % instance_info.id)
        report.log("TIP:")
        report.log("Rerun the tests with TESTS_USE_INSTANCE_ID=%s "
                   "to skip ahead to this point." % instance_info.id)
        report.log("Add TESTS_DO_NOT_DELETE_INSTANCE=True to avoid deleting "
                   "the instance at the end of the tests.")
开发者ID:jeredding,项目名称:trove,代码行数:26,代码来源:instances.py

示例8: log_current_users

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
 def log_current_users(self):
     users = self.dbaas.users.list(self.instance_id)
     CONFIG.get_report().log("Current user count = %d" % len(users))
     for user in users:
         CONFIG.get_report().log("\t" + str(user))
开发者ID:ReVolly,项目名称:trove,代码行数:7,代码来源:instances_actions.py

示例9: setUp

# 需要导入模块: from trove.tests.config import CONFIG [as 别名]
# 或者: from trove.tests.config.CONFIG import get_report [as 别名]
 def setUp(self):
     self.instance = instance_info
     self.rd_client = create_dbaas_client(self.instance.user)
     self.report = CONFIG.get_report()
开发者ID:magictour,项目名称:trove,代码行数:6,代码来源:pxc.py


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