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
Submodules¶
glance.tests.functional.store_utils module¶
Utility methods to set testcases up for Swift tests.
glance.tests.functional.test_api module¶
Version-independent api tests
-
class
glance.tests.functional.test_api.
TestApiPaths
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
-
test_get_images_path
()[source]¶ Assert GET /images with no Accept: header. Verify version choices returned.
-
test_get_images_path_with_openstack_header
()[source]¶ Assert GET /images with a Accept: application/vnd.openstack.compute-v1 header. Verify version choices returned. Verify message in API log about unknown accept header.
-
test_get_images_path_with_openstack_v2_header
()[source]¶ Assert GET /images with a Accept: application/vnd.openstack.compute-v2 header. Verify version choices returned. Verify message in API log about unknown version in accept header.
-
test_get_root_path
()[source]¶ Assert GET / with no Accept: header. Verify version choices returned. Bug lp:803260 no Accept header causes a 500 in glance-api
-
test_get_root_path_with_openstack_header
()[source]¶ Assert GET / with an Accept: application/vnd.openstack.images-v1 Verify empty image list returned
-
test_get_root_path_with_unknown_header
()[source]¶ Assert GET / with Accept: unknown header Verify version choices returned. Verify message in API log about unknown accept header.
-
test_get_v10_images_path
()[source]¶ Assert GET /v1.0/images with no Accept: header Verify version choices returned
-
test_get_v12_images_path
()[source]¶ Assert GET /v1.2/images with no Accept: header Verify version choices returned
-
test_get_v1_images_path
()[source]¶ GET /v1/images with no Accept: header. Verify empty images list returned.
-
test_get_v1_versions_path
()[source]¶ Assert GET /v1/versions with no Accept: header Verify 404 returned
-
test_get_v1a_images_path
()[source]¶ Assert GET /v1.a/images with no Accept: header Verify version choices returned
-
test_get_va1_images_path
()[source]¶ Assert GET /va.1/images with no Accept: header Verify version choices returned
-
glance.tests.functional.test_bin_glance_cache_manage module¶
Functional test case that utilizes the bin/glance-cache-manage CLI tool
-
class
glance.tests.functional.test_bin_glance_cache_manage.
TestBinGlanceCacheManage
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
Functional tests for the bin/glance CLI tool
glance.tests.functional.test_cache_middleware module¶
Tests a Glance API server which uses the caching middleware that uses the default SQLite cache driver. We use the filesystem store, but that is really not relevant, as the image cache is transparent to the backend store.
-
class
glance.tests.functional.test_cache_middleware.
BaseCacheManageMiddlewareTest
[source]¶ Bases:
object
Base test class for testing cache management middleware
-
test_cache_manage_delete_cached_images
(*a, **kwargs)[source]¶ Tests that cached images may be deleted
-
test_cache_manage_delete_queued_images
(*a, **kwargs)[source]¶ Tests that all queued images may be deleted at once
-
-
class
glance.tests.functional.test_cache_middleware.
BaseCacheMiddlewareTest
[source]¶ Bases:
object
-
test_cache_middleware_trans_v1_without_download_image_policy
(*a, **kwargs)[source]¶ Ensure the image v1 API image transfer applied ‘download_image’ policy enforcement.
-
test_cache_middleware_trans_v2_without_download_image_policy
(*a, **kwargs)[source]¶ Ensure the image v2 API image transfer applied ‘download_image’ policy enforcement.
-
test_cache_middleware_trans_with_deactivated_image
(*a, **kwargs)[source]¶ Ensure the image v1/v2 API image transfer forbids downloading deactivated images. Image deactivation is not available in v1. So, we’ll deactivate the image using v2 but test image transfer with both v1 and v2.
-
test_cache_middleware_transparent_v1
(*a, **kwargs)[source]¶ We test that putting the cache middleware into the application pipeline gives us transparent image caching
-
-
class
glance.tests.functional.test_cache_middleware.
TestImageCacheManageSqlite
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
,glance.tests.functional.test_cache_middleware.BaseCacheManageMiddlewareTest
Functional tests that exercise the image cache management using the SQLite driver
-
class
glance.tests.functional.test_cache_middleware.
TestImageCacheManageXattr
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
,glance.tests.functional.test_cache_middleware.BaseCacheManageMiddlewareTest
Functional tests that exercise the image cache management with the Xattr cache driver
-
class
glance.tests.functional.test_cache_middleware.
TestImageCacheSqlite
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
,glance.tests.functional.test_cache_middleware.BaseCacheMiddlewareTest
Functional tests that exercise the image cache using the SQLite driver
-
class
glance.tests.functional.test_cache_middleware.
TestImageCacheXattr
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
,glance.tests.functional.test_cache_middleware.BaseCacheMiddlewareTest
Functional tests that exercise the image cache using the xattr driver
glance.tests.functional.test_client_exceptions module¶
Functional test asserting strongly typed exceptions from glance client
-
class
glance.tests.functional.test_client_exceptions.
ExceptionTestApp
[source]¶ Bases:
object
Test WSGI application which can respond with multiple kinds of HTTP status codes
-
class
glance.tests.functional.test_client_exceptions.
TestClientExceptions
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
-
test_server_traceback
()[source]¶ Verify that the wsgi server does not return tracebacks to the client on 500 errors (bug 1192132)
Test service unavailable response
Test service unavailable response with retry
-
glance.tests.functional.test_client_redirects module¶
Functional test cases testing glance client redirect-following.
-
class
glance.tests.functional.test_client_redirects.
TestClientRedirects
(*args, **kwargs)[source]¶
glance.tests.functional.test_cors_middleware module¶
Tests cors middleware.
-
class
glance.tests.functional.test_cors_middleware.
TestCORSMiddleware
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
Provide a basic smoke test to ensure CORS middleware is active.
The tests below provide minimal confirmation that the CORS middleware is active, and may be configured. For comprehensive tests, please consult the test suite in oslo_middleware.
glance.tests.functional.test_glance_manage module¶
Functional test cases for glance-manage
glance.tests.functional.test_glance_replicator module¶
Functional test cases for glance-replicator
-
class
glance.tests.functional.test_glance_replicator.
TestGlanceReplicator
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
Functional tests for glance-replicator
glance.tests.functional.test_gzip_middleware module¶
Tests gzip middleware.
glance.tests.functional.test_healthcheck_middleware module¶
Tests healthcheck middleware.
glance.tests.functional.test_logging module¶
Functional test case that tests logging output
-
class
glance.tests.functional.test_logging.
TestLogging
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
Functional tests for Glance’s logging output
glance.tests.functional.test_reload module¶
-
class
glance.tests.functional.test_reload.
TestReload
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
Test configuration reload
-
ticker
(message, seconds=60, tick=0.01)[source]¶ Allows repeatedly testing for an expected result for a finite amount of time.
Parameters: - message – Message to display on timeout
- seconds – Time in seconds after which we timeout
- tick – Time to sleep before rechecking for expected result
Returns: ‘True’ or fails the test with ‘message’ on timeout
-
glance.tests.functional.test_scrubber module¶
-
class
glance.tests.functional.test_scrubber.
TestScrubber
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
Test that delayed_delete works and the scrubber deletes
-
test_delayed_delete
()[source]¶ test that images don’t get deleted immediately and that the scrubber scrubs them
-
test_delayed_delete_with_trustedauth_registry
()[source]¶ test that images don’t get deleted immediately and that the scrubber scrubs them when registry is operating in trustedauth mode
-
test_scrubber_app
()[source]¶ test that the glance-scrubber script runs successfully when not in daemon mode
-
test_scrubber_app_with_trustedauth_registry
()[source]¶ test that the glance-scrubber script runs successfully when not in daemon mode and with a registry that operates in trustedauth mode
-
glance.tests.functional.test_sqlite module¶
Functional test cases for sqlite-specific logic
-
class
glance.tests.functional.test_sqlite.
TestSqlite
(*args, **kwargs)[source]¶ Bases:
glance.tests.functional.FunctionalTest
Functional tests for sqlite-specific logic
-
test_big_int_mapping
(*args, **kw)¶ Ensure BigInteger not mapped to BIGINT
-
glance.tests.functional.test_ssl module¶
glance.tests.functional.test_wsgi module¶
Tests for glance.wsgi.
Module contents¶
Base test class for running non-stubbed tests (functional tests)
The FunctionalTest class contains helper methods for starting the API and Registry server, grabbing the logs of each, cleaning up pidfiles, and spinning down the servers.
-
class
glance.tests.functional.
ApiServer
(test_dir, port, policy_file, delayed_delete=False, pid_file=None, sock=None, **kwargs)[source]¶ Bases:
glance.tests.functional.Server
Server object that starts/stops/manages the API server
-
class
glance.tests.functional.
FunctionalTest
(*args, **kwargs)[source]¶ Bases:
glance.tests.utils.BaseTestCase
Base test class for any test that wants to test the actual servers and clients and not just the stubbed out interfaces
-
cleanup
()[source]¶ Makes sure anything we created or started up in the tests are destroyed or spun down
-
disabled
= False¶
-
inited
= False¶
-
launched_servers
= []¶
-
ping_server
(port)[source]¶ Simple ping on the port. If responsive, return True, else return False.
:note We use raw sockets, not ping here, since ping uses ICMP and has no concept of ports...
-
ping_server_ipv6
(port)[source]¶ Simple ping on the port. If responsive, return True, else return False.
:note We use raw sockets, not ping here, since ping uses ICMP and has no concept of ports...
The function uses IPv6 (therefore AF_INET6 and ::1).
-
run_sql_cmd
(sql)[source]¶ Provides a crude mechanism to run manual SQL commands for backend DB verification within the functional tests. The raw result set is returned.
-
start_server
(server, expect_launch, expect_exit=True, expected_exitcode=0, **kwargs)[source]¶ Starts a server on an unused port.
Any kwargs passed to this method will override the configuration value in the conf file used in starting the server.
Parameters: - server – the server to launch
- expect_launch – true iff the server is expected to successfully start
- expect_exit – true iff the launched process is expected to exit in a timely fashion
- expected_exitcode – expected exitcode from the launcher
-
start_servers
(**kwargs)[source]¶ Starts the API and Registry servers (glance-control api start & glance-control registry start) on unused ports. glance-control should be installed into the python path
Any kwargs passed to this method will override the configuration value in the conf file used in starting the servers.
-
start_with_retry
(server, port_name, max_retries, expect_launch=True, **kwargs)[source]¶ Starts a server, with retries if the server launches but fails to start listening on the expected port.
Parameters: - server – the server to launch
- port_name – the name of the port attribute
- max_retries – the maximum number of attempts
- expect_launch – true iff the server is expected to successfully start
- expect_exit – true iff the launched process is expected to exit in a timely fashion
-
stop_server
(server, name)[source]¶ Called to stop a single server in a normal fashion using the glance-control stop method to gracefully shut the server down.
Parameters: server – the server to stop
-
stop_servers
()[source]¶ Called to stop the started servers in a normal fashion. Note that cleanup() will stop the servers using a fairly draconian method of sending a SIGTERM signal to the servers. Here, we use the glance-control stop method to gracefully shut the server down. This method also asserts that the shutdown was clean, and so it is meant to be called during a normal test case sequence.
-
wait_for_servers
(servers, expect_launch=True, timeout=30)[source]¶ Tight loop, waiting for the given server port(s) to be available. Returns when all are pingable. There is a timeout on waiting for the servers to come up.
Parameters: - servers – Glance server ports to ping
- expect_launch – Optional, true iff the server(s) are expected to successfully start
- timeout – Optional, defaults to 30 seconds
Returns: None if launch expectation is met, otherwise an assertion message
-
-
class
glance.tests.functional.
RegistryServer
(test_dir, port, policy_file, sock=None)[source]¶ Bases:
glance.tests.functional.Server
Server object that starts/stops/manages the Registry server
-
class
glance.tests.functional.
ScrubberDaemon
(test_dir, policy_file, daemon=False, **kwargs)[source]¶ Bases:
glance.tests.functional.Server
Server object that starts/stops/manages the Scrubber server
-
class
glance.tests.functional.
Server
(test_dir, port, sock=None)[source]¶ Bases:
object
Class used to easily manage starting and stopping a server during functional test runs.
-
reload
(expect_exit=True, expected_exitcode=0, **kwargs)[source]¶ Start and stop the service to reload
Any kwargs passed to this method will override the configuration value in the conf file used in starting the servers.
-