aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/env.py4
-rw-r--r--functest/utils/functest_utils.py8
-rw-r--r--functest/utils/openstack_utils.py8
3 files changed, 12 insertions, 8 deletions
diff --git a/functest/utils/env.py b/functest/utils/env.py
index c9629e15..3724ec99 100644
--- a/functest/utils/env.py
+++ b/functest/utils/env.py
@@ -15,7 +15,9 @@ default_envs = {
'INSTALLER_IP': None,
'BUILD_TAG': None,
'OS_ENDPOINT_TYPE': None,
- 'OS_AUTH_URL': None
+ 'OS_AUTH_URL': None,
+ 'CONFIG_FUNCTEST_YAML': os.path.normpath(os.path.join(os.path.dirname(
+ os.path.abspath(__file__)), '../ci/config_functest.yaml'))
}
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index bf30f56e..dc20eea1 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -24,6 +24,7 @@ from six.moves import urllib
import yaml
from git import Repo
+from functest.utils import constants
from functest.utils import decorators
logger = logging.getLogger(__name__)
@@ -220,7 +221,8 @@ def push_results_to_db(project, case_name,
error = None
headers = {'Content-Type': 'application/json'}
try:
- r = requests.post(url, data=json.dumps(params), headers=headers)
+ r = requests.post(url, data=json.dumps(params, sort_keys=True),
+ headers=headers)
logger.debug(r)
r.raise_for_status()
except requests.RequestException as exc:
@@ -375,7 +377,7 @@ def get_parameter_from_yaml(parameter, file):
def get_functest_config(parameter):
- yaml_ = os.environ["CONFIG_FUNCTEST_YAML"]
+ yaml_ = constants.CONST.__getattribute__('CONFIG_FUNCTEST_YAML')
return get_parameter_from_yaml(parameter, yaml_)
@@ -397,7 +399,7 @@ def get_testcases_file_dir():
def get_functest_yaml():
- with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
+ with open(constants.CONST.__getattribute__('CONFIG_FUNCTEST_YAML')) as f:
functest_yaml = yaml.safe_load(f)
f.close()
return functest_yaml
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 8bd95052..57a2aa2b 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -1081,10 +1081,10 @@ def check_security_group_rules(neutron_client, sg_id, direction, protocol,
try:
security_rules = get_security_group_rules(neutron_client, sg_id)
security_rules = [rule for rule in security_rules
- if (rule["direction"].lower() == direction
- and rule["protocol"].lower() == protocol
- and rule["port_range_min"] == port_min
- and rule["port_range_max"] == port_max)]
+ if (rule["direction"].lower() == direction and
+ rule["protocol"].lower() == protocol and
+ rule["port_range_min"] == port_min and
+ rule["port_range_max"] == port_max)]
if len(security_rules) == 0:
return True
else: