Merge "Remove testscenarios usage from test_server_basic_ops"
diff --git a/REVIEWING.rst b/REVIEWING.rst
index bd6018d..676a217 100644
--- a/REVIEWING.rst
+++ b/REVIEWING.rst
@@ -72,6 +72,19 @@
scenario tests this is up to the reviewers discretion whether a docstring is
required or not.
+Release Notes
+-------------
+Release notes are how we indicate to users and other consumers of Tempest what
+has changed in a given release. Since Tempest 10.0.0 we've been using `reno`_
+to manage and build the release notes. There are certain types of changes that
+require release notes and we should not approve them without including a release
+note. These include but aren't limited to, any addition, deprecation or removal
+from the lib interface, any change to configuration options (including
+deprecation), CLI additions or deprecations, major feature additions, and
+anything backwards incompatible or would require a user to take note or do
+something extra.
+
+.. _reno: http://docs.openstack.org/developer/reno/
When to approve
---------------
diff --git a/doc/source/conf.py b/doc/source/conf.py
index c2df0b6..eef3620 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -34,7 +34,7 @@
'oslo_config.sphinxconfiggen',
]
-config_generator_config_file = '../../etc/config-generator.tempest.conf'
+config_generator_config_file = '../../tempest/cmd/config-generator.tempest.conf'
sample_config_basename = '_static/tempest'
todo_include_todos = True
diff --git a/releasenotes/notes/tempest-init-global-config-dir-location-changes-12260255871d3a2b.yaml b/releasenotes/notes/tempest-init-global-config-dir-location-changes-12260255871d3a2b.yaml
new file mode 100644
index 0000000..eeda921
--- /dev/null
+++ b/releasenotes/notes/tempest-init-global-config-dir-location-changes-12260255871d3a2b.yaml
@@ -0,0 +1,12 @@
+---
+upgrade:
+ - The location on disk that the *tempest init* command looks for has changed.
+ Previously it would attempt to use python packaging's data files to guess
+ where setuptools/distutils were installing data files, which was incredibly
+ unreliable and depended on how you installed tempest and which versions of
+ setuptools, distutils, and python you had installed. Instead, now it will
+ use either /etc/tempest, $XDG_CONFIG_PATH/.config/tempest, or
+ ~/.tempest/etc (attempted in that order). If none of these exist it will
+ create an empty ~/.tempest/etc directory. If you were relying on the
+ previous behavior and none of these directories were being used you will
+ need to move the files to live in one of these directories.
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 3a4428a..c65fee4 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -375,17 +375,18 @@
'backup_type': "daily",
'instance_uuid': self.server_id,
}
+ params = {
+ 'status': 'active',
+ 'sort_key': 'created_at',
+ 'sort_dir': 'asc'
+ }
if CONF.image_feature_enabled.api_v1:
- params = dict(
- properties=properties, status='active',
- sort_key='created_at', sort_dir='asc',)
+ params.update({'properties': properties})
image_list = glance_client.list_images(
detail=True,
**params)['images']
else:
# Additional properties are flattened in glance v2.
- params = dict(
- status='active', sort_key='created_at', sort_dir='asc')
params.update(properties)
image_list = glance_client.list_images(params)['images']
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 32faf7d..9834d02 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -61,9 +61,6 @@
waiters.wait_for_server_status(cls.servers_client, cls.server_id,
'ACTIVE')
- def setUp(self):
- super(ServerRescueTestJSON, self).setUp()
-
@classmethod
def resource_cleanup(cls):
# Deleting the floating IP which is created in this method
@@ -72,9 +69,6 @@
cls.sg_id)
super(ServerRescueTestJSON, cls).resource_cleanup()
- def tearDown(self):
- super(ServerRescueTestJSON, self).tearDown()
-
def _unrescue(self, server_id):
self.servers_client.unrescue_server(server_id)
waiters.wait_for_server_status(self.servers_client, server_id,
diff --git a/etc/config-generator.tempest.conf b/tempest/cmd/config-generator.tempest.conf
similarity index 100%
rename from etc/config-generator.tempest.conf
rename to tempest/cmd/config-generator.tempest.conf
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index b9db989..e3788ab 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -18,6 +18,7 @@
import sys
from cliff import command
+from oslo_config import generator
from oslo_log import log as logging
from six import moves
@@ -39,45 +40,28 @@
def get_tempest_default_config_dir():
"""Get default config directory of tempest
- Returns the correct default config dir to support both cases of
- tempest being or not installed in a virtualenv.
- Cases considered:
- - no virtual env, python2: real_prefix and base_prefix not set
- - no virtual env, python3: real_prefix not set, base_prefix set and
- identical to prefix
- - virtualenv, python2: real_prefix and prefix are set and different
- - virtualenv, python3: real_prefix not set, base_prefix and prefix are
- set and identical
- - pyvenv, any python version: real_prefix not set, base_prefix and prefix
- are set and different
+ There are 3 dirs that get tried in priority order. First is /etc/tempest,
+ if that doesn't exist it looks for a tempest dir in the XDG_CONFIG_HOME
+ dir (defaulting to ~/.config/tempest) and last it tries for a
+ ~/.tempest/etc directory. If none of these exist a ~/.tempest/etc
+ directory will be created.
:return: default config dir
"""
- real_prefix = getattr(sys, 'real_prefix', None)
- base_prefix = getattr(sys, 'base_prefix', None)
- prefix = sys.prefix
global_conf_dir = '/etc/tempest'
- if (real_prefix is None and
- (base_prefix is None or base_prefix == prefix) and
- os.path.isdir(global_conf_dir)):
- # Probably not running in a virtual environment.
- # NOTE(andreaf) we cannot distinguish this case from the case of
- # a virtual environment created with virtualenv, and running python3.
- # Also if it appears we are not in virtual env and fail to find
- # global config: '/etc/tempest', fall back to
- # '[sys.prefix]/etc/tempest'
+ xdg_config = os.environ.get('XDG_CONFIG_HOME',
+ os.path.expanduser('~/.config'))
+ user_xdg_global_path = os.path.join(xdg_config, 'tempest')
+ user_global_path = os.path.join(os.path.expanduser('~'), '.tempest/etc')
+ if os.path.isdir(global_conf_dir):
return global_conf_dir
+ elif os.path.isdir(user_xdg_global_path):
+ return user_xdg_global_path
+ elif os.path.isdir(user_global_path):
+ return user_global_path
else:
- conf_dir = os.path.join(prefix, 'etc/tempest')
- if os.path.isdir(conf_dir):
- return conf_dir
- else:
- # NOTE: The prefix is gotten from the path which pyconfig.h is
- # installed under. Some envs contain it under /usr/include, not
- # /user/local/include. Then prefix becomes /usr on such envs.
- # However, etc/tempest is installed under /usr/local and the bove
- # path logic mismatches. This is a workaround for such envs.
- return os.path.join(prefix, 'local/etc/tempest')
+ os.makedirs(user_global_path)
+ return user_global_path
class TempestInit(command.Command):
@@ -125,17 +109,16 @@
else:
LOG.warning("Global config dir %s can't be found" % config_dir)
- def generate_sample_config(self, local_dir, config_dir):
- if os.path.isdir(config_dir):
- conf_generator = os.path.join(config_dir,
- 'config-generator.tempest.conf')
-
- subprocess.call(['oslo-config-generator', '--config-file',
- conf_generator],
- cwd=local_dir)
+ def generate_sample_config(self, local_dir):
+ conf_generator = os.path.join(os.path.dirname(__file__),
+ 'config-generator.tempest.conf')
+ output_file = os.path.join(local_dir, 'etc/tempest.conf.sample')
+ if os.path.isfile(conf_generator):
+ generator.main(['--config-file', conf_generator, '--output-file',
+ output_file])
else:
LOG.warning("Skipping sample config generation because global "
- "config dir %s can't be found" % config_dir)
+ "config file %s can't be found" % conf_generator)
def create_working_dir(self, local_dir, config_dir):
# make sure we are working with abspath however tempest init is called
@@ -164,7 +147,7 @@
# Create and copy local etc dir
self.copy_config(etc_dir, config_dir)
# Generate the sample config file
- self.generate_sample_config(local_dir, config_dir)
+ self.generate_sample_config(local_dir)
# Update local confs to reflect local paths
self.update_local_conf(config_path, lock_dir, log_dir)
# Generate a testr conf file
diff --git a/tempest/tests/cmd/test_tempest_init.py b/tempest/tests/cmd/test_tempest_init.py
index 685a0b3..031bf4d 100644
--- a/tempest/tests/cmd/test_tempest_init.py
+++ b/tempest/tests/cmd/test_tempest_init.py
@@ -13,7 +13,6 @@
# under the License.
import os
-import shutil
import fixtures
@@ -43,15 +42,12 @@
local_dir = self.useFixture(fixtures.TempDir())
etc_dir_path = os.path.join(local_dir.path, 'etc/')
os.mkdir(etc_dir_path)
- tmp_dir = self.useFixture(fixtures.TempDir())
- config_dir = os.path.join(tmp_dir.path, 'config/')
- shutil.copytree('etc/', config_dir)
init_cmd = init.TempestInit(None, None)
local_sample_conf_file = os.path.join(etc_dir_path,
'tempest.conf.sample')
# Verify no sample config file exist
self.assertFalse(os.path.isfile(local_sample_conf_file))
- init_cmd.generate_sample_config(local_dir.path, config_dir)
+ init_cmd.generate_sample_config(local_dir.path)
# Verify sample config file exist with some content
self.assertTrue(os.path.isfile(local_sample_conf_file))
diff --git a/tempest/tests/lib/services/identity/v3/test_token_client.py b/tempest/tests/lib/services/identity/v3/test_token_client.py
index e9ef740..9f4b4cc 100644
--- a/tempest/tests/lib/services/identity/v3/test_token_client.py
+++ b/tempest/tests/lib/services/identity/v3/test_token_client.py
@@ -25,9 +25,6 @@
class TestTokenClientV3(base.TestCase):
- def setUp(self):
- super(TestTokenClientV3, self).setUp()
-
def test_init_without_authurl(self):
self.assertRaises(exceptions.IdentityError,
token_client.V3TokenClient, None)
diff --git a/tox.ini b/tox.ini
index 44162fd..cff222d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -28,7 +28,7 @@
bash tools/pretty_tox.sh '{posargs}'
[testenv:genconfig]
-commands = oslo-config-generator --config-file etc/config-generator.tempest.conf
+commands = oslo-config-generator --config-file tempest/cmd/config-generator.tempest.conf
[testenv:cover]
setenv = OS_TEST_PATH=./tempest/tests