2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-23 02:27:09 +00:00
vinyldns/modules/api/functional_test/vinyldns_context.py
Paul Cleary 730c6f8897
Par func tests (#838)
Major overhaul of func tests to allow them to run in parallel.  Major changes include:

1. Consolidate all separate test fixtures into a single test fixture in the `shared_zone_test_context`
1. Add `xdist` to allow running tests in parallel
1. Add hooks in main `conftest.py` to setup the test fixture before workers run, and tear it down when workers are finished
1. After fixture is setup, save state in a local `tmp.out` so the workers will use that state instead of trying to recreate the fixture.
1. Add a `utils.generate_record_name` which generates a unique record name in order to avoid conflicts when running tests in parallel
1. Add a `pytest.mark.serial` for func tests that just cannot be run in serial
1. Tests are now run in two phases, first we run in parallel, and if that is successful, we run the serial tests
1. Add a `--teardown` flag, this allows us to reuse the test fixture between the two phases parallel and serial
2019-09-18 15:02:25 -04:00

19 lines
705 B
Python

class VinylDNSTestContext:
dns_ip = 'localhost'
dns_zone_name = 'vinyldns.'
dns_rev_v4_zone_name = '10.10.in-addr.arpa.'
dns_rev_v6_zone_name = '1.9.e.f.c.c.7.2.9.6.d.f.ip6.arpa.'
dns_key_name = 'vinyldns.'
dns_key = 'nzisn+4G2ldMn0q1CV3vsg=='
vinyldns_url = 'http://localhost:9000'
teardown = True
@staticmethod
def configure(ip, zone, key_name, key, url, teardown):
VinylDNSTestContext.dns_ip = ip
VinylDNSTestContext.dns_zone_name = zone
VinylDNSTestContext.dns_key_name = key_name
VinylDNSTestContext.dns_key = key
VinylDNSTestContext.vinyldns_url = url
VinylDNSTestContext.teardown = teardown.lower() == 'true'