Switch task parser to custom yaml

1.Switch task parser to custom yaml, custom yaml deprecates duplicate key
and loads task in the same order as they are in task file.
2.Remove duplicate scenario KeystoneBasic.create_delete_user.

Change-Id: I3b338f63eca0ac217a6376f6d6705da69fb97e80
This commit is contained in:
chenhb-zte 2017-02-03 09:14:31 +08:00
parent 5d4eade920
commit 840b5072a1
7 changed files with 7 additions and 40 deletions

View File

@ -197,17 +197,6 @@
failure_rate:
max: 0
KeystoneBasic.create_delete_user:
-
args: {}
runner:
type: "constant"
times: 10
concurrency: 10
sla:
failure_rate:
max: 0
KeystoneBasic.create_and_delete_service:
-
runner:

View File

@ -116,17 +116,6 @@
failure_rate:
max: 0
KeystoneBasic.create_delete_user:
-
args: {}
runner:
type: "constant"
times: 1
concurrency: 1
sla:
failure_rate:
max: 0
HeatStacks.create_and_list_stack:
-
args:

View File

@ -197,17 +197,6 @@
failure_rate:
max: 0
KeystoneBasic.create_delete_user:
-
args: {}
runner:
type: "constant"
times: 10
concurrency: 10
sla:
failure_rate:
max: 0
KeystoneBasic.create_and_delete_service:
-
runner:

View File

@ -26,7 +26,6 @@ import jsonschema
from oslo_utils import uuidutils
import six
from six.moves.urllib import parse as urlparse
import yaml
from rally.cli import cliutils
from rally.cli import envutils
@ -36,6 +35,7 @@ from rally.common.io import junit
from rally.common import logging
from rally.common import utils as rutils
from rally.common import version
from rally.common import yamlutils as yaml
from rally import consts
from rally import exceptions
from rally import plugins
@ -80,7 +80,7 @@ class TaskCommands(object):
try:
kw = args and yaml.safe_load(args)
kw = {} if kw is None else kw
except yaml.parser.ParserError as e:
except yaml.ParserError as e:
print_invalid_header(src_name, args)
print(_("%(source)s has to be YAML or JSON. Details:"
"\n\n%(err)s\n")

View File

@ -75,12 +75,12 @@ class BaseContext(plugin.Plugin, functional.FunctionalMixin,
# NOTE(amaretskiy): self.config is a constant data and must be
# immutable or write-protected type to prevent
# unexpected changes in runtime
if type(config) == dict:
if isinstance(config, dict):
if hasattr(self, "DEFAULT_CONFIG"):
for key, value in self.DEFAULT_CONFIG.items():
config.setdefault(key, value)
self.config = utils.LockedDict(config)
elif type(config) == list:
elif isinstance(config, list):
self.config = tuple(config)
else:
# NOTE(amaretskiy): It is improbable that config can be a None,

View File

@ -21,10 +21,10 @@ import re
from glanceclient import exc as glance_exc
from novaclient import exceptions as nova_exc
import six
import yaml
from rally.common.i18n import _
from rally.common import objects
from rally.common import yamlutils as yaml
from rally import consts
from rally import exceptions
from rally import osclients
@ -171,7 +171,7 @@ def file_exists(config, clients, deployment, param_name, mode=os.R_OK,
def check_command_dict(command):
"""Check command-specifying dict `command', raise ValueError on error."""
if type(command) != dict:
if not isinstance(command, dict):
raise ValueError("Command must be a dictionary")
# NOTE(pboldin): Here we check for the values not for presence of the keys

View File

@ -923,7 +923,7 @@ class ValidatorsTestCase(test.TestCase):
valid)
@mock.patch(
"yaml.safe_load",
"rally.common.yamlutils.safe_load",
return_value={
"version": "2.0",
"name": "wb",