Add compute personality feature config
Add personality config in compute-feature-enabled.
Remove using personality in general tests.
Add some tests to test_server_pesonality.
Change tests with personality to skip if disable.
Change-Id: Ieffa799949034b609b53c5c131d26bfe3cb83fa4
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 2fd7520..2f7ae25 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import base64
-
import netaddr
import testtools
@@ -51,9 +49,6 @@
cls.accessIPv4 = '1.1.1.1'
cls.accessIPv6 = '0000:0000:0000:0000:0000:babe:220.12.22.2'
cls.name = data_utils.rand_name('server')
- file_contents = 'This is a test file.'
- personality = [{'path': '/test.txt',
- 'contents': base64.b64encode(file_contents)}]
disk_config = cls.disk_config
cls.server_initial = cls.create_test_server(
validatable=True,
@@ -62,7 +57,6 @@
metadata=cls.meta,
accessIPv4=cls.accessIPv4,
accessIPv6=cls.accessIPv6,
- personality=personality,
disk_config=disk_config)
cls.password = cls.server_initial['adminPass']
cls.server = (cls.client.show_server(cls.server_initial['id'])
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index f0cd2a1..a59cb16 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import base64
import logging
from six.moves.urllib import parse as urlparse
@@ -145,16 +144,12 @@
# The server should be rebuilt using the provided image and data
meta = {'rebuild': 'server'}
new_name = data_utils.rand_name('server')
- file_contents = 'Test server rebuild.'
- personality = [{'path': 'rebuild.txt',
- 'contents': base64.b64encode(file_contents)}]
password = 'rebuildPassw0rd'
rebuilt_server = self.client.rebuild_server(
self.server_id,
self.image_ref_alt,
name=new_name,
metadata=meta,
- personality=personality,
adminPass=password)['server']
# If the server was rebuilt on a different image, restore it to the
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index a7fc235..77af509 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -17,17 +17,42 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
+from tempest import config
from tempest import test
+CONF = config.CONF
+
class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
@classmethod
+ def skip_checks(cls):
+ super(ServerPersonalityTestJSON, cls).skip_checks()
+ if not CONF.compute_feature_enabled.personality:
+ raise cls.skipException("Nova personality feature disabled")
+
+ @classmethod
def setup_clients(cls):
super(ServerPersonalityTestJSON, cls).setup_clients()
cls.client = cls.servers_client
cls.user_client = cls.limits_client
+ @test.idempotent_id('3cfe87fd-115b-4a02-b942-7dc36a337fdf')
+ def test_create_server_with_personality(self):
+ file_contents = 'This is a test file.'
+ personality = [{'path': '/test.txt',
+ 'contents': base64.b64encode(file_contents)}]
+ self.create_test_server(personality=personality)
+
+ @test.idempotent_id('128966d8-71fc-443c-8cab-08e24114ecc9')
+ def test_rebuild_server_with_personality(self):
+ server_id = self.rebuild_server(None)
+ file_contents = 'Test server rebuild.'
+ personality = [{'path': 'rebuild.txt',
+ 'contents': base64.b64encode(file_contents)}]
+ self.client.rebuild_server(server_id, self.image_ref_alt,
+ personality=personality)
+
@test.idempotent_id('176cd8c9-b9e8-48ee-a480-180beab292bf')
def test_personality_files_exceed_limit(self):
# Server creation should fail if greater than the maximum allowed
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index 6946be4..98b292a 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -66,6 +66,8 @@
@test.attr(type=['negative'])
@test.idempotent_id('b8a7235e-5246-4a8f-a08e-b34877c6586f')
+ @testtools.skipUnless(CONF.compute_feature_enabled.personality,
+ 'Nova personality feature disabled')
def test_personality_file_contents_not_encoded(self):
# Use an unencoded file when creating a server with personality
diff --git a/tempest/config.py b/tempest/config.py
index d91fb04..b9c8aa7 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -425,6 +425,9 @@
cfg.BoolOpt('nova_cert',
default=True,
help='Does the test environment have the nova cert running?'),
+ cfg.BoolOpt('personality',
+ default=True,
+ help='Does the test environment support server personality'),
# TODO(mriedem): Remove preserve_ports once juno-eol happens.
cfg.BoolOpt('preserve_ports',
default=False,