Object Storage

Swift conftest

stepler.object_storage.conftest.container(container_steps)[source]

Fixture to create container.

Parameters:container_steps (obj) – instantiated container steps
Yields:attrdict.AttrDict – created container name and info
stepler.object_storage.conftest.container_steps(swift_client, os_faults_steps, s3_client)[source]

Fixture to get swift container steps.

Parameters:
  • swift_client (obj) – instantiated swift client
  • os_faults_steps (obj) – instantiated os_faults steps
  • s3_client (obj) – s3 client
Returns:

instantiated swift or rbd container steps

Return type:

object

stepler.object_storage.conftest.s3_client(current_user, ec2_credentials)[source]

Fixture to get s3 client.

Parameters:
  • current_user (obj) – current user
  • ec2_credentials (obj) – EC2 credentials for current user
Returns:

s3 client

Return type:

obj

stepler.object_storage.conftest.swift_client(session)[source]

Function fixture to get swift client.

Returns:instantiated swift client
Return type:object

Object Storage steps

class stepler.object_storage.steps.ContainerSwiftSteps(client)[source]

Swift container steps.

check_object_content(container_name, object_name, expected_content)[source]

Step to check object content.

Parameters:
  • container_name (str) – container name
  • object_name (str) – object name
  • expected_content (str) – expected content
Raises:

AssertionError – if object content is not equal to expected content

check_object_presence(container_name, object_name, must_present=True)[source]

Step to check object presence.

Parameters:
  • container_name (str) – container name
  • object_name (str) – object name
  • must_present (bool, optional) – flag whether object should exist or not
Raises:

AssertionError – if check failed

check_presence(name, must_present=True)[source]

Step to check container presence.

Parameters:
  • name (str) – container name
  • must_present (bool, optional) – flag whether container should exist or not
Raises:

AssertionError – if check failed

create(name, check=True)[source]

Step to create container and check it exists in containers list.

Parameters:
  • name (str) – container name
  • check (bool, optional) – flag whether to check this step or not
Returns:

created container

Return type:

dict

Raises:

AssertionError – if check failed

delete(name, check=True)[source]

Step to delete container by name.

Parameters:
  • name (str) – container name
  • check (bool, optional) – flag whether to check this step or not
Raises:

AssertionError – if container is not deleted

delete_object(container_name, object_name, check=True)[source]

Step to delete object from container.

Parameters:
  • container_name (str) – container name
  • object_name (str) – object name
  • check (bool, optional) – flag whether to check this step or not
Raises:

AssertionError – if object is present in container after deleting

get(name, check=True)[source]

Step to get container by name.

Parameters:
  • name (str) – container name
  • check (bool, optional) – flag whether to check this step or not
Returns:

container

Return type:

dict

Raises:

AssertionError – if container dict is empty

get_object(container_name, object_name, check=True)[source]

Step to get (download) object from container.

Parameters:
  • container_name (str) – container name
  • object_name (str) – object name
  • check (bool, optional) – flag whether to check this step or not
Returns:

object content

Return type:

str

put_object(container_name, object_name, content, check=True)[source]

Step to put object to container.

Parameters:
  • container_name (str) – container name
  • object_name (str) – object name
  • content (str) – content to put
  • check (bool, optional) – flag whether to check this step or not
Raises:

AssertionError – if object is not present in container

class stepler.object_storage.steps.ContainerCephSteps(client)[source]

Ceph container steps.

check_object_hash(created_key_name, downloaded_key_name)[source]

Step to check md5 checksum of two buckets.

Parameters:
  • created_key_name (str) – name of object which was upload to bucket
  • downloaded_key_name (str) – name of object which was download
  • bucket (from) –
Raises:

AssertionError – if check failed

check_object_presence(name, key, chunksize=None, must_present=True)[source]

Step to check object presence.

Parameters:
  • name (str) – bucket name
  • key (str) – key of object
  • chunksize (int) – chunksize of object
  • must_present (bool, optional) – flag whether object should exist
  • not (or) –
Raises:

AssertionError – if check failed

check_presence(name, must_present=True)[source]

Step to check container presents in containers list.

Parameters:
  • name (str) – bucket name
  • must_present (bool, optional) – flag whether container should exist or not
Raises:

AssertionError – if check failed

create(name=None, check=True)[source]

Step to create bucket.

Parameters:
  • name (str|None) – bucket name
  • check (bool, optional) – flag whether to check this step or not
Returns:

bucket – created bucket

Return type:

obj

Raises:

AssertionError – if check failed

delete(name, check=True)[source]

Step to delete bucket.

Parameters:
  • name (str) – name of bucket to delete
  • check (bool, optional) – flag whether to check this step or not
Raises:

AssertionError – if check failed

delete_object(name, key, check=True)[source]

Step to delete object from bucket.

Parameters:
  • name (str) – bucket name
  • key (str) – key of object
  • check (bool, optional) – flag whether to check this step or not
Raises:

AssertionError – if check failed

get_object(name, key, check=True)[source]

Step to download object from bucket.

Parameters:
  • name (str) – bucket name
  • key (str) – key of object
  • check (bool, optional) – flag whether to check this step or not
Returns:

downloaded_key – path to the new object

Return type:

str

Raises:

AssertionError – if check failed

list(check=True)[source]

Step to list all buckets.

Parameters:check (bool, optional) – flag whether to check this step or not
Returns:buckets_name_list – list of all buckets
Return type:dict
Raises:AssertionError – if check failed
put_object(name, key, check=True, chunksize=None)[source]

Step to put object to bucket.

Parameters:
  • name (str) – bucket name
  • key (str) – key of object
  • chunksize (int) – chunksize of object
  • check (bool, optional) – flag whether to check this step or not
Raises:

AssertionError – if check failed

Object Storage tests