Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: start using btlr #3959

Merged
merged 18 commits into from
Jun 9, 2020
Prev Previous commit
Next Next commit
[dns] testing: more retries with delay
  • Loading branch information
Takashi Matsuo committed Jun 8, 2020
commit 70939eee26623e565fb6becf0e7aca9baf122100
16 changes: 11 additions & 5 deletions dns/api/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# limitations under the License.

import os
import time
import uuid

from google.cloud import dns
Expand All @@ -27,6 +28,11 @@
TEST_ZONE_DESCRIPTION = 'Test zone'


def delay_rerun(*args):
time.sleep(5)
return True


@pytest.yield_fixture
def client():
client = dns.Client(PROJECT)
Expand Down Expand Up @@ -69,7 +75,7 @@ def test_create_zone(client):
assert zone.description == TEST_ZONE_DESCRIPTION


@pytest.mark.flaky
@pytest.mark.flaky(max_runs=3, min_passes=1, rerun_filter=delay_rerun)
def test_get_zone(client, zone):
zone = main.get_zone(PROJECT, TEST_ZONE_NAME)

Expand All @@ -78,27 +84,27 @@ def test_get_zone(client, zone):
assert zone.description == TEST_ZONE_DESCRIPTION


@pytest.mark.flaky
@pytest.mark.flaky(max_runs=3, min_passes=1, rerun_filter=delay_rerun)
def test_list_zones(client, zone):
zones = main.list_zones(PROJECT)

assert TEST_ZONE_NAME in zones


@pytest.mark.flaky
@pytest.mark.flaky(max_runs=3, min_passes=1, rerun_filter=delay_rerun)
def test_list_resource_records(client, zone):
records = main.list_resource_records(PROJECT, TEST_ZONE_NAME)

assert records


@pytest.mark.flaky
@pytest.mark.flaky(max_runs=3, min_passes=1, rerun_filter=delay_rerun)
def test_list_changes(client, zone):
changes = main.list_changes(PROJECT, TEST_ZONE_NAME)

assert changes


@pytest.mark.flaky
@pytest.mark.flaky(max_runs=3, min_passes=1, rerun_filter=delay_rerun)
def test_delete_zone(client, zone):
main.delete_zone(PROJECT, TEST_ZONE_NAME)