From 823e1992b410f39a8d1a820509cb1d464e40a0ee Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Thu, 26 Mar 2015 16:58:09 +0000 Subject: [PATCH] Stop using PYTHONHASHSEED=0 in ceilometer tests Otherwise we have tests that rely on ordering (for example the one fixed in this patchset). Note that this moves the hash seed setting to only be used in docs and venv tox targets. For some reason there is an issue in the tooling used by the docs build that tickles a bug in those tools. Tools which are not part of Ceilometer. To avoid tickling the problem and to move ceilometer along on this bug, we're just going to mask that. The venv target is used by the jenkins job that builds docs. It runs the same build_sphinx setup.py target that the docs target does. Change-Id: If93ec7934ad59515b821f056ca534d3676ee7e03 Closes-Bug: #1348818 --- ceilometer/tests/api/v2/test_alarm_scenarios.py | 11 ++++++++--- tox.ini | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ceilometer/tests/api/v2/test_alarm_scenarios.py b/ceilometer/tests/api/v2/test_alarm_scenarios.py index f03416780..c895b1540 100644 --- a/ceilometer/tests/api/v2/test_alarm_scenarios.py +++ b/ceilometer/tests/api/v2/test_alarm_scenarios.py @@ -914,9 +914,14 @@ class TestAlarms(v2.FunctionalTest, status=400, headers=self.auth_headers) alarms = list(self.alarm_conn.get_alarms()) self.assertEqual(7, len(alarms)) - self.assertEqual('threshold_rule and combination_rule cannot ' - 'be set at the same time', - resp.json['error_message']['faultstring']) + + # threshold_rule and combination_rule order is not + # predictable so it is not possible to do an exact match + # here + error_faultstring = resp.json['error_message']['faultstring'] + for expected_string in ['threshold_rule', 'combination_rule', + 'cannot be set at the same time']: + self.assertIn(expected_string, error_faultstring) def test_post_invalid_alarm_timestamp_in_threshold_rule(self): date_time = datetime.datetime(2012, 7, 2, 10, 41) diff --git a/tox.ini b/tox.ini index 9db7fd571..537926853 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,6 @@ install_command = pip install -U {opts} {packages} usedevelop = True setenv = VIRTUAL_ENV={envdir} EVENTLET_NO_GREENDNS=yes - PYTHONHASHSEED=0 commands = bash -x {toxinidir}/setup-test-env-mongodb.sh python setup.py testr --slowest --testr-args="{posargs}" downloadcache = {toxworkdir}/_download @@ -72,12 +71,14 @@ commands = [testenv:docs] commands = python setup.py build_sphinx +setenv = PYTHONHASHSEED=0 [testenv:pylint] commands = bash tools/lintstack.sh [testenv:venv] commands = {posargs} +setenv = PYTHONHASHSEED=0 [testenv:debug] commands = bash -x {toxinidir}/setup-test-env-mongodb.sh oslo_debug_helper {posargs}