[Verify] The latest cleanup before new release

1. Small bugs were fixed.
2. Missing doc strings were added.
3. Now verifier cannot have 'configuring' and 'configured' statuses.
   It was done to support work with a few deployments.

Change-Id: I064e863f7597c015e8a8f7c64a4d3049d6baac95
This commit is contained in:
Yaroslav Lobankov 2017-01-18 20:36:52 +04:00
parent ae54f08fa1
commit 067d07b684
4 changed files with 21 additions and 9 deletions

View File

@ -43,13 +43,13 @@ _rally()
OPTS["task_use"]="--uuid"
OPTS["task_validate"]="--deployment --task --task-args --task-args-file"
OPTS["verify_add-verifier-ext"]="--id --source --version --extra-settings"
OPTS["verify_configure-verifier"]="--verifier-id --deployment-id --reconfigure --force --extend --override --show"
OPTS["verify_configure-verifier"]="--id --deployment-id --reconfigure --extend --override --show"
OPTS["verify_create-verifier"]="--name --type --namespace --source --version --system-wide --extra-settings --no-use"
OPTS["verify_delete"]="--uuid"
OPTS["verify_delete-verifier"]="--verifier-id --deployment-id --force"
OPTS["verify_delete-verifier"]="--id --deployment-id --force"
OPTS["verify_delete-verifier-ext"]="--id --name"
OPTS["verify_import"]="--verifier-id --deployment-id --file --run-args --no-use"
OPTS["verify_list"]="--verifier-id --deployment-id --status"
OPTS["verify_import"]="--id --deployment-id --file --run-args --no-use"
OPTS["verify_list"]="--id --deployment-id --status"
OPTS["verify_list-plugins"]="--namespace"
OPTS["verify_list-verifier-exts"]="--id"
OPTS["verify_list-verifier-tests"]="--id --pattern"
@ -57,7 +57,7 @@ _rally()
OPTS["verify_report"]="--uuid --type --to --open"
OPTS["verify_rerun"]="--uuid --deployment-id --failed"
OPTS["verify_show"]="--uuid --sort-by --detailed"
OPTS["verify_start"]="--verifier-id --deployment-id --pattern --concurrency --load-list --skip-list --xfail-list --no-use"
OPTS["verify_start"]="--id --deployment-id --pattern --concurrency --load-list --skip-list --xfail-list --no-use"
OPTS["verify_update-verifier"]="--id --update-venv --version --system-wide --no-system-wide"
OPTS["verify_use"]="--uuid"
OPTS["verify_use-verifier"]="--id"

View File

@ -198,8 +198,6 @@ class _VerifierStatus(utils.ImmutableMixin, utils.EnumMixin):
INSTALLED = "installed"
UPDATING = "updating"
EXTENDING = "extending"
CONFIGURING = "configuring"
CONFIGURED = "configured"
FAILED = "failed"

View File

@ -53,22 +53,31 @@ class TempestManager(testr.TestrLauncher):
return os.path.join(self.home_dir, "tempest.conf")
def get_configuration(self):
"""Get Tempest configuration."""
return config.read_configfile(self.configfile)
def configure(self, extra_options=None):
"""Configure Tempest."""
if not os.path.isdir(self.home_dir):
os.makedirs(self.home_dir)
cm = config.TempestConfigfileManager(self.verifier.deployment)
raw_configfile = cm.create(self.configfile, extra_options)
return raw_configfile
def is_configured(self):
"""Check whether Tempest is configured or not."""
return os.path.exists(self.configfile)
def extend_configuration(self, extra_options):
"""Extend Tempest configuration with extra options."""
return config.extend_configfile(self.configfile, extra_options)
def override_configuration(self, new_content):
def override_configuration(self, new_configuration):
"""Override Tempest configuration by new configuration."""
with open(self.configfile, "w") as f:
f.write(new_content)
f.write(new_configuration)
def install_extension(self, source, version=None, extra_settings=None):
"""Install a Tempest plugin."""

View File

@ -62,6 +62,11 @@ class TempestManagerTestCase(test.TestCase):
tempest.verifier.deployment)
cm.create.assert_called_once_with(tempest.configfile, extra_options)
@mock.patch("%s.config.os.path.exists" % PATH)
def test_is_configured(self, mock_exists):
tempest = manager.TempestManager(mock.MagicMock(uuid="uuuiiiddd"))
self.assertTrue(tempest.is_configured())
@mock.patch("%s.config.extend_configfile" % PATH)
def test_extend_configuration(self, mock_extend_configfile):
tempest = manager.TempestManager(mock.MagicMock(uuid="uuuiiiddd"))