From 47fa33202d76008e717011da68ba432f1efa8f89 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Tue, 7 Apr 2020 15:36:44 -0700 Subject: [PATCH] [firestore] fix: mark 3 tests as flaky fixes #3131 These tests are testing sample code that has `sleep(1)` in it. The test is naturally flaky, but when I run the test 100 times, they all pass, so they are somewhat stable. I believe it will mitigate the flakiness a lot just by retrying 3 times. If it doesn't work, we'll probably need to make a fundamental fix to remove `sleep(1)` calls. --- firestore/cloud-client/requirements-test.txt | 1 + firestore/cloud-client/snippets_test.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/firestore/cloud-client/requirements-test.txt b/firestore/cloud-client/requirements-test.txt index 781d4326c94..1b569cb4f2c 100644 --- a/firestore/cloud-client/requirements-test.txt +++ b/firestore/cloud-client/requirements-test.txt @@ -1 +1,2 @@ pytest==5.3.2 +flaky==3.6.1 diff --git a/firestore/cloud-client/snippets_test.py b/firestore/cloud-client/snippets_test.py index 36d19877e65..908fdcd7fbe 100644 --- a/firestore/cloud-client/snippets_test.py +++ b/firestore/cloud-client/snippets_test.py @@ -267,12 +267,14 @@ def test_cursor_multiple_conditions(): snippets.cursor_multiple_conditions() +@pytest.mark.flaky(max_runs=3) def test_listen_document(capsys): snippets.listen_document() out, _ = capsys.readouterr() assert 'Received document snapshot: SF' in out +@pytest.mark.flaky(max_runs=3) def test_listen_multiple(capsys): snippets.listen_multiple() out, _ = capsys.readouterr() @@ -280,6 +282,7 @@ def test_listen_multiple(capsys): assert 'SF' in out +@pytest.mark.flaky(max_runs=3) def test_listen_for_changes(capsys): snippets.listen_for_changes() out, _ = capsys.readouterr()