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

[iot] fix: mitigate flaky tests #3299

Merged
merged 3 commits into from
Apr 8, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions iot/api-client/manager/manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

# Add command receiver for bootstrapping device registry / device for testing
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'mqtt_example')) # noqa
from flaky import flaky
from google.cloud import pubsub
import pytest

Expand All @@ -33,7 +32,7 @@
es_cert_path = 'resources/ec_public.pem'
rsa_cert_path = 'resources/rsa_cert.pem'
rsa_private_path = 'resources/rsa_private.pem' # Must match rsa_cert
topic_id = 'test-device-events-{}'.format(int(time.time()))
topic_id = 'test-device-events-{}'.format(uuid.uuid4())

project_id = os.environ['GCLOUD_PROJECT']
service_account_json = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
Expand Down Expand Up @@ -202,6 +201,7 @@ def test_add_delete_unauth_device(test_topic, capsys):
assert 'UNAUTH' in out


@pytest.mark.flaky(max_runs=5, min_passes=1)
def test_add_config_unauth_device(test_topic, capsys):
device_id = device_id_template.format('UNAUTH')
manager.open_registry(
Expand Down Expand Up @@ -363,7 +363,7 @@ def test_add_patch_delete_es256(test_topic, capsys):
service_account_json, project_id, cloud_region, registry_id)


@flaky(max_runs=5, min_passes=1)
@pytest.mark.flaky(max_runs=5, min_passes=1)
def test_send_command(test_topic, capsys):
device_id = device_id_template.format('RSA256')
manager.create_registry(
Expand Down