glare.tests.functional package¶
Submodules¶
glare.tests.functional.base module¶
-
class
glare.tests.functional.base.TestArtifact(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.FunctionalTest-
enabled_types= (u’sample_artifact’, u’images’, u’heat_templates’, u’heat_environments’, u’tosca_templates’, u’murano_packages’, u’all’)¶
-
make_active= [{‘path’: ‘/status’, ‘value’: ‘active’, ‘op’: ‘replace’}]¶
-
make_deactivated= [{‘path’: ‘/status’, ‘value’: ‘deactivated’, ‘op’: ‘replace’}]¶
-
make_public= [{‘path’: ‘/visibility’, ‘value’: ‘public’, ‘op’: ‘replace’}]¶
-
users= {‘admin’: {‘tenant_id’: ‘6b655798-dc16-4b12-a371-cdedc29486e3’, ‘token’: ‘e4fe1e5c-4237-4e1b-ab0c-c2f23a10eaae’, ‘role’: ‘admin’, ‘id’: ‘20e5a0c2-588b-4480-8081-fe24cc97666a’}, ‘user2’: {‘tenant_id’: ‘a36a9784-178b-46e2-956b-30655a8ff953’, ‘token’: ‘38892ef3-7490-4c12-b5ca-9e8f9650f48d’, ‘role’: ‘member’, ‘id’: ‘02160f46-7c7e-489f-8a6c-ccd370112625’}, ‘anonymous’: {‘tenant_id’: None, ‘token’: None, ‘role’: None, ‘id’: None}, ‘user1’: {‘tenant_id’: ‘1bbcb83d-f046-4238-b6b1-9be1d6fad150’, ‘token’: ‘a851842e-c51c-430d-9d63-b65c1f6ac6ac’, ‘role’: ‘member’, ‘id’: ‘aa4325a7-b6bd-48e8-a473-5bfeb81f6c4c’}}¶
-
glare.tests.functional.test_all module¶
glare.tests.functional.test_database_store module¶
glare.tests.functional.test_quotas module¶
-
class
glare.tests.functional.test_quotas.TestDynamicQuotas(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.base.TestArtifactTest dynamic quota limits.
-
class
glare.tests.functional.test_quotas.TestQuotasAPI(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.base.TestArtifactTest quotas REST API.
glare.tests.functional.test_sample_artifact module¶
-
class
glare.tests.functional.test_sample_artifact.TestTags(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.base.TestArtifact
glare.tests.functional.test_schemas module¶
glare.tests.functional.test_scrubber module¶
-
class
glare.tests.functional.test_scrubber.TestScrubber(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.base.TestArtifactTest that delayed_delete works and the scrubber deletes
-
test_scrubber_app()[source]¶ Test that the scrubber script runs successfully when not in daemon mode.
-
glare.tests.functional.test_visibility module¶
-
class
glare.tests.functional.test_visibility.TestVisibility(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.base.TestArtifactTest Glare artifact visibility for various users.
Module contents¶
Base test class for running non-stubbed tests (functional tests)
The FunctionalTest class contains helper methods for starting Glare server, grabbing the logs of each, cleaning up pidfiles, and spinning down the server.
-
class
glare.tests.functional.FunctionalTest(*args, **kwargs)[source]¶ Bases:
glare.tests.utils.BaseTestCaseBase 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…
-
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 Glare server on unused port.
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)[source]¶ Called to stop a single server in a normal fashion.
Parameters: server – the server to stop
-
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 – Glare 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
glare.tests.functional.GlareServer(test_dir, port, policy_file, delayed_delete=False, pid_file=None, sock=None, **kwargs)[source]¶ Bases:
glare.tests.functional.ServerServer object that starts/stops/manages Glare server
-
class
glare.tests.functional.ScrubberDaemon(test_dir, policy_file, daemon=False, **kwargs)[source]¶ Bases:
glare.tests.functional.ServerServer object that starts/stops/manages the Scrubber server
-
class
glare.tests.functional.Server(test_dir, port, sock=None)[source]¶ Bases:
objectClass 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.
-
-
class
glare.tests.functional.TestRouter(mapper)[source]¶ Bases:
glare.api.v1.router.API