Merge "Always enable project tags Identity tests"
diff --git a/releasenotes/notes/loggable-resource-client-5977d46a7ea52199.yaml b/releasenotes/notes/loggable-resource-client-5977d46a7ea52199.yaml
new file mode 100644
index 0000000..ac83eaf
--- /dev/null
+++ b/releasenotes/notes/loggable-resource-client-5977d46a7ea52199.yaml
@@ -0,0 +1,5 @@
+---
+features:
+ - |
+ Lists neutron's Loggable resources API service clients are available in
+ ``tempest/lib/services/network/loggable_resource_client.py`` module.
\ No newline at end of file
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 8d249ff..922a14c 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -454,6 +454,12 @@
server = self.servers_client.show_server(server_id)['server']
self.assert_flavor_equal(new_flavor_id, server['flavor'])
+ def reboot_server(self, server_id, type):
+ """Reboot a server and wait for it to be ACTIVE."""
+ self.servers_client.reboot_server(server_id, type=type)
+ waiters.wait_for_server_status(
+ self.servers_client, server_id, 'ACTIVE')
+
@classmethod
def delete_volume(cls, volume_id):
"""Deletes the given volume and waits for it to be gone."""
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 671a779..a1f3514 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -109,9 +109,7 @@
sg['id'])
# Reboot and add the other security group
- self.servers_client.reboot_server(server_id, type='HARD')
- waiters.wait_for_server_status(self.servers_client, server_id,
- 'ACTIVE')
+ self.reboot_server(server_id, type='HARD')
self.servers_client.add_security_group(server_id, name=sg2['name'])
# Check that we are not able to delete the other security
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 5ab592a..028da68 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -37,9 +37,7 @@
@decorators.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
def test_list_instance_actions(self):
"""Test listing actions of the provided server"""
- self.client.reboot_server(self.server['id'], type='HARD')
- waiters.wait_for_server_status(self.client,
- self.server['id'], 'ACTIVE')
+ self.reboot_server(self.server['id'], type='HARD')
body = (self.client.list_instance_actions(self.server['id'])
['instanceActions'])
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index deb21c7..152e7e8 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -136,8 +136,7 @@
# in a server
linux_client.exec_command("sync")
- self.client.reboot_server(self.server_id, type=reboot_type)
- waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ self.reboot_server(self.server_id, type=reboot_type)
if CONF.validation.run_validation:
# Log in and verify the boot time has changed
@@ -607,8 +606,7 @@
# log file is truncated and we cannot get any console log through
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
- self.client.reboot_server(self.server_id, type='HARD')
- waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ self.reboot_server(self.server_id, type='HARD')
self.wait_for(self._get_output)
@decorators.idempotent_id('89104062-69d8-4b19-a71b-f47b7af093d7')
diff --git a/tempest/api/identity/v3/test_users.py b/tempest/api/identity/v3/test_users.py
index 6425ea9..dc6dd4a 100644
--- a/tempest/api/identity/v3/test_users.py
+++ b/tempest/api/identity/v3/test_users.py
@@ -77,6 +77,8 @@
time.sleep(1)
self.non_admin_users_client.auth_provider.set_auth()
+ @testtools.skipUnless(CONF.identity_feature_enabled.security_compliance,
+ 'Security compliance not available.')
@decorators.idempotent_id('ad71bd23-12ad-426b-bb8b-195d2b635f27')
@testtools.skipIf(CONF.identity_feature_enabled.immutable_user_source,
'Skipped because environment has an '
diff --git a/tempest/api/network/admin/test_negative_quotas.py b/tempest/api/network/admin/test_negative_quotas.py
index 614dfcf..1ce9f47 100644
--- a/tempest/api/network/admin/test_negative_quotas.py
+++ b/tempest/api/network/admin/test_negative_quotas.py
@@ -53,7 +53,8 @@
def tearDown(self):
super(QuotasNegativeTest, self).tearDown()
- self.credentials_provider.cleanup_default_secgroup(self.project['id'])
+ self.credentials_provider.cleanup_default_secgroup(
+ self.os_admin.security_groups_client, self.project['id'])
@decorators.attr(type=['negative'])
@decorators.idempotent_id('644f4e1b-1bf9-4af0-9fd8-eb56ac0f51cf')
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 260ba74..47a8590 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -85,6 +85,7 @@
cls.service_providers_client = cls.os_primary.service_providers_client
cls.tags_client = cls.os_primary.tags_client
cls.log_resource_client = cls.os_primary.log_resource_client
+ cls.loggable_resource_client = cls.os_primary.loggable_resource_client
@classmethod
def resource_setup(cls):
diff --git a/tempest/clients.py b/tempest/clients.py
index 1b05b54..51bd204 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -74,6 +74,7 @@
self.segments_client = self.network.SegmentsClient()
self.trunks_client = self.network.TrunksClient()
self.log_resource_client = self.network.LogResourceClient()
+ self.loggable_resource_client = self.network.LoggableResourceClient()
def _set_image_clients(self):
if CONF.service_available.glance:
diff --git a/tempest/lib/common/cred_provider.py b/tempest/lib/common/cred_provider.py
index 069172a..2da206f 100644
--- a/tempest/lib/common/cred_provider.py
+++ b/tempest/lib/common/cred_provider.py
@@ -13,11 +13,13 @@
# limitations under the License.
import abc
-
+from oslo_log import log as logging
from tempest.lib import auth
from tempest.lib import exceptions
+LOG = logging.getLogger(__name__)
+
class CredentialProvider(object, metaclass=abc.ABCMeta):
def __init__(self, identity_version, name=None,
@@ -125,6 +127,18 @@
def is_role_available(self, role):
return
+ def cleanup_default_secgroup(self, security_group_client, tenant):
+ resp_body = security_group_client.list_security_groups(
+ tenant_id=tenant,
+ name="default")
+ secgroups_to_delete = resp_body['security_groups']
+ for secgroup in secgroups_to_delete:
+ try:
+ security_group_client.delete_security_group(secgroup['id'])
+ except exceptions.NotFound:
+ LOG.warning('Security group %s, id %s not found for clean-up',
+ secgroup['name'], secgroup['id'])
+
class TestResources(object):
"""Readonly Credentials, with network resources added."""
diff --git a/tempest/lib/common/dynamic_creds.py b/tempest/lib/common/dynamic_creds.py
index 2e93fd5..be8c0e8 100644
--- a/tempest/lib/common/dynamic_creds.py
+++ b/tempest/lib/common/dynamic_creds.py
@@ -518,18 +518,6 @@
LOG.warning('network with name: %s not found for delete',
network_name)
- def cleanup_default_secgroup(self, tenant):
- nsg_client = self.security_groups_admin_client
- resp_body = nsg_client.list_security_groups(tenant_id=tenant,
- name="default")
- secgroups_to_delete = resp_body['security_groups']
- for secgroup in secgroups_to_delete:
- try:
- nsg_client.delete_security_group(secgroup['id'])
- except lib_exc.NotFound:
- LOG.warning('Security group %s, id %s not found for clean-up',
- secgroup['name'], secgroup['id'])
-
def _clear_isolated_net_resources(self):
client = self.routers_admin_client
for cred in self._creds:
@@ -578,7 +566,8 @@
# ensure tenant deletion without big changes.
try:
if self.neutron_available:
- self.cleanup_default_secgroup(creds.tenant_id)
+ self.cleanup_default_secgroup(
+ self.security_groups_admin_client, creds.tenant_id)
except lib_exc.NotFound:
LOG.warning("failed to cleanup tenant %s's secgroup",
creds.tenant_name)
diff --git a/tempest/lib/services/network/__init__.py b/tempest/lib/services/network/__init__.py
index fc85140..d553373 100644
--- a/tempest/lib/services/network/__init__.py
+++ b/tempest/lib/services/network/__init__.py
@@ -16,6 +16,8 @@
from tempest.lib.services.network.extensions_client import ExtensionsClient
from tempest.lib.services.network.floating_ips_client import FloatingIPsClient
from tempest.lib.services.network.log_resource_client import LogResourceClient
+from tempest.lib.services.network.loggable_resource_client import \
+ LoggableResourceClient
from tempest.lib.services.network.metering_label_rules_client import \
MeteringLabelRulesClient
from tempest.lib.services.network.metering_labels_client import \
@@ -46,4 +48,5 @@
'QosClient', 'QosMinimumBandwidthRulesClient', 'QuotasClient',
'RoutersClient', 'SecurityGroupRulesClient', 'SecurityGroupsClient',
'SegmentsClient', 'ServiceProvidersClient', 'SubnetpoolsClient',
- 'SubnetsClient', 'TagsClient', 'TrunksClient', 'LogResourceClient']
+ 'SubnetsClient', 'TagsClient', 'TrunksClient', 'LogResourceClient',
+ 'LoggableResourceClient']
diff --git a/tempest/lib/services/network/loggable_resource_client.py b/tempest/lib/services/network/loggable_resource_client.py
new file mode 100644
index 0000000..774046f
--- /dev/null
+++ b/tempest/lib/services/network/loggable_resource_client.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Red Hat, Inc.
+# 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.
+
+from tempest.lib.services.network import base
+
+
+class LoggableResourceClient(base.BaseNetworkClient):
+
+ def list_loggable_resources(self, **filters):
+ """List Loggable resources.
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/network/v2/index.html#list-loggable-resources
+ """
+ uri = '/log/loggable-resources'
+ return self.list_resources(uri, **filters)
diff --git a/tempest/tests/lib/cmd/test_check_uuid.py b/tempest/tests/lib/cmd/test_check_uuid.py
index a621a75..403de38 100644
--- a/tempest/tests/lib/cmd/test_check_uuid.py
+++ b/tempest/tests/lib/cmd/test_check_uuid.py
@@ -29,12 +29,13 @@
" pass"
def create_tests_file(self, directory):
- with open(directory + "/__init__.py", "w"):
- pass
+ init_file = open(directory + "/__init__.py", "w")
+ init_file.close()
tests_file = directory + "/tests.py"
with open(tests_file, "w") as fake_file:
fake_file.write(TestCLInterface.CODE)
+ fake_file.close()
return tests_file
diff --git a/tempest/tests/lib/services/network/test_loggable_resource_client.py b/tempest/tests/lib/services/network/test_loggable_resource_client.py
new file mode 100644
index 0000000..232775b
--- /dev/null
+++ b/tempest/tests/lib/services/network/test_loggable_resource_client.py
@@ -0,0 +1,53 @@
+# Copyright 2021 Red Hat, Inc.
+# 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.
+
+from tempest.lib.services.network import loggable_resource_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestLoggableResourceClient(base.BaseServiceTest):
+
+ FAKE_LOGS = {
+ "loggable_resources": [
+ {
+ "type": "security_group"
+ },
+ {
+ "type": "none"
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestLoggableResourceClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.loggable_resource_client = \
+ loggable_resource_client.LoggableResourceClient(
+ fake_auth, "network", "regionOne")
+
+ def _test_list_loggable_resources(self, bytes_body=False):
+ self.check_service_client_function(
+ self.loggable_resource_client.list_loggable_resources,
+ "tempest.lib.common.rest_client.RestClient.get",
+ self.FAKE_LOGS,
+ bytes_body,
+ 200)
+
+ def test_list_loggable_resources_with_str_body(self):
+ self._test_list_loggable_resources()
+
+ def test_list_loggable_resources_with_bytes_body(self):
+ self._test_list_loggable_resources(bytes_body=True)
diff --git a/tools/generate-tempest-plugins-list.py b/tools/generate-tempest-plugins-list.py
index 1b5b369..eef5886 100644
--- a/tools/generate-tempest-plugins-list.py
+++ b/tools/generate-tempest-plugins-list.py
@@ -35,28 +35,36 @@
# TODO(masayukig): Some of these can be removed from NON_ACTIVE_LIST in the
# future when the patches are merged.
NON_ACTIVE_LIST = [
- 'x/gce-api', # It looks gce-api doesn't support python3 yet.
+ 'x/gce-api', # It looks gce-api doesn't support python3 yet
+ # https://bugs.launchpad.net/gce-api/+bug/1931094
'x/glare', # To avoid sanity-job failure
- 'x/group-based-policy', # It looks this doesn't support python3 yet.
- 'x/intel-nfv-ci-tests', # https://review.opendev.org/#/c/634640/
+ 'x/group-based-policy',
+ # https://bugs.launchpad.net/group-based-policy/+bug/1931091
+ 'x/intel-nfv-ci-tests', # To avoid sanity-job failure
'openstack/networking-generic-switch',
+ # This is not a real tempest plugin,
# https://review.opendev.org/#/c/634846/
- 'x/networking-l2gw-tempest-plugin',
- # https://review.opendev.org/#/c/635093/
- 'openstack/networking-midonet', # https://review.opendev.org/#/c/635096/
- 'x/networking-plumgrid', # https://review.opendev.org/#/c/635096/
+ 'x/networking-plumgrid', # No longer contains tempest tests
'x/networking-spp', # https://review.opendev.org/#/c/635098/
+ # networking-spp is missing neutron-tempest-plugin as a dep plus
+ # test-requirements.txt is nested in a openstack dir and sanity script
+ # doesn't count with such scenario yet
'openstack/neutron-dynamic-routing',
+ # As tests have been migrated to neutron-tempest-plugin:
# https://review.opendev.org/#/c/637718/
- 'openstack/neutron-vpnaas', # https://review.opendev.org/#/c/637719/
- 'x/tap-as-a-service', # To avoid sanity-job failure
- 'x/valet', # https://review.opendev.org/#/c/638339/
- 'x/kingbird', # https://bugs.launchpad.net/kingbird/+bug/1869722
- # vmware-nsx is excluded since https://review.opendev.org/#/c/736952
- 'x/vmware-nsx-tempest-plugin',
+ 'openstack/neutron-vpnaas',
+ # As tests have been migrated to neutron-tempest-plugin:
+ # https://review.opendev.org/c/openstack/neutron-vpnaas/+/695834
+ 'x/valet', # valet is unmaintained now
+ # https://review.opendev.org/c/x/valet/+/638339
+ 'x/kingbird', # kingbird is unmaintained now
+ # https://bugs.launchpad.net/kingbird/+bug/1869722
+ 'x/mogan',
# mogan is unmaintained now, remove from the list when this is merged:
# https://review.opendev.org/c/x/mogan/+/767718
- 'x/mogan',
+ 'x/vmware-nsx-tempest-plugin'
+ # Failing since 2021-08-27
+ # https://zuul.opendev.org/t/openstack/build/45f6c8d3c62d4387a70b7b471ec687c8
]
url = 'https://review.opendev.org/projects/'