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'}]¶
-
patch
(url, data, status=200, headers=None)[source]¶ Monkey-patch ‘obj.attribute’ to ‘value’ while the test is running.
If ‘obj’ has no attribute, then the monkey-patch will still go ahead, and the attribute will be deleted instead of restored to its original value.
Parameters: - obj – The object to patch. Can be anything.
- attribute – The attribute on ‘obj’ to patch.
- value – The value to set ‘obj.attribute’ to.
-
users
= {'admin': {'id': '213a6080-e30e-435e-8b24-941e0574280f', 'role': 'admin', 'tenant_id': '3bdfee97-ab73-478a-8b82-142ef0aa62c6', 'token': 'bf274109-3e27-4692-935e-e87deccebff0'}, 'anonymous': {'id': None, 'role': None, 'tenant_id': None, 'token': None}, 'user1': {'id': '1e397885-21f2-4e3f-927d-8c408b156df3', 'role': 'member', 'tenant_id': 'ade66340-d079-4e39-8a21-e3d114d0c2e9', 'token': 'cc78154a-c92a-45dd-80dc-6073c0024704'}, 'user2': {'id': '9abfc6af-0b61-4678-8a45-791b12ed683b', 'role': 'member', 'tenant_id': 'a2b1f01a-bcc1-4455-9acf-5ea744a9230e', 'token': 'e0c78346-0452-4b34-8ff2-beb007d4a73e'}}¶
-
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.TestArtifact
Test dynamic quota limits.
-
class
glare.tests.functional.test_quotas.
TestQuotasAPI
(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.base.TestArtifact
Test quotas REST API.
-
class
glare.tests.functional.test_quotas.
TestStaticQuotas
(*args, **kwargs)[source]¶ Bases:
glare.tests.functional.base.TestArtifact
Test static quota limits.
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.TestArtifact
Test 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.TestArtifact
Test 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.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…
-
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.Server
Server object that starts/stops/manages Glare server
-
class
glare.tests.functional.
ScrubberDaemon
(test_dir, policy_file, daemon=False, **kwargs)[source]¶ Bases:
glare.tests.functional.Server
Server object that starts/stops/manages the Scrubber server
-
class
glare.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.
-
-
class
glare.tests.functional.
TestRouter
(mapper)[source]¶ Bases:
glare.api.v1.router.API