summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgord chung <gord@live.ca>2016-12-14 22:26:50 +0000
committergord chung <gord@live.ca>2016-12-15 23:47:18 +0000
commit25a5500c7dcf4d6d7b32d97f99def4f6844f2c37 (patch)
tree73c013371438a8c65889d8e75bcad3cff8fdb4b3
parent10639a4299fdedbb8b6dcd5e82e795d573edb6d0 (diff)
downloadceilometer-25a5500c7dcf4d6d7b32d97f99def4f6844f2c37.tar.gz
fix mitaka gate grab bag
Since I84e3be748af10b158037866e1ee4c1375b2c3541, the internal method _error_checker() is changed and the ceilometer gate is broken. This patch fixes it. (cherry picked from commit e6ff08801ca34536680b43ca896f0dfdf66c761f) something changed and expected logs are in stdout rather than stderr even though it does makes sense as stdout. i have no idea why it was writing to stderr earlier when it shouldn't have. Related-Bug: #1635042 (cherry picked from commit 1695b4774e69e032151a47e0435b7af72826e5b6) The API changed and the Ceilometer driver does not work anymore with it. Related-Bug: #1613419 (cherry picked from commit 2b6fb87180dbedcd0a60323b587ecd8eec535d7b) Change-Id: Ifaa1e02f5bc30725124d581c9127713260f755dc
-rw-r--r--ceilometer/tests/functional/test_bin.py28
-rwxr-xr-xceilometer/tests/integration/hooks/post_test_hook.sh1
-rw-r--r--ceilometer/tests/tempest/service/images/v1/images_client.py6
-rw-r--r--test-requirements.txt2
4 files changed, 22 insertions, 15 deletions
diff --git a/ceilometer/tests/functional/test_bin.py b/ceilometer/tests/functional/test_bin.py
index 3339922b..9d5e3cd4 100644
--- a/ceilometer/tests/functional/test_bin.py
+++ b/ceilometer/tests/functional/test_bin.py
@@ -14,6 +14,7 @@
import os
import subprocess
+import time
from oslo_utils import fileutils
import six
@@ -47,13 +48,13 @@ class BinTestCase(base.BaseTestCase):
subp = subprocess.Popen(['ceilometer-expirer',
'-d',
"--config-file=%s" % self.tempfile],
- stderr=subprocess.PIPE)
- __, err = subp.communicate()
+ stdout=subprocess.PIPE)
+ stdout, __ = subp.communicate()
self.assertEqual(0, subp.poll())
self.assertIn(b"Nothing to clean, database metering "
- b"time to live is disabled", err)
+ b"time to live is disabled", stdout)
self.assertIn(b"Nothing to clean, database event "
- b"time to live is disabled", err)
+ b"time to live is disabled", stdout)
def _test_run_expirer_ttl_enabled(self, ttl_name, data_name):
content = ("[DEFAULT]\n"
@@ -69,13 +70,13 @@ class BinTestCase(base.BaseTestCase):
subp = subprocess.Popen(['ceilometer-expirer',
'-d',
"--config-file=%s" % self.tempfile],
- stderr=subprocess.PIPE)
- __, err = subp.communicate()
+ stdout=subprocess.PIPE)
+ stdout, __ = subp.communicate()
self.assertEqual(0, subp.poll())
msg = "Dropping %s data with TTL 1" % data_name
if six.PY3:
msg = msg.encode('utf-8')
- self.assertIn(msg, err)
+ self.assertIn(msg, stdout)
def test_run_expirer_ttl_enabled(self):
self._test_run_expirer_ttl_enabled('metering_time_to_live',
@@ -141,9 +142,16 @@ class BinCeilometerPollingServiceTestCase(base.BaseTestCase):
"compute",
"compute"],
stderr=subprocess.PIPE)
- out = self.subp.stderr.read(1024)
- self.assertIn(b'Duplicated values: [\'compute\', \'compute\'] '
- b'found in CLI options, auto de-duplicated', out)
+ expected = (b'Duplicated values: [\'compute\', \'compute\'] '
+ b'found in CLI options, auto de-duplicated')
+ # NOTE(gordc): polling process won't quit so wait for a bit and check
+ start = time.time()
+ while time.time() - start < 5:
+ output = self.subp.stderr.readline()
+ if expected in output:
+ break
+ else:
+ self.fail('Did not detect expected warning: %s' % expected)
def test_polling_namespaces_invalid_value_in_config(self):
content = ("[DEFAULT]\n"
diff --git a/ceilometer/tests/integration/hooks/post_test_hook.sh b/ceilometer/tests/integration/hooks/post_test_hook.sh
index 898524ed..a25a8324 100755
--- a/ceilometer/tests/integration/hooks/post_test_hook.sh
+++ b/ceilometer/tests/integration/hooks/post_test_hook.sh
@@ -55,6 +55,7 @@ EXIT_CODE=$?
echo "* Message queue status:"
sudo rabbitmqctl list_queues | grep -e \\.sample -e \\.info
+sudo rabbitmqctl list_consumers
if [ $EXIT_CODE -ne 0 ] ; then
set +x
diff --git a/ceilometer/tests/tempest/service/images/v1/images_client.py b/ceilometer/tests/tempest/service/images/v1/images_client.py
index e9ca637d..2c304515 100644
--- a/ceilometer/tests/tempest/service/images/v1/images_client.py
+++ b/ceilometer/tests/tempest/service/images/v1/images_client.py
@@ -112,8 +112,7 @@ class ImagesClient(rest_client.RestClient):
def _create_with_data(self, headers, data):
resp, body_iter = self.http.raw_request('POST', '/v1/images',
headers=headers, body=data)
- self._error_checker('POST', '/v1/images', headers, data, resp,
- body_iter)
+ self._error_checker(resp, body_iter)
body = json.loads(''.join([c for c in body_iter]))
return rest_client.ResponseBody(resp, body)
@@ -121,8 +120,7 @@ class ImagesClient(rest_client.RestClient):
url = '/v1/images/%s' % image_id
resp, body_iter = self.http.raw_request('PUT', url, headers=headers,
body=data)
- self._error_checker('PUT', url, headers, data,
- resp, body_iter)
+ self._error_checker(resp, body_iter)
body = json.loads(''.join([c for c in body_iter]))
return rest_client.ResponseBody(resp, body)
diff --git a/test-requirements.txt b/test-requirements.txt
index 3ddf02b3..522f2611 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -9,7 +9,7 @@ contextlib2>=0.4.0 # PSF License
coverage>=3.6 # Apache-2.0
elasticsearch<2.0,>=1.3.0 # Apache-2.0
fixtures<2.0,>=1.3.1 # Apache-2.0/BSD
-happybase!=0.7,>=0.5;python_version=='2.7' # MIT
+happybase!=0.7,>=0.5,<1.0.0;python_version=='2.7' # MIT
mock>=1.2 # BSD
PyMySQL>=0.6.2 # MIT License
os-win>=0.2.3 # Apache-2.0