The freezer.tests.integration.common Module

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

Bases: exceptions.Exception

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

Bases: object

add_random_data(ndir=5, nfile=5, size=1024)[source]

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()[source]
create_file_with_random_data(dir_path, size=1024)[source]
delete_random_files(count=1)[source]
get_file_hash(rel_filepath)[source]
get_file_list()[source]

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

is_equal(other_tree)[source]

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)[source]
class freezer.tests.integration.common.TestFS(methodName='runTest')[source]

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()[source]
assertTreesMatchNot()[source]
container = None
do_backup_and_restore_with_check(backup_args, restore_args)[source]
get_file_list_openstack(container)[source]
get_file_list_ssh(sub_path='')[source]
openstack_executable = '/home/zuul/.venv/bin/openstack'
os_auth_url = None
os_password = None
os_region = None
os_tenant_name = None
os_user_name = None
remove_ssh_directory(sub_path='')[source]
remove_swift_container(container)[source]
setUp()[source]
ssh_executable = '/usr/bin/ssh'
ssh_host = None
ssh_key = None
ssh_username = None
swift_executable = '/home/zuul/.venv/bin/swift'
tearDown()[source]
use_lvm = False
use_os = None
use_ssh = None
freezer.tests.integration.common.dict_to_args(d)[source]
freezer.tests.integration.common.execute(args, must_fail=False, merge_stderr=False)[source]

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)[source]
Parameters:
  • dict (dict[str, str]) –
  • must_fail
  • merge_stderr
Returns: