Merge "Make volume attach and detach rescue tests negative."
diff --git a/HACKING.rst b/HACKING.rst
index a546f8c..eafa81b 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -153,6 +153,19 @@
kwarg2=dict_of_numbers)
+Test Skips
+----------
+If a test is broken because of a bug it is appropriate to skip the test until
+bug has been fixed. However, the skip message should be formatted so that
+Tempest's skip tracking tool can watch the bug status. The skip message should
+contain the string 'Bug' immediately followed by a space. Then the bug number
+should be included in the message '#' in front of the number.
+
+Example::
+
+ @testtools.skip("Skipped until the Bug #980688 is resolved")
+
+
openstack-common
----------------
diff --git a/cli/__init__.py b/cli/__init__.py
index 6ffe229..5d986c0 100644
--- a/cli/__init__.py
+++ b/cli/__init__.py
@@ -60,10 +60,11 @@
return self.cmd_with_auth(
'nova', action, flags, params, admin, fail_ok)
- def nova_manage(self, action, flags='', params='', fail_ok=False):
+ def nova_manage(self, action, flags='', params='', fail_ok=False,
+ merge_stderr=False):
"""Executes nova-manage command for the given action."""
return self.cmd(
- 'nova-manage', action, flags, params, fail_ok)
+ 'nova-manage', action, flags, params, fail_ok, merge_stderr)
def keystone(self, action, flags='', params='', admin=True, fail_ok=False):
"""Executes keystone command for the given action."""
@@ -81,14 +82,19 @@
flags = creds + ' ' + flags
return self.cmd(cmd, action, flags, params, fail_ok)
- def cmd(self, cmd, action, flags='', params='', fail_ok=False):
+ def cmd(self, cmd, action, flags='', params='', fail_ok=False,
+ merge_stderr=False):
"""Executes specified command for the given action."""
cmd = ' '.join([CONF.cli.cli_dir + cmd,
flags, action, params])
LOG.info("running: '%s'" % cmd)
cmd = shlex.split(cmd)
try:
- result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ if merge_stderr:
+ result = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ else:
+ devnull = open('/dev/null', 'w')
+ result = subprocess.check_output(cmd, stderr=devnull)
except subprocess.CalledProcessError, e:
LOG.error("command output:\n%s" % e.output)
raise
diff --git a/cli/simple_read_only/test_compute_manage.py b/cli/simple_read_only/test_compute_manage.py
index 5768c74..650ef10 100644
--- a/cli/simple_read_only/test_compute_manage.py
+++ b/cli/simple_read_only/test_compute_manage.py
@@ -50,9 +50,11 @@
self.nova_manage('', '-h')
def test_version_flag(self):
- self.assertNotEqual("", self.nova_manage('', '--version'))
+ # Bug 1159957: nova-manage --version writes to stderr
+ self.assertNotEqual("", self.nova_manage('', '--version',
+ merge_stderr=True))
self.assertEqual(self.nova_manage('version'),
- self.nova_manage('', '--version'))
+ self.nova_manage('', '--version', merge_stderr=True))
def test_debug_flag(self):
self.assertNotEqual("", self.nova_manage('instance_type list',
@@ -68,8 +70,8 @@
def test_flavor_list(self):
self.assertNotEqual("", self.nova_manage('flavor list'))
- self.assertNotEqual(self.nova_manage('instance_type list'),
- self.nova_manage('flavor list'))
+ self.assertEqual(self.nova_manage('instance_type list'),
+ self.nova_manage('flavor list'))
def test_db_archive_deleted_rows(self):
# make sure command doesn't error out
diff --git a/tools/hacking.py b/tools/hacking.py
index 617682d..528424a 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -323,6 +323,30 @@
return (pos, "T404: test functions must "
"not have doc strings")
+SKIP_DECORATOR = '@testtools.skip('
+
+
+def tempest_skip_bugs(physical_line):
+ """Check skip lines for proper bug entries
+
+ T601: Bug not in skip line
+ T602: Bug in message formatted incorrectly
+ """
+
+ pos = physical_line.find(SKIP_DECORATOR)
+
+ skip_re = re.compile(r'^\s*@testtools.skip.*')
+
+ if pos != -1 and skip_re.match(physical_line):
+ bug = re.compile(r'^.*\bbug\b.*', re.IGNORECASE)
+ if bug.match(physical_line) is None:
+ return (pos, 'T601: skips must have an associated bug')
+
+ bug_re = re.compile(r'.*skip\(.*Bug\s\#\d+', re.IGNORECASE)
+
+ if bug_re.match(physical_line) is None:
+ return (pos, 'T602: Bug number formatted incorrectly')
+
FORMAT_RE = re.compile("%(?:"
"%|" # Ignore plain percents