コード例 #1
0
 def test_specify_version_by_deployment_with_existing_users(self):
     rally = utils.Rally()
     deployment = json.loads(rally("deployment config"))
     deployment["openstack"]["users"] = [deployment["openstack"]["admin"]]
     deployment["openstack"]["api_info"] = {
         "fakedummy": {
             "version": "2",
             "service_type": "dummyv2"
         }
     }
     deployment = utils.JsonTempFile(deployment)
     rally("deployment create --name t_create_with_api_info "
           "--filename %s" % deployment.filename)
     self.assertIn("t_create_with_api_info", rally("deployment list"))
     config = {
         "FakeDummy.openstack_api": [{
             "runner": {
                 "type": "constant",
                 "times": 1,
                 "concurrency": 1
             }
         }]
     }
     config = utils.TaskConfig(config)
     plugins = "tests/functional/extra/fake_dir/fake_plugin.py"
     rally("--plugin-paths %s task start --task %s" %
           (plugins, config.filename))
コード例 #2
0
    def test_check_debug(self):
        rally = utils.Rally()
        rally.env.update(TEST_ENV)
        rally("deployment create --name t_create_env --fromenv")
        config = rally("deployment config", getjson=True)
        config["openstack"]["admin"]["password"] = "******"
        file = utils.JsonTempFile(config)
        rally("deployment create --name t_create_file_debug "
              "--filename %s" % file.filename)
        self.assertIn("t_create_file_debug", rally("deployment list"))
        self.assertEqual(config, rally("deployment config", getjson=True))
        self.assertRaises(utils.RallyCliError, rally, "deployment check")

        try:
            rally("--debug deployment check")
        except utils.RallyCliError as e:
            self.assertIn(
                "[-] Unable to authenticate for user %(username)s in"
                " project %(tenant_name)s" % {
                    "username": TEST_ENV["OS_USERNAME"],
                    "tenant_name": TEST_ENV["OS_TENANT_NAME"]
                }, str(e))
            self.assertIn(
                "AuthenticationFailed: Failed to authenticate to %(auth_url)s"
                " for user '%(username)s' in project '%(tenant_name)s'" % {
                    "auth_url": TEST_ENV["OS_AUTH_URL"],
                    "username": TEST_ENV["OS_USERNAME"],
                    "tenant_name": TEST_ENV["OS_TENANT_NAME"]
                }, str(e))
        else:
            self.fail("rally deployment fails to raise error for wrong"
                      " authentication info")
コード例 #3
0
 def test_recreate_from_file(self):
     self.rally.env.update(utils.TEST_ENV)
     self.rally("deployment create --name t_create_env --fromenv")
     config = json.loads(self.rally("deployment config"))
     config["auth_url"] = "http://foo/"
     file = utils.JsonTempFile(config)
     self.rally("deployment recreate --deployment t_create_env "
                "--filename %s" % file.filename)
     self.assertIn("t_create_env", self.rally("deployment list"))
     self.assertEqual(config, json.loads(self.rally("deployment config")))
コード例 #4
0
 def test_create_env_with_https_cert_https_key(self):
     rally = utils.Rally()
     fake_spec = copy.deepcopy(rally.env_spec)
     fake_spec["existing@openstack"]["https_cert"] = ""
     fake_spec["existing@openstack"]["https_key"] = ""
     spec = utils.JsonTempFile(fake_spec)
     rally("env create --name t_create_env --spec %s" % spec.filename)
     config = rally("env show --only-spec", getjson=True)
     self.assertIn("https_cert", config["existing@openstack"].keys())
     self.assertIn("https_key", config["existing@openstack"].keys())
     rally("env check")
     rally("env info")
コード例 #5
0
 def test_check_api_info_success(self):
     rally = utils.Rally()
     spec = copy.deepcopy(rally.env_spec)
     spec["existing@openstack"]["api_info"] = {
         "fakedummy": {
             "version": "2",
             "service_type": "dummyv2"
         }
     }
     spec = utils.JsonTempFile(spec)
     rally("env create --name t_create_env_with_api_info"
           " --spec %s" % spec.filename)
     plugings = "tests/functional/extra/fake_dir/fake_plugin.py"
     rally("--plugin-paths %s env check" % plugings)
コード例 #6
0
 def test_check_api_info_fail_2(self):
     rally = utils.Rally()
     spec = copy.deepcopy(rally.env_spec)
     spec["existing@openstack"]["api_info"] = {
         "noneclient": {
             "version": "1",
             "service_type": "none"
         }
     }
     spec = utils.JsonTempFile(spec)
     rally("env create --name t_create_env_with_api_info"
           " --spec %s" % spec.filename)
     try:
         plugings = "tests/functional/extra/fake_dir/fake_plugin.py"
         rally("--plugin-paths %s env check" % plugings)
     except utils.RallyCliError as e:
         self.assertIn("There is no OSClient plugin 'noneclient'", e.output)
コード例 #7
0
 def test_check_api_info_fail_1(self):
     rally = utils.Rally()
     spec = copy.deepcopy(rally.env_spec)
     spec["existing@openstack"]["api_info"] = {
         "fakedummy": {
             "version": "3",
             "service_type": "dummyv2"
         }
     }
     spec = utils.JsonTempFile(spec)
     rally("env create --name t_create_env_with_api_info"
           " --spec %s" % spec.filename)
     try:
         plugings = "tests/functional/extra/fake_dir/fake_plugin.py"
         rally("--plugin-paths %s env check" % plugings)
     except utils.RallyCliError as e:
         self.assertIn("Invalid setting for 'fakedummy':", e.output)
コード例 #8
0
 def test_check_debug(self):
     rally = utils.Rally()
     rally.env.update(TEST_ENV)
     rally("deployment create --name t_create_env --fromenv")
     config = rally("deployment config", getjson=True)
     config["openstack"]["admin"]["password"] = "******"
     file = utils.JsonTempFile(config)
     rally("deployment create --name t_create_file_debug "
           "--filename %s" % file.filename)
     self.assertIn("t_create_file_debug", rally("deployment list"))
     self.assertEqual(config, rally("deployment config", getjson=True))
     e = self.assertRaises(utils.RallyCliError, rally,
                           "--debug deployment check")
     self.assertIn(
         "AuthenticationFailed: Could not find versioned identity "
         "endpoints when attempting to authenticate.",
         e.output)
コード例 #9
0
    def test_check_wrong_password(self):
        rally = utils.Rally(config_opts=RALLY_OPTS)
        fake_spec = copy.deepcopy(rally.env_spec)
        fake_spec["existing@openstack"]["admin"]["password"] = "******"
        spec = utils.JsonTempFile(fake_spec)
        rally("env create --name t_create_env --spec %s" % spec.filename)

        try:
            rally("env check")
        except utils.RallyCliError as e:
            line = ("| :-(       | openstack | Failed to authenticate to "
                    "%s for user '%s' in project '%s': The request you have "
                    "made requires authentication. |" %
                    (fake_spec["existing@openstack"]["auth_url"],
                     fake_spec["existing@openstack"]["admin"]["username"],
                     fake_spec["existing@openstack"]["admin"]["project_name"]))
            self.assertIn(line, e.output.split("\n"))
        else:
            self.fail("Check env command should fail!")
コード例 #10
0
    def test_check_wrong_url(self):
        rally = utils.Rally(config_opts=RALLY_OPTS)
        fake_spec = copy.deepcopy(rally.env_spec)
        fake_spec["existing@openstack"]["auth_url"] = "http://example.com:5000"
        spec = utils.JsonTempFile(fake_spec)
        rally("env create --name t_create_env --spec %s" % spec.filename)

        try:
            rally("env check")
        except utils.RallyCliError as e:
            output = e.output.split("\n")
            line_template = "| :-(       | openstack | %s |"
            err1 = "Unable to establish connection to http://example.com:5000"
            err2 = "Request to http://example.com:5000 timed out"
            if (line_template % err1 not in output
                    and line_template % err2 not in output):
                self.fail("The output of `env check` doesn't contain expected"
                          " error. Output:\n" % e.output)
        else:
            self.fail("Check env command should fail!")
コード例 #11
0
    def test_check_debug(self):
        rally = utils.Rally()
        rally.env.update(TEST_ENV)
        rally("deployment create --name t_create_env --fromenv")
        config = rally("deployment config", getjson=True)
        config["openstack"]["admin"]["password"] = "******"
        file = utils.JsonTempFile(config)
        rally("deployment create --name t_create_file_debug "
              "--filename %s" % file.filename)
        self.assertIn("t_create_file_debug", rally("deployment list"))
        self.assertEqual(config, rally("deployment config", getjson=True))
        self.assertRaises(utils.RallyCliError, rally, "deployment check")

        try:
            rally("--debug deployment check")
        except utils.RallyCliError as e:
            self.assertIn(
                "AuthenticationFailed: Unable to establish connection to "
                "%s" % TEST_ENV["OS_AUTH_URL"],
                str(e))
        else:
            self.fail("rally deployment fails to raise error for wrong"
                      " authentication info")