glance_store.tests.unit package
Submodules
glance_store.tests.unit.test_backend module
Tests the backend store API’s
-
class glance_store.tests.unit.test_backend.TestStoreAddToBackend(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_bad_metadata_not_dict()
-
test_bad_nonunicode_dict_list()
-
test_bad_top_level_nonunicode()
-
test_empty()
-
test_list()
-
test_nested_dict()
-
test_string()
-
test_unicode_dict()
-
test_unicode_dict_list()
glance_store.tests.unit.test_cinder_store module
-
class glance_store.tests.unit.test_cinder_store.FakeObject(**kwargs)
Bases: object
-
class glance_store.tests.unit.test_cinder_store.TestCinderStore(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest, glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
-
setUp()
-
test_cinder_add()
-
test_cinder_add_volume_full()
-
test_cinder_add_with_verifier()
-
test_cinder_configure_add()
-
test_cinder_delete()
-
test_cinder_get()
-
test_cinder_get_size()
-
test_cinder_get_size_with_metadata()
-
test_get_cinderclient()
-
test_get_cinderclient_with_user_overriden()
-
test_open_cinder_volume_error()
-
test_open_cinder_volume_ro()
-
test_open_cinder_volume_rw()
-
test_temporary_chown()
-
test_wait_volume_status(*args, **keywargs)
-
test_wait_volume_status_timeout(*args, **keywargs)
-
test_wait_volume_status_unexpected(*args, **keywargs)
glance_store.tests.unit.test_connection_manager module
-
class glance_store.tests.unit.test_connection_manager.TestConnectionManager(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
prepare_store(multi_tenant=False)
-
setUp()
-
test_basic_multi_tenant_cm_init()
-
test_basic_single_tenant_cm_init()
-
test_basis_multi_tenant_no_context()
-
test_multi_tenant_client_cm_with_client_creation_fails()
-
test_multi_tenant_client_cm_with_expiration()
-
test_multi_tenant_client_cm_with_no_expiration()
-
test_single_tenant_client_cm_with_expiration()
-
test_single_tenant_client_cm_with_no_expiration()
glance_store.tests.unit.test_exceptions module
-
class glance_store.tests.unit.test_exceptions.TestExceptions(*args, **kwds)
Bases: oslotest.base.BaseTestCase
Test routines in glance_store.common.utils.
-
test_backend_exception()
-
test_exception_no_message()
-
test_exception_not_found_with_image()
-
test_exception_with_kwargs()
-
test_exception_with_message()
-
test_non_unicode_error_msg()
-
test_redirect_exception()
-
test_unsupported_backend_exception()
glance_store.tests.unit.test_filesystem_store module
Tests the filesystem backend store
-
class glance_store.tests.unit.test_filesystem_store.TestStore(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest, glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
-
setUp()
Establish a clean test environment.
-
tearDown()
Clear the test environment.
-
test_add()
Test that we can add an image via the filesystem backend.
-
test_add_already_existing()
Tests that adding an image with an existing identifier
raises an appropriate exception
-
test_add_check_metadata_bad_nosuch_file()
-
test_add_check_metadata_list_id_or_mountpoint_is_not_string()
-
test_add_check_metadata_list_with_invalid_mountpoint_locations()
-
test_add_check_metadata_list_with_valid_mountpoint_locations()
-
test_add_check_metadata_with_invalid_mountpoint_location()
-
test_add_cleanup_on_read_failure()
Tests the partial image file is cleaned up after a read
failure.
-
test_add_file_too_big()
Tests that adding an excessively large image file
raises an appropriate exception
-
test_add_other_failure()
Tests that a non-space-related IOError does not raise a
StorageFull exceptions.
-
test_add_storage_full()
Tests that adding an image without enough space on disk
raises an appropriate exception
-
test_add_storage_write_denied()
Tests that adding an image with insufficient filestore permissions
raises an appropriate exception
-
test_add_with_file_perm_for_group_other_users_access()
Test that we can add an image via the filesystem backend with a
required image file permission.
-
test_add_with_file_perm_for_owner_users_access()
Test that we can add an image via the filesystem backend with a
required image file permission.
-
test_add_with_multiple_dirs()
Test adding multiple filesystem directories.
-
test_add_with_multiple_dirs_storage_full()
Test StorageFull exception is raised if no filesystem directory
is found that can store an image.
-
test_add_with_verifier()
Test that ‘verifier.update’ is called when verifier is provided.
-
test_configure_add_check_metadata_bad_data()
-
test_configure_add_check_metadata_id_or_mountpoint_is_not_string()
-
test_configure_add_check_metadata_list_of_dicts_success()
-
test_configure_add_check_metadata_list_with_no_id_or_mountpoint()
-
test_configure_add_check_metadata_success_list_val_for_some_key()
-
test_configure_add_check_metadata_with_no_id_or_mountpoint()
-
test_configure_add_same_dir_multiple_times()
Tests BadStoreConfiguration exception is raised if same directory
is specified multiple times in filesystem_store_datadirs.
-
test_configure_add_same_dir_multiple_times_same_priority()
Tests BadStoreConfiguration exception is raised if same directory
is specified multiple times in filesystem_store_datadirs.
-
test_configure_add_with_file_perm()
Tests filesystem specified by filesystem_store_file_perm
are parsed correctly.
-
test_configure_add_with_metadata_file_success()
-
test_configure_add_with_multi_datadirs()
Tests multiple filesystem specified by filesystem_store_datadirs
are parsed correctly.
-
test_configure_add_with_unaccessible_file_perm()
Tests BadStoreConfiguration exception is raised if an invalid
file permission specified in filesystem_store_file_perm.
-
test_delete()
Test we can delete an existing image in the filesystem store
-
test_delete_forbidden()
Tests that trying to delete a file without permissions
raises the correct error
-
test_delete_non_existing()
Test that trying to delete a file that doesn’t exist
raises an error
-
test_get()
Test a “normal” retrieval of an image in chunks.
-
test_get_non_existing()
Test that trying to retrieve a file that doesn’t exist
raises an error
-
test_get_random_access()
Test a “normal” retrieval of an image in chunks.
glance_store.tests.unit.test_http_store module
-
class glance_store.tests.unit.test_http_store.TestHttpStore(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest, glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
-
setUp()
-
test_http_add_raise_error()
-
test_http_delete_raise_error()
-
test_http_get()
-
test_http_get_max_redirects()
-
test_http_get_not_found()
-
test_http_get_raises_remote_service_unavailable()
Test http store raises RemoteServiceUnavailable.
-
test_http_get_redirect()
-
test_http_get_redirect_invalid()
-
test_http_get_size_bad_status_line()
-
test_http_get_size_with_non_existent_image_raises_Not_Found()
-
test_http_partial_get()
-
test_http_store_location_initialization()
Test store location initialization from valid uris
-
test_http_store_location_initialization_with_invalid_url()
Test store location initialization from incorrect uris.
glance_store.tests.unit.test_rbd_store module
-
class glance_store.tests.unit.test_rbd_store.MockRBD
Bases: object
-
class Image(*args, **kwargs)
Bases: object
-
close()
-
create_snap(*args, **kwargs)
-
discard(offset, length)
-
list_snaps()
-
parent_info()
-
protect_snap(*args, **kwargs)
-
read(*args, **kwargs)
-
remove_snap(*args, **kwargs)
-
resize(*args, **kwargs)
-
size()
-
unprotect_snap(*args, **kwargs)
-
write(*args, **kwargs)
-
exception MockRBD.ImageBusy
Bases: exceptions.Exception
-
exception MockRBD.ImageExists
Bases: exceptions.Exception
-
exception MockRBD.ImageHasSnapshots
Bases: exceptions.Exception
-
exception MockRBD.ImageNotFound
Bases: exceptions.Exception
-
class MockRBD.RBD(*args, **kwargs)
Bases: object
-
clone(*args, **kwargs)
-
create(*args, **kwargs)
-
list(*args, **kwargs)
-
remove(*args, **kwargs)
-
MockRBD.RBD_FEATURE_LAYERING = 1
-
class glance_store.tests.unit.test_rbd_store.MockRados
Bases: object
-
exception Error
Bases: exceptions.Exception
-
class MockRados.Rados(*args, **kwargs)
Bases: object
-
conf_get(*args, **kwargs)
-
connect(*args, **kwargs)
-
open_ioctx(*args, **kwargs)
-
shutdown(*args, **kwargs)
-
class MockRados.ioctx(*args, **kwargs)
Bases: object
-
close(*args, **kwargs)
-
class glance_store.tests.unit.test_rbd_store.TestStore(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest, glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
-
setUp()
Establish a clean test environment.
-
tearDown()
-
test_add_duplicate_image()
-
test_add_w_image_size_zero()
Assert that correct size is returned even though 0 was provided.
-
test_add_w_rbd_image_exception(*args, **keywargs)
-
test_add_with_verifier()
Assert ‘verifier.update’ is called when verifier is provided.
-
test_create_image_conf_features()
-
test_delete()
-
test_delete_image()
-
test_delete_image_exc_image_not_found()
-
test_delete_image_w_snap(*args, **keywargs)
-
test_delete_image_w_snap_exc_image_busy()
-
test_delete_image_w_snap_exc_image_has_snap()
-
test_get_partial_image()
-
test_rados_connect_error(*args, **keywargs)
-
test_rados_connect_timeout(*args, **keywargs)
glance_store.tests.unit.test_sheepdog_store module
-
class glance_store.tests.unit.test_sheepdog_store.TestSheepdogImage(*args, **kwds)
Bases: oslotest.base.BaseTestCase
-
test_run_command(*args, **keywargs)
-
class glance_store.tests.unit.test_sheepdog_store.TestSheepdogStore(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest, glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
-
setUp()
Establish a clean test environment.
-
test_add_bad_size_with_image(*args, **keywargs)
-
test_add_duplicate_image()
-
test_add_image(*args, **keywargs)
-
test_add_with_verifier()
Test that ‘verifier.update’ is called when verifier is provided.
-
test_cleanup_when_add_image_exception(*args, **keywargs)
-
test_delete()
-
test_get()
-
test_get_size()
-
test_partial_get()
-
class glance_store.tests.unit.test_sheepdog_store.TestStoreLocation(*args, **kwds)
Bases: oslotest.base.BaseTestCase
-
test_parse_uri()
-
test_process_spec()
glance_store.tests.unit.test_store_base module
-
class glance_store.tests.unit.test_store_base.TestStoreBase(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_configure_does_not_raise_on_missing_driver_conf(*args, **keywargs)
glance_store.tests.unit.test_store_capabilities module
-
class glance_store.tests.unit.test_store_capabilities.FakeStoreWithDynamicCapabilities(*cap_list)
Bases: glance_store.capabilities.StoreCapability
-
class glance_store.tests.unit.test_store_capabilities.FakeStoreWithMixedCapabilities
Bases: glance_store.capabilities.StoreCapability
-
class glance_store.tests.unit.test_store_capabilities.FakeStoreWithStaticCapabilities
Bases: glance_store.capabilities.StoreCapability
-
class glance_store.tests.unit.test_store_capabilities.TestStoreCapabilities(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
test_cascaded_unset_capabilities()
-
test_dynamic_capabilities_setup()
-
test_mixed_capabilities_setup()
-
test_set_unset_capabilities()
-
test_static_capabilities_setup()
-
test_store_capabilities_property()
-
class glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
Bases: object
-
test_store_capabilities_checked_on_io_operations()
-
class glance_store.tests.unit.test_store_capabilities.TestStoreCapabilityConstants(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
test_combined_capability_bits()
-
test_one_single_capability_own_one_bit()
glance_store.tests.unit.test_swift_store module
Tests the Swift backend store
-
glance_store.tests.unit.test_swift_store.FAKE_UUID()
-
glance_store.tests.unit.test_swift_store.FAKE_UUID2()
-
class glance_store.tests.unit.test_swift_store.FakeConnection(authurl=None, user=None, key=None, retries=5, preauthurl=None, preauthtoken=None, starting_backoff=1, tenant_name=None, os_options=None, auth_version='1', insecure=False, ssl_compression=True, cacert=None)
Bases: object
-
class glance_store.tests.unit.test_swift_store.SwiftTests
Bases: object
-
mock_keystone_client()
-
swift_store_user
-
test_add(*args, **keywargs)
Test that we can add an image via the swift backend.
-
test_add_already_existing()
Tests that adding an image with an existing identifier
raises an appropriate exception
-
test_add_auth_url_variations(*args, **keywargs)
Test that we can add an image via the swift backend with
a variety of different auth_address values
-
test_add_large_object(*args, **keywargs)
Tests that adding a very large image. We simulate the large
object by setting store.large_object_size to a small number
and then verify that there have been a number of calls to
put_object()...
-
test_add_large_object_zero_size()
Tests that adding an image to Swift which has both an unknown size and
exceeds Swift’s maximum limit of 5GB is correctly uploaded.
We avoid the overhead of creating a 5GB object for this test by
temporarily setting MAX_SWIFT_OBJECT_SIZE to 1KB, and then adding
an object of 5KB.
Bug lp:891738
-
test_add_multi_store()
-
test_add_no_container_and_create(*args, **keywargs)
Tests that adding an image with a non-existing container
creates the container automatically if flag is set
-
test_add_no_container_and_multiple_containers_create(*args, **keywargs)
Tests that adding an image with a non-existing container while using
multi containers will create the container automatically if flag is set
-
test_add_no_container_and_multiple_containers_no_create(*args, **keywargs)
Tests that adding an image with a non-existing container while using
multiple containers raises an appropriate exception
-
test_add_no_container_no_create()
Tests that adding an image with a non-existing container
raises an appropriate exception
-
test_add_with_verifier(*args, **keywargs)
Test that the verifier is updated when verifier is provided.
-
test_add_with_verifier_small(*args, **keywargs)
Test that the verifier is updated for smaller images.
-
test_delete()
Test we can delete an existing image in the swift store
-
test_delete_non_existing()
Test that trying to delete a swift that doesn’t exist
raises an error
-
test_delete_nonslo_not_deleted_as_slo(*args, **keywargs)
Test that non-SLOs are not being deleted the SLO way
-
test_delete_slo(*args, **keywargs)
Test we can delete an existing image stored as SLO, static large object
-
test_delete_with_reference_params()
Test we can delete an existing image in the swift store
-
test_delete_with_some_segments_failing()
Tests that delete of a segmented object recovers from error(s) while
deleting one or more segments.
To test this we add a segmented object first and then delete it, while
simulating errors on one or more segments.
-
test_get()
Test a “normal” retrieval of an image in chunks.
-
test_get_connection_manager_failed()
-
test_get_connection_manager_multi_tenant(*args, **keywargs)
-
test_get_connection_manager_single_tenant(*args, **keywargs)
-
test_get_non_existing()
Test that trying to retrieve a swift that doesn’t exist
raises an error
-
test_get_size()
Test that we can get the size of an object in the swift store
-
test_get_size_with_multi_tenant_on()
Test that single tenant uris work with multi tenant on.
-
test_get_with_http_auth()
Test a retrieval from Swift with an HTTP authurl. This is
specified either via a Location header with swift+http:// or using
http:// in the swift_store_auth_address config value
-
test_get_with_retry()
Test a retrieval where Swift does not get the full image in a single
request.
-
test_init_client_multi_tenant(*args, **keywargs)
Test that keystone client was initialized correctly
-
test_multi_container_doesnt_impact_multi_tenant_add(*args, **keywargs)
-
test_no_auth_address()
Tests that options without auth address disables the add method
-
test_no_store_credentials()
Tests that options without a valid credentials disables the add method
-
test_read_acl_public()
Test that we can set a public read acl.
-
test_read_acl_tenants()
Test that we can set read acl for tenants.
-
test_write_acls()
Test that we can set write acl for tenants.
-
class glance_store.tests.unit.test_swift_store.TestChunkReader(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_read_all_data()
Replicate what goes on in the Swift driver with the
repeated creation of the ChunkReader object
-
test_read_zero_size_data()
Replicate what goes on in the Swift driver with the
repeated creation of the ChunkReader object
-
class glance_store.tests.unit.test_swift_store.TestCreatingLocations(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_multi_tenant_location()
-
test_multi_tenant_location_custom_endpoint_type()
-
test_multi_tenant_location_custom_service_type()
-
test_multi_tenant_location_http()
-
test_multi_tenant_location_with_region()
-
test_single_tenant_location()
-
test_single_tenant_location_http()
-
class glance_store.tests.unit.test_swift_store.TestMultiTenantStoreConnections(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_basic_connection_no_catalog()
-
test_connection_with_endpoint_from_catalog()
-
test_connection_with_no_endpoint_found()
-
class glance_store.tests.unit.test_swift_store.TestMultiTenantStoreContext(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
Establish a clean test environment.
-
test_download_context(*args, **kwargs)
Verify context (ie token) is passed to swift on download.
-
test_upload_context(*args, **kwargs)
Verify context (ie token) is passed to swift on upload.
-
class glance_store.tests.unit.test_swift_store.TestMultipleContainers(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_get_container_name_happy_path_with_seed_three()
-
test_get_container_name_with_dash()
-
test_get_container_name_with_max_seed()
-
test_get_container_name_with_min_seed()
-
test_get_container_name_with_multiple_containers_turned_off()
-
test_get_container_name_with_negative_seed()
-
test_get_container_name_with_seed_beyond_max()
-
class glance_store.tests.unit.test_swift_store.TestSingleTenantStoreConnections(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_bad_location_uri()
-
test_bad_location_uri_invalid_credentials()
-
test_bad_location_uri_invalid_object_path()
-
test_basic_connection()
-
test_connection_insecure()
-
test_connection_invalid_user()
-
test_connection_missing_user()
-
test_connection_with_auth_v1()
-
test_connection_with_conf_endpoint()
-
test_connection_with_conf_endpoint_no_context()
-
test_connection_with_endpoint_type()
-
test_connection_with_no_trailing_slash()
-
test_connection_with_region()
-
test_connection_with_service_type()
-
test_ref_overrides_defaults()
-
test_with_v3_auth()
-
class glance_store.tests.unit.test_swift_store.TestStoreAuthV1(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest, glance_store.tests.unit.test_swift_store.SwiftTests, glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
-
getConfig()
-
setUp()
Establish a clean test environment.
-
class glance_store.tests.unit.test_swift_store.TestStoreAuthV2(*args, **kwds)
Bases: glance_store.tests.unit.test_swift_store.TestStoreAuthV1
-
getConfig()
-
test_v2_multi_tenant_location()
-
test_v2_with_no_tenant()
-
class glance_store.tests.unit.test_swift_store.TestStoreAuthV3(*args, **kwds)
Bases: glance_store.tests.unit.test_swift_store.TestStoreAuthV1
-
getConfig()
-
test_init_client_single_tenant(*args, **keywargs)
Test that keystone client was initialized correctly
-
glance_store.tests.unit.test_swift_store.stub_out_swiftclient(stubs, swift_store_auth_version)
glance_store.tests.unit.test_swift_store_utils module
-
class glance_store.tests.unit.test_swift_store_utils.TestSwiftParams(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest
-
setUp()
-
test_multiple_swift_account_disabled()
-
test_multiple_swift_account_enabled()
-
test_swift_config_file_doesnt_exist()
-
test_swift_config_uses_default_values_multiple_account_disabled()
-
test_swift_store_config_validates_for_creds_auth_address()
glance_store.tests.unit.test_vmware_store module
Tests the VMware Datastore backend store
-
class glance_store.tests.unit.test_vmware_store.TestStore(*args, **kwds)
Bases: glance_store.tests.base.StoreBaseTest, glance_store.tests.unit.test_store_capabilities.TestStoreCapabilitiesChecking
-
setUp(*args, **keywargs)
Establish a clean test environment.
-
test_add(*args, **keywargs)
Test that we can add an image via the VMware backend.
-
test_add_ioerror(*args, **keywargs)
-
test_add_size_zero(*args, **keywargs)
Test that when specifying size zero for the image to add,
the actual size of the image is returned.
-
test_add_with_verifier(*args, **keywargs)
Test that the verifier is passed to the _Reader during add.
-
test_add_with_verifier_size_zero(*args, **keywargs)
Test that the verifier is passed to the _ChunkReader during add.
-
test_build_datastore_weighted_map(*args, **keywargs)
-
test_build_datastore_weighted_map_empty_list(*args, **keywargs)
-
test_build_datastore_weighted_map_equal_weight(*args, **keywargs)
-
test_delete(*args, **keywargs)
Test we can delete an existing image in the VMware store.
-
test_delete_non_existing(*args, **keywargs)
Test that trying to delete an image that doesn’t exist raises an error
-
test_get(*args, **keywargs)
Test a “normal” retrieval of an image in chunks.
-
test_get_datacenter_ref(*args, **keywargs)
-
test_get_non_existing(*args, **keywargs)
Test that trying to retrieve an image that doesn’t exist
raises an error
-
test_get_size(*args, **keywargs)
Test we can get the size of an existing image in the VMware store
-
test_get_size_non_existing(*args, **keywargs)
Test that trying to retrieve an image size that doesn’t exist
raises an error
-
test_http_get_max_redirects(*args, **keywargs)
-
test_http_get_redirect(*args, **keywargs)
-
test_http_get_redirect_invalid(*args, **keywargs)
-
test_parse_datastore_info_and_weight()
-
test_parse_datastore_info_and_weight_default_weight()
-
test_parse_datastore_info_and_weight_empty_opts()
-
test_parse_datastore_info_and_weight_invalid_weight()
-
test_parse_datastore_info_and_weight_less_opts()
-
test_qs_sort_with_literal_question_mark()
-
test_reader_full()
-
test_reader_partial()
-
test_reader_with_verifier()
-
test_reset_session(*args, **keywargs)
-
test_sanity_check_api_retry_count()
Test that sanity check raises if api_retry_count is <= 0.
-
test_sanity_check_multiple_datastores()
-
test_sanity_check_task_poll_interval()
Test that sanity check raises if task_poll_interval is <= 0.
-
test_select_datastore_contention(*args, **keywargs)
-
test_select_datastore_empty_list()
-
test_select_datastore_equal_freespace(*args, **keywargs)
-
test_select_datastore_insufficient_freespace(*args, **keywargs)
-
test_select_datastore_insufficient_fs_one_ds(*args, **keywargs)
-
test_unexpected_status(*args, **keywargs)
-
test_unexpected_status_no_response_body(*args, **keywargs)
-
glance_store.tests.unit.test_vmware_store.fake_datastore_obj(*args, **kwargs)
-
glance_store.tests.unit.test_vmware_store.format_location(host_ip, folder_name, image_id, datastores)
Helper method that returns a VMware Datastore store URI given
the component pieces.
Module contents