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):
diff --git a/tempest/tests/compute/servers/test_server_metadata.py b/tempest/tests/compute/servers/test_server_metadata.py
index 6958a7d..cdfe2f1 100644
--- a/tempest/tests/compute/servers/test_server_metadata.py
+++ b/tempest/tests/compute/servers/test_server_metadata.py
@@ -28,7 +28,11 @@
     def setUpClass(cls):
         super(ServerMetadataTest, cls).setUpClass()
         cls.client = cls.servers_client
-
+        cls.quotas = cls.quotas_client
+        cls.admin_client = cls._get_identity_admin_client()
+        resp, tenants = cls.admin_client.list_tenants()
+        cls.tenant_id = [tnt['id'] for tnt in tenants if tnt['name'] ==
+                         cls.client.tenant_name][0]
         #Create a server to be used for all read only tests
         name = rand_name('server')
         resp, server = cls.client.create_server(name, cls.image_ref,
@@ -110,6 +114,15 @@
         expected = {'key1': 'alt1', 'key2': 'value2', 'key3': 'value3'}
         self.assertEqual(expected, resp_metadata)
 
+    def test_update_metadata_empty_body(self):
+        # The original metadata should not be lost if empty metadata body is
+        # passed
+        meta = {}
+        _, metadata = self.client.update_server_metadata(self.server_id, meta)
+        resp, resp_metadata = self.client.list_server_metadata(self.server_id)
+        expected = {'key1': 'value1', 'key2': 'value2'}
+        self.assertEqual(expected, resp_metadata)
+
     def test_get_server_metadata_item(self):
         # The value for a specic metadata key should be returned
         resp, meta = self.client.get_server_metadata_item(self.server_id,
@@ -143,63 +156,40 @@
     @attr(type='negative')
     def test_get_nonexistant_server_metadata_item(self):
         # Negative test: GET on nonexistant server should not succeed
-        try:
-            resp, meta = self.client.get_server_metadata_item(999, 'test2')
-        except Exception:
-            pass
-        else:
-            self.fail('GET on nonexistant server should not succeed')
+        self.assertRaises(exceptions.NotFound,
+                          self.client.get_server_metadata_item, 999, 'test2')
 
     @attr(type='negative')
     def test_list_nonexistant_server_metadata(self):
         # Negative test:List metadata on a non existant server should
         # not succeed
-        try:
-            resp, metadata = self.client.list_server_metadata(999)
-        except Exception:
-            pass
-        else:
-            self.fail('List metadata on a non existant server should'
-                      'not succeed')
+        self.assertRaises(exceptions.NotFound,
+                          self.client.list_server_metadata, 999)
 
     @attr(type='negative')
     def test_set_server_metadata_item_incorrect_uri_key(self):
-        #Raise BadRequest if key in uri does not match
-        #the key passed in body.
+        # Raise BadRequest if key in uri does not match
+        # the key passed in body.
 
         meta = {'testkey': 'testvalue'}
-        try:
-            resp, metadata = self.client.set_server_metadata_item(
-                                        self.server_id, 'key', meta)
-        except exceptions.BadRequest:
-            pass
-        else:
-            self.fail('Should raise BadRequest if URI key does not match key'
-                      'passed in the body')
+        self.assertRaises(exceptions.BadRequest,
+                          self.client.set_server_metadata_item,
+                          self.server_id, 'key', meta)
 
     @attr(type='negative')
     def test_set_nonexistant_server_metadata(self):
         # Negative test: Set metadata on a non existant server should not
         # succeed
         meta = {'meta1': 'data1'}
-        try:
-            resp, metadata = self.client.set_server_metadata(999, meta)
-        except Exception:
-            pass
-        else:
-            self.fail('Set metadata on a non existant server should'
-                      'not succeed')
+        self.assertRaises(exceptions.NotFound,
+                          self.client.set_server_metadata, 999, meta)
 
     @attr(type='negative')
     def test_update_nonexistant_server_metadata(self):
         # Negative test: An update should not happen for a nonexistant image
         meta = {'key1': 'value1', 'key2': 'value2'}
-        try:
-            resp, metadata = self.client.update_server_metadata(999, meta)
-        except Exception:
-            pass
-        else:
-            self.fail('An update should not happen for a nonexistant image')
+        self.assertRaises(exceptions.NotFound,
+                          self.client.update_server_metadata, 999, meta)
 
     @attr(type='negative')
     def test_update_metadata_key_error(self):
@@ -212,12 +202,43 @@
     @attr(type='negative')
     def test_delete_nonexistant_server_metadata_item(self):
         # Negative test: Should not be able to delete metadata item from a
-        # nonexistant server
+        #  nonexistant server
 
         #Delete the metadata item
-        try:
-            resp, metadata = self.client.delete_server_metadata_item(999, 'd')
-        except Exception:
-            pass
-        else:
-            self.fail('A delete should not happen for a nonexistant image')
+        self.assertRaises(exceptions.NotFound,
+                          self.client.delete_server_metadata_item, 999, 'd')
+
+    @attr(type='negative')
+    def test_set_server_metadata_too_long(self):
+        # Raise a 413 OverLimit exception while exceeding metadata items limit
+        # for tenant.
+        _, quota_set = self.quotas.get_quota_set(self.tenant_id)
+        quota_metadata = quota_set['metadata_items']
+        req_metadata = {}
+        for num in range(1, quota_metadata + 2):
+            req_metadata['key' + str(num)] = 'val' + str(num)
+        self.assertRaises(exceptions.OverLimit,
+                          self.client.set_server_metadata,
+                          self.server_id, req_metadata)
+
+    @attr(type='negative')
+    def test_update_server_metadata_too_long(self):
+        # Raise a 413 OverLimit exception while exceeding metadata items limit
+        # for tenant.
+        _, quota_set = self.quotas.get_quota_set(self.tenant_id)
+        quota_metadata = quota_set['metadata_items']
+        req_metadata = {}
+        for num in range(1, quota_metadata + 2):
+            req_metadata['key' + str(num)] = 'val' + str(num)
+        self.assertRaises(exceptions.OverLimit,
+                          self.client.update_server_metadata,
+                          self.server_id, req_metadata)
+
+    @attr(type='negative')
+    def test_update_all_metadata_field_error(self):
+        # Raise a bad request error for blank key.
+        # set_server_metadata will replace all metadata with new value
+        meta = {'': 'data1'}
+        self.assertRaises(exceptions.BadRequest,
+                          self.client.set_server_metadata,
+                          self.server_id, meta=meta)
