glance.tests package¶
Subpackages¶
- glance.tests.functional package
- Subpackages
- glance.tests.functional.db package
- Subpackages
- glance.tests.functional.db.migrations package
- Submodules
- glance.tests.functional.db.migrations.test_mitaka01 module
- glance.tests.functional.db.migrations.test_mitaka02 module
- glance.tests.functional.db.migrations.test_ocata01 module
- glance.tests.functional.db.migrations.test_ocata_contract01 module
- glance.tests.functional.db.migrations.test_ocata_expand01 module
- glance.tests.functional.db.migrations.test_ocata_migrate01 module
- Module contents
- glance.tests.functional.db.migrations package
- Submodules
- glance.tests.functional.db.base module
- glance.tests.functional.db.base_glare module
- glance.tests.functional.db.base_metadef module
- glance.tests.functional.db.test_migrations module
- glance.tests.functional.db.test_registry module
- glance.tests.functional.db.test_rpc_endpoint module
- glance.tests.functional.db.test_simple module
- glance.tests.functional.db.test_sqlalchemy module
- Module contents
- Subpackages
- glance.tests.functional.glare package
- glance.tests.functional.v1 package
- glance.tests.functional.v2 package
- Submodules
- glance.tests.functional.v2.registry_data_api module
- glance.tests.functional.v2.test_images module
- glance.tests.functional.v2.test_metadef_namespaces module
- glance.tests.functional.v2.test_metadef_objects module
- glance.tests.functional.v2.test_metadef_properties module
- glance.tests.functional.v2.test_metadef_resourcetypes module
- glance.tests.functional.v2.test_metadef_tags module
- glance.tests.functional.v2.test_schemas module
- glance.tests.functional.v2.test_tasks module
- Module contents
- glance.tests.functional.db package
- Submodules
- glance.tests.functional.store_utils module
- glance.tests.functional.test_api module
- glance.tests.functional.test_bin_glance_cache_manage module
- glance.tests.functional.test_cache_middleware module
- glance.tests.functional.test_client_exceptions module
- glance.tests.functional.test_client_redirects module
- glance.tests.functional.test_cors_middleware module
- glance.tests.functional.test_glance_manage module
- glance.tests.functional.test_glance_replicator module
- glance.tests.functional.test_gzip_middleware module
- glance.tests.functional.test_healthcheck_middleware module
- glance.tests.functional.test_logging module
- glance.tests.functional.test_reload module
- glance.tests.functional.test_scrubber module
- glance.tests.functional.test_sqlite module
- glance.tests.functional.test_ssl module
- glance.tests.functional.test_wsgi module
- Module contents
- Subpackages
- glance.tests.integration package
- glance.tests.unit package
- Subpackages
- glance.tests.unit.api package
- glance.tests.unit.async package
- glance.tests.unit.common package
- Subpackages
- Submodules
- glance.tests.unit.common.test_client module
- glance.tests.unit.common.test_config module
- glance.tests.unit.common.test_exception module
- glance.tests.unit.common.test_location_strategy module
- glance.tests.unit.common.test_property_utils module
- glance.tests.unit.common.test_rpc module
- glance.tests.unit.common.test_scripts module
- glance.tests.unit.common.test_semver module
- glance.tests.unit.common.test_swift_store_utils module
- glance.tests.unit.common.test_timeutils module
- glance.tests.unit.common.test_utils module
- glance.tests.unit.common.test_wsgi module
- glance.tests.unit.common.test_wsgi_ipv6 module
- Module contents
- glance.tests.unit.v1 package
- glance.tests.unit.v2 package
- Submodules
- glance.tests.unit.v2.test_image_actions_resource module
- glance.tests.unit.v2.test_image_data_resource module
- glance.tests.unit.v2.test_image_members_resource module
- glance.tests.unit.v2.test_image_tags_resource module
- glance.tests.unit.v2.test_images_resource module
- glance.tests.unit.v2.test_metadef_resources module
- glance.tests.unit.v2.test_registry_api module
- glance.tests.unit.v2.test_registry_client module
- glance.tests.unit.v2.test_schemas_resource module
- glance.tests.unit.v2.test_tasks_resource module
- Module contents
- Submodules
- glance.tests.unit.base module
- glance.tests.unit.fake_rados module
- glance.tests.unit.test_auth module
- glance.tests.unit.test_cache_middleware module
- glance.tests.unit.test_cached_images module
- glance.tests.unit.test_context module
- glance.tests.unit.test_context_middleware module
- glance.tests.unit.test_data_migration_framework module
- glance.tests.unit.test_db module
- glance.tests.unit.test_db_metadef module
- glance.tests.unit.test_domain module
- glance.tests.unit.test_domain_proxy module
- glance.tests.unit.test_glance_manage module
- glance.tests.unit.test_glance_replicator module
- glance.tests.unit.test_glare_plugin_loader module
- glance.tests.unit.test_glare_type_definition_framework module
- glance.tests.unit.test_image_cache module
- glance.tests.unit.test_image_cache_client module
- glance.tests.unit.test_jsonpatchmixin module
- glance.tests.unit.test_manage module
- glance.tests.unit.test_misc module
- glance.tests.unit.test_notifier module
- glance.tests.unit.test_policy module
- glance.tests.unit.test_quota module
- glance.tests.unit.test_schema module
- glance.tests.unit.test_scrubber module
- glance.tests.unit.test_store_glare module
- glance.tests.unit.test_store_image module
- glance.tests.unit.test_store_location module
- glance.tests.unit.test_versions module
- glance.tests.unit.utils module
- Module contents
- Subpackages
Submodules¶
glance.tests.stubs module¶
Stubouts, mocks and fixtures for the test suite
glance.tests.test_hacking module¶
glance.tests.utils module¶
Common utilities used in testing
-
class
glance.tests.utils.
BaseTestCase
(*args, **kwargs)[source]¶ Bases:
testtools.testcase.TestCase
-
config
(**kw)[source]¶ Override some configuration values.
The keyword arguments are the names of configuration options to override and their values.
If a group argument is supplied, the overrides are applied to the specified configuration option group.
All overrides are automatically cleared at the end of the current test by the fixtures cleanup process.
-
-
class
glance.tests.utils.
FakeHTTPResponse
(status=200, headers=None, data=None, *args, **kwargs)[source]¶ Bases:
object
-
class
glance.tests.utils.
RegistryAPIMixIn
[source]¶ Bases:
object
-
glance.tests.utils.
db_sync
(version=None, engine=None)[source]¶ Migrate the database to version or the most recent version.
-
class
glance.tests.utils.
depends_on_exe
(exe)[source]¶ Bases:
object
Decorator to skip test if an executable is unavailable
-
glance.tests.utils.
execute
(cmd, raise_error=True, no_venv=False, exec_env=None, expect_exit=True, expected_exitcode=0, context=None)[source]¶ Executes a command in a subprocess. Returns a tuple of (exitcode, out, err), where out is the string output from stdout and err is the string output from stderr when executing the command.
Parameters: - cmd – Command string to execute
- raise_error – If returncode is not 0 (success), then raise a RuntimeError? Default: True)
- no_venv – Disable the virtual environment
- exec_env – Optional dictionary of additional environment variables; values may be callables, which will be passed the current value of the named environment variable
- expect_exit – Optional flag true iff timely exit is expected
- expected_exitcode – expected exitcode from the launcher
- context – additional context for error message
-
glance.tests.utils.
find_executable
(cmdname)[source]¶ Searches the path for a given cmdname. Returns an absolute filename if an executable with the given name exists in the path, or None if one does not.
Parameters: cmdname – The bare name of the executable to search for
-
glance.tests.utils.
fork_exec
(cmd, exec_env=None, logfile=None, pass_fds=None)[source]¶ Execute a command using fork/exec.
This is needed for programs system executions that need path searching but cannot have a shell as their parent process, for example: glance-api. When glance-api starts it sets itself as the parent process for its own process group. Thus the pid that a Popen process would have is not the right pid to use for killing the process group. This patch gives the test env direct access to the actual pid.
Parameters: - cmd – Command to execute as an array of arguments.
- exec_env – A dictionary representing the environment with which to run the command.
- logfile – A path to a file which will hold the stdout/err of the child process.
- pass_fds – Sequence of file descriptors passed to the child.
-
glance.tests.utils.
get_unused_port_and_socket
()[source]¶ Returns an unused port on localhost and the open socket from which it was created.
-
glance.tests.utils.
get_unused_port_and_socket_ipv6
()[source]¶ Returns an unused port on localhost and the open socket from which it was created, but uses IPv6 (::1).
-
glance.tests.utils.
get_unused_port_ipv6
()[source]¶ Returns an unused port on localhost on IPv6 (uses ::1).
-
class
glance.tests.utils.
requires
(setup=None, teardown=None)[source]¶ Bases:
object
Decorator that initiates additional test setup/teardown.
-
glance.tests.utils.
skip_if_disabled
(func)[source]¶ Decorator that skips a test if test case is disabled.