freezer.tests.integration.common module

freezer.tests.integration.common module

exception freezer.tests.integration.common.CommandFailed(returncode, cmd, output, stderr)

Bases: Exception

class freezer.tests.integration.common.Temp_Tree(suffix='', dir=None, create=True)

Bases: object

add_random_data(ndir=5, nfile=5, size=1024)

add some files containing random data

Parameters:
  • ndir – number of dirs to create
  • nfile – number of files to create in each dir
  • size – size of files
Returns:

None

cleanup()
create_file_with_random_data(dir_path, size=1024)
delete_random_files(count=1)
get_file_hash(rel_filepath)
get_file_list()

walks the dir tree and creates a list of relative pathnames :return: list of relative file paths

is_equal(other_tree)

Checks whether two dir tree contain the same files It checks the number of files and the hash of each file.

NOTE: tox puts .coverage files in the temp folder (?)

Parameters:other_tree – dir tree to compare with
Returns:true if the dir trees contain the same files
modify_random_files(count=1)
class freezer.tests.integration.common.TestFS(methodName='runTest')

Bases: unittest.case.TestCase

Utility class for setting up the tests.

Type of tests depends (also) on the environment variables defined.

To enable the ssh storage testing, the following environment variables need to be defined: - FREEZER_TEST_SSH_KEY - FREEZER_TEST_SSH_USERNAME - FREEZER_TEST_SSH_HOST - FREEZER_TEST_CONTAINER

To enable the swift storage testing, the following environment variables need to be defined: - FREEZER_TEST_OS_TENANT_NAME - FREEZER_TEST_OS_USERNAME - FREEZER_TEST_OS_REGION_NAME - FREEZER_TEST_OS_PASSWORD - FREEZER_TEST_OS_AUTH_URL

Tests involving LVM snapshots are evoided if: - user is not root - FREEZER_TEST_NO_LVM is set

assertTreesMatch()
assertTreesMatchNot()
container = None
do_backup_and_restore_with_check(backup_args, restore_args)
get_file_list_openstack(container)
get_file_list_ssh(sub_path='')
openstack_executable = None
os_auth_url = None
os_password = None
os_region = None
os_tenant_name = None
os_user_name = None
remove_ssh_directory(sub_path='')
remove_swift_container(container)
setUp()

Hook method for setting up the test fixture before exercising it.

ssh_executable = '/usr/bin/ssh'
ssh_host = None
ssh_key = None
ssh_username = None
swift_executable = '/home/zuul/src/opendev.org/openstack/freezer/.tox/docs/bin/swift'
tearDown()

Hook method for deconstructing the test fixture after testing it.

use_lvm = False
use_os = None
use_ssh = None
freezer.tests.integration.common.dict_to_args(d)
freezer.tests.integration.common.execute(args, must_fail=False, merge_stderr=False)

Executes specified command for the given action. :param args: :type args: list[str] :param must_fail: :param merge_stderr: :return:

freezer.tests.integration.common.execute_freezerc(dict, must_fail=False, merge_stderr=False)
Parameters:
  • dict (dict[str, str]) –
  • must_fail
  • merge_stderr
Returns:

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.