787bb33606
Adjust the fixtures used by the functional tests so they use placement database and web fixtures defined by placement code. To avoid making redundant changes, the solely placement- related unit and functional tests are removed, but the placement code itself is not (yet). openstack-placement is required by the functional tests. It is not added to test-requirements as we do not want unit tests to depend on placement in any way, and we enforce this by not having placement in the test env. The concept of tox-siblings is used to ensure that the placement requirement will be satisfied correctly if there is a depends-on. To make this happen, the functional jobs defined in .zuul.yaml are updated to require openstack/placement. tox.ini has to be updated to use a envdir that is the same name as job. Otherwise the tox siblings role in ansible cannot work. The handling of the placement fixtures is moved out of nova/test.py into the functional tests that actually use it because we do not want unit tests (which get the base test class out of test.py) to have anything to do with placement. This requires adjusting some test files to use absolute import. Similarly, a test of the comparison function for the api samples tests is moved into functional, because it depends on placement functionality, TestUpgradeCheckResourceProviders in unit.cmd.test_status is moved into a new test file: nova/tests/functional/test_nova_status.py. This is done because it requires the PlacementFixture, which is only available to functional tests. A MonkeyPatch is required in the test to make sure that the right context managers are used at the right time in the command itself (otherwise some tables do no exist). In the test itself, to avoid speaking directly to the placement database, which would require manipulating the RequestContext objects, resource providers are now created over the API. Co-Authored-By: Balazs Gibizer <balazs.gibizer@ericsson.com> Change-Id: Idaed39629095f86d24a54334c699a26c218c6593 |
||
---|---|---|
.. | ||
api_samples | ||
__init__.py | ||
api_sample_base.py | ||
README.rst | ||
test_admin_actions.py | ||
test_admin_password.py | ||
test_agents.py | ||
test_aggregates.py | ||
test_assisted_volume_snapshots.py | ||
test_attach_interfaces.py | ||
test_availability_zone.py | ||
test_baremetal_nodes.py | ||
test_block_device_mapping_boot.py | ||
test_cells.py | ||
test_compare_result.py | ||
test_console_auth_tokens.py | ||
test_console_output.py | ||
test_consoles.py | ||
test_create_backup.py | ||
test_deferred_delete.py | ||
test_evacuate.py | ||
test_extension_info.py | ||
test_fixed_ips.py | ||
test_flavor_access.py | ||
test_flavor_extraspecs.py | ||
test_flavor_manage.py | ||
test_flavors.py | ||
test_floating_ip_dns.py | ||
test_floating_ip_pools.py | ||
test_floating_ips_bulk.py | ||
test_floating_ips.py | ||
test_fping.py | ||
test_hosts.py | ||
test_hypervisors.py | ||
test_images.py | ||
test_instance_actions.py | ||
test_instance_usage_audit_log.py | ||
test_keypairs.py | ||
test_limits.py | ||
test_lock_server.py | ||
test_migrate_server.py | ||
test_migrations.py | ||
test_multinic.py | ||
test_multiple_create.py | ||
test_networks_associate.py | ||
test_networks.py | ||
test_pause_server.py | ||
test_preserve_ephemeral_rebuild.py | ||
test_quota_classes.py | ||
test_quota_sets.py | ||
test_remote_consoles.py | ||
test_rescue.py | ||
test_security_group_default_rules.py | ||
test_security_groups.py | ||
test_server_diagnostics.py | ||
test_server_external_events.py | ||
test_server_groups.py | ||
test_server_metadata.py | ||
test_server_migrations.py | ||
test_server_password.py | ||
test_server_tags.py | ||
test_servers_ips.py | ||
test_servers.py | ||
test_services.py | ||
test_shelve.py | ||
test_simple_tenant_usage.py | ||
test_suspend_server.py | ||
test_tenant_networks.py | ||
test_versions.py | ||
test_virtual_interfaces.py | ||
test_volumes.py |
Api Samples
This part of the tree contains templates for API samples. The documentation in doc/api_samples is completely autogenerated from the tests in this directory.
To add a new api sample, add tests for the common passing and failing cases in this directory for your extension, and modify test_samples.py for your tests.
Then run the following command:
tox -e api-samples
Which will create the files on doc/api_samples.
If new tests are added or the .tpl files are changed due to bug fixes, the samples must be regenerated so they are in sync with the templates, as there is an additional test which reloads the documentation and ensures that it's in sync.
Debugging sample generation
If a .tpl is changed, its matching .json must be removed else the samples won't be generated. If an entirely new extension is added, a directory for it must be created before its samples will be generated.