Merge "Remove get_ram_size_in_mb, get_number_of_vcpus, etc"
diff --git a/doc/source/test-removal.rst b/doc/source/test-removal.rst
index 4757dc4..d06e4ba 100644
--- a/doc/source/test-removal.rst
+++ b/doc/source/test-removal.rst
@@ -64,7 +64,7 @@
SELECT * from tests where test_id like "%test_id%";
(where $test_id is the full test_id, but truncated to the class because of
-setupClass or tearDownClass failures)
+setUpClass or tearDownClass failures)
You can access the infra mysql subunit2sql db w/ read-only permissions with:
@@ -82,7 +82,7 @@
#. run the query: MySQL [subunit2sql]> select * from tests where test_id like
"tempest.api.compute.admin.test_flavors_negative.FlavorsAdminNegativeTestJSON%";
which will return a table of all the tests in the class (but it will also
- catch failures in setupClass and tearDownClass)
+ catch failures in setUpClass and tearDownClass)
#. paste the output table with numbers and the mysql command you ran to
generate it into the etherpad.
@@ -185,4 +185,4 @@
If a test exists in Tempest that would meet this criteria as consequence of a
change, the test must be removed according to the procedure discussed into
this document. The API change should not be merged until all conditions
-required for test removal can be met.
\ No newline at end of file
+required for test removal can be met.
diff --git a/releasenotes/notes/deprecate-resources-prefix-option-ad490c0a30a0266b.yaml b/releasenotes/notes/deprecate-resources-prefix-option-ad490c0a30a0266b.yaml
new file mode 100644
index 0000000..f679208
--- /dev/null
+++ b/releasenotes/notes/deprecate-resources-prefix-option-ad490c0a30a0266b.yaml
@@ -0,0 +1,10 @@
+---
+upgrade:
+ - The default value of rand_name()'s prefix argument is changed
+ to 'tempest' from None to identify resources are created by
+ Tempest.
+deprecations:
+ - The resources_prefix is marked as deprecated because it is
+ enough to set 'tempest' as the prefix on rand_name() to
+ ideintify resources which are created by Tempest and no
+ projects set this option on OpenStack dev community.
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index c0a8eae..04d7bf7 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -269,16 +269,34 @@
if not self.fixed_network_name:
msg = 'fixed_network_name needs to be configured to run this test'
raise self.skipException(msg)
+
+ # list servers filter by ip is something "regexp match", i.e,
+ # filter by "10.1.1.1" will return both "10.1.1.1" and "10.1.1.10".
+ # so here look for the longest server ip, and filter by that ip,
+ # so as to ensure only one server is returned.
+ ip_list = {}
self.s1 = self.client.show_server(self.s1['id'])['server']
# Get first ip address inspite of v4 or v6
- addr_spec = self.s1['addresses'][self.fixed_network_name][0]
- params = {'ip': addr_spec['addr']}
+ ip_addr = self.s1['addresses'][self.fixed_network_name][0]['addr']
+ ip_list[ip_addr] = self.s1['id']
+
+ self.s2 = self.client.show_server(self.s2['id'])['server']
+ ip_addr = self.s2['addresses'][self.fixed_network_name][0]['addr']
+ ip_list[ip_addr] = self.s2['id']
+
+ self.s3 = self.client.show_server(self.s3['id'])['server']
+ ip_addr = self.s3['addresses'][self.fixed_network_name][0]['addr']
+ ip_list[ip_addr] = self.s3['id']
+
+ longest_ip = max([[len(ip), ip] for ip in ip_list])[1]
+ params = {'ip': longest_ip}
body = self.client.list_servers(**params)
servers = body['servers']
- self.assertIn(self.s1_name, map(lambda x: x['name'], servers))
- self.assertNotIn(self.s2_name, map(lambda x: x['name'], servers))
- self.assertNotIn(self.s3_name, map(lambda x: x['name'], servers))
+ self.assertIn(ip_list[longest_ip], map(lambda x: x['id'], servers))
+ del ip_list[longest_ip]
+ for ip in ip_list:
+ self.assertNotIn(ip_list[ip], map(lambda x: x['id'], servers))
@decorators.skip_because(bug="1540645")
@decorators.idempotent_id('a905e287-c35e-42f2-b132-d02b09f3654a')
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 6160024..b915739 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -471,7 +471,7 @@
# NOTE: SHUTOFF is irregular status. To avoid test instability,
# one server is created only for this test without using
- # the server that was created in setupClass.
+ # the server that was created in setUpClass.
server = self.create_test_server(wait_until='ACTIVE')
temp_server_id = server['id']
diff --git a/tempest/config.py b/tempest/config.py
index 7f45cf4..274cd21 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -1028,7 +1028,12 @@
help="Prefix to be added when generating the name for "
"test resources. It can be used to discover all "
"resources associated with a specific test run when "
- "running tempest on a real-life cloud"),
+ "running tempest on a real-life cloud",
+ deprecated_for_removal=True,
+ deprecated_reason="It is enough to add 'tempest' as this "
+ "prefix to ideintify resources which are "
+ "created by Tempest and no projects set "
+ "this option on OpenStack dev community."),
]
_opts = [
diff --git a/tempest/lib/common/utils/data_utils.py b/tempest/lib/common/utils/data_utils.py
index 642514b..a0941ef 100644
--- a/tempest/lib/common/utils/data_utils.py
+++ b/tempest/lib/common/utils/data_utils.py
@@ -43,7 +43,7 @@
return uuid.uuid4().hex
-def rand_name(name='', prefix=None):
+def rand_name(name='', prefix='tempest'):
"""Generate a random name that includes a random number
:param str name: The name that you want to include
diff --git a/tempest/test.py b/tempest/test.py
index 970e97c..52994ac 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -643,7 +643,11 @@
cred_provider, networks_client, CONF.compute.fixed_network_name)
def assertEmpty(self, list, msg=None):
+ if msg is None:
+ msg = "list is not empty: %s" % list
self.assertEqual(0, len(list), msg)
def assertNotEmpty(self, list, msg=None):
+ if msg is None:
+ msg = "list is empty."
self.assertGreater(len(list), 0, msg)
diff --git a/tempest/tests/lib/common/utils/test_data_utils.py b/tempest/tests/lib/common/utils/test_data_utils.py
index 4446e5c..8bdf70e 100644
--- a/tempest/tests/lib/common/utils/test_data_utils.py
+++ b/tempest/tests/lib/common/utils/test_data_utils.py
@@ -37,16 +37,20 @@
actual2 = data_utils.rand_uuid_hex()
self.assertNotEqual(actual, actual2)
- def test_rand_name(self):
- actual = data_utils.rand_name()
+ def test_rand_name_with_default_prefix(self):
+ actual = data_utils.rand_name('foo')
self.assertIsInstance(actual, str)
- actual2 = data_utils.rand_name()
+ self.assertTrue(actual.startswith('tempest-foo'))
+ actual2 = data_utils.rand_name('foo')
+ self.assertTrue(actual2.startswith('tempest-foo'))
self.assertNotEqual(actual, actual2)
- actual = data_utils.rand_name('foo')
+ def test_rand_name_with_none_prefix(self):
+ actual = data_utils.rand_name('foo', prefix=None)
+ self.assertIsInstance(actual, str)
self.assertTrue(actual.startswith('foo'))
- actual2 = data_utils.rand_name('foo')
- self.assertTrue(actual.startswith('foo'))
+ actual2 = data_utils.rand_name('foo', prefix=None)
+ self.assertTrue(actual2.startswith('foo'))
self.assertNotEqual(actual, actual2)
def test_rand_name_with_prefix(self):