Source code for tempest.api.object_storage.test_object_symlink

# Copyright 2026 Red Hat, Inc.
#
#    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 os

from tempest.api.object_storage import base
from tempest.common import object_storage
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc

CONF = config.CONF


[docs] class ObjectSymlinkTest(base.BaseObjectTest): """Tempest API tests for Swift symbolic link objects (symlinks)""" @classmethod def resource_setup(cls): super(ObjectSymlinkTest, cls).resource_setup() cls.containers = [] # Check if symlink is supported via Swift capabilities API if not CONF.object_storage_feature_enabled.discoverability: raise cls.skipException( "Cannot detect symlink support: discoverability disabled") try: body = cls.capabilities_client.list_capabilities() except Exception as e: raise cls.skipException( f"Cannot retrieve Swift capabilities: {e}") # Symlink middleware registers as 'symlink' in capabilities if 'symlink' not in body: raise cls.skipException( "Symlink middleware not enabled in Swift configuration") @classmethod def resource_cleanup(cls): object_storage.delete_containers( cls.containers, cls.container_client, cls.object_client) super(ObjectSymlinkTest, cls).resource_cleanup() def _create_container(self): container_name = data_utils.rand_name('symlink-container') self.container_client.create_container(container_name) type(self).containers.append(container_name) return container_name def _upload_object(self, container_name, object_name, data): self.object_client.create_object( container_name, object_name, data=data)