Merge "Move the console tests to the other server actions tests"
diff --git a/tempest/tests/compute/servers/test_console_output.py b/tempest/tests/compute/servers/test_console_output.py
deleted file mode 100644
index 4ddbc2f..0000000
--- a/tempest/tests/compute/servers/test_console_output.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2012 OpenStack, LLC
-# All Rights Reserved.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-
-import testtools
-
-from tempest.common.utils.data_utils import rand_name
-from tempest import exceptions
-from tempest.test import attr
-from tempest.tests.compute import base
-
-
-#TODO(afazekas): move these to the server actions test
-@attr(type='smoke')
-class ConsoleOutputTestJSON(base.BaseComputeTest):
-    _interface = 'json'
-
-    @classmethod
-    def setUpClass(cls):
-        super(ConsoleOutputTestJSON, cls).setUpClass()
-        cls.name = rand_name('server')
-        resp, server = cls.servers_client.create_server(cls.name,
-                                                        cls.image_ref,
-                                                        cls.flavor_ref)
-        cls.server_id = server['id']
-
-        cls.servers_client.wait_for_server_status(cls.server_id, 'ACTIVE')
-
-    @classmethod
-    def tearDownClass(cls):
-        cls.servers_client.delete_server(cls.server_id)
-        super(ConsoleOutputTestJSON, cls).tearDownClass()
-
-    @attr(type='positive')
-    def test_get_console_output(self):
-        # Positive test:Should be able to GET the console output
-        # for a given server_id and number of lines
-        def get_output():
-            resp, output = self.servers_client.get_console_output(
-                self.server_id, 10)
-            self.assertEqual(200, resp.status)
-            self.assertNotEqual(output, None)
-            lines = len(output.split('\n'))
-            self.assertEqual(lines, 10)
-        self.wait_for(get_output)
-
-    @attr(type='negative')
-    def test_get_console_output_invalid_server_id(self):
-        # Negative test: Should not be able to get the console output
-        # for an invalid server_id
-        try:
-            resp, output = self.servers_client.get_console_output(
-                '!@#$%^&*()', 10)
-        except exceptions.NotFound:
-            pass
-
-    @attr(type='positive')
-    @testtools.skip('Until tempest bug 1014683 is fixed.')
-    def test_get_console_output_server_id_in_reboot_status(self):
-        # Positive test:Should be able to GET the console output
-        # for a given server_id in reboot status
-        try:
-            resp, output = self.servers_client.reboot(self.server_id, 'SOFT')
-            self.servers_client.wait_for_server_status(self.server_id,
-                                                       'REBOOT')
-            resp, server = self.servers_client.get_server(self.server_id)
-            if (server['status'] == 'REBOOT'):
-                resp, output = self.servers_client.get_console_output(
-                    self.server_id, 10)
-                self.assertEqual(200, resp.status)
-                self.assertNotEqual(output, None)
-                lines = len(output.split('\n'))
-                self.assertEqual(lines, 10)
-            else:
-                self.fail("Could not capture instance in Reboot status")
-        finally:
-            self.servers_client.wait_for_server_status(self.server_id,
-                                                       'ACTIVE')
-
-
-@attr(type='smoke')
-class ConsoleOutputTestXML(ConsoleOutputTestJSON):
-    _interface = 'xml'
diff --git a/tempest/tests/compute/servers/test_server_actions.py b/tempest/tests/compute/servers/test_server_actions.py
index a9ada39..bc8e843 100644
--- a/tempest/tests/compute/servers/test_server_actions.py
+++ b/tempest/tests/compute/servers/test_server_actions.py
@@ -35,6 +35,8 @@
     run_ssh = tempest.config.TempestConfig().compute.run_ssh
 
     def setUp(self):
+        #NOTE(afazekas): Normally we use the same server with all test cases,
+        # but if it has an issue, we build a new one
         super(ServerActionsTestJSON, self).setUp()
         # Check if the server is in a clean state after test
         try:
@@ -208,18 +210,48 @@
         file_contents = 'Test server rebuild.'
         personality = [{'path': '/etc/rebuild.txt',
                         'contents': base64.b64encode(file_contents)}]
-        try:
-            resp, rebuilt_server = self.client.rebuild(999,
-                                                       self.image_ref_alt,
-                                                       name=new_name,
-                                                       meta=meta,
-                                                       personality=personality,
-                                                       adminPass='rebuild')
-        except exceptions.NotFound:
-            pass
-        else:
-            self.fail('The server rebuild for a non existing server should not'
-                      ' be allowed')
+        self.assertRaises(exceptions.NotFound,
+                          self.client.rebuild,
+                          999, self.image_ref_alt,
+                          name=new_name, meta=meta,
+                          personality=personality,
+                          adminPass='rebuild')
+
+    @attr(type='positive')
+    def test_get_console_output(self):
+        # Positive test:Should be able to GET the console output
+        # for a given server_id and number of lines
+        def get_output():
+            resp, output = self.servers_client.get_console_output(
+                self.server_id, 10)
+            self.assertEqual(200, resp.status)
+            self.assertNotEqual(output, None)
+            lines = len(output.split('\n'))
+            self.assertEqual(lines, 10)
+        self.wait_for(get_output)
+
+    @attr(type='negative')
+    def test_get_console_output_invalid_server_id(self):
+        # Negative test: Should not be able to get the console output
+        # for an invalid server_id
+        self.assertRaises(exceptions.NotFound,
+                          self.servers_client.get_console_output,
+                          '!@#$%^&*()', 10)
+
+    @attr(type='positive')
+    @testtools.skip('Until tempest bug 1014683 is fixed.')
+    def test_get_console_output_server_id_in_reboot_status(self):
+        # Positive test:Should be able to GET the console output
+        # for a given server_id in reboot status
+        resp, output = self.servers_client.reboot(self.server_id, 'SOFT')
+        self.servers_client.wait_for_server_status(self.server_id,
+                                                   'REBOOT')
+        resp, output = self.servers_client.get_console_output(self.server_id,
+                                                              10)
+        self.assertEqual(200, resp.status)
+        self.assertNotEqual(output, None)
+        lines = len(output.split('\n'))
+        self.assertEqual(lines, 10)
 
     @classmethod
     def rebuild_servers(cls):