Skip to content

Commit dd542ad

Browse files
author
Takashi Matsuo
committed
more retries, comment
1 parent 0f436e1 commit dd542ad

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

dlp/risk_test.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838

3939

4040
# Create new custom topic/subscription
41+
# We observe sometimes all the tests in this file fail. In a
42+
# hypothesis where DLP service somehow loses the connection to the
43+
# topic, now we use function scope for Pub/Sub fixtures.
4144
@pytest.fixture(scope="function")
4245
def topic_id():
4346
# Creates a pubsub topic, and tears it down.
@@ -160,7 +163,7 @@ def bigquery_project():
160163
bigquery_client.delete_dataset(dataset_ref, delete_contents=True)
161164

162165

163-
@pytest.mark.flaky(max_runs=3, min_passes=1)
166+
@pytest.mark.flaky(max_runs=5, min_passes=1)
164167
def test_numerical_risk_analysis(
165168
topic_id, subscription_id, bigquery_project, capsys
166169
):
@@ -179,7 +182,7 @@ def test_numerical_risk_analysis(
179182
assert "Value Range:" in out
180183

181184

182-
@pytest.mark.flaky(max_runs=3, min_passes=1)
185+
@pytest.mark.flaky(max_runs=5, min_passes=1)
183186
def test_categorical_risk_analysis_on_string_field(
184187
topic_id, subscription_id, bigquery_project, capsys
185188
):
@@ -198,7 +201,7 @@ def test_categorical_risk_analysis_on_string_field(
198201
assert "Most common value occurs" in out
199202

200203

201-
@pytest.mark.flaky(max_runs=3, min_passes=1)
204+
@pytest.mark.flaky(max_runs=5, min_passes=1)
202205
def test_categorical_risk_analysis_on_number_field(
203206
topic_id, subscription_id, bigquery_project, capsys
204207
):
@@ -217,7 +220,7 @@ def test_categorical_risk_analysis_on_number_field(
217220
assert "Most common value occurs" in out
218221

219222

220-
@pytest.mark.flaky(max_runs=3, min_passes=1)
223+
@pytest.mark.flaky(max_runs=5, min_passes=1)
221224
def test_k_anonymity_analysis_single_field(
222225
topic_id, subscription_id, bigquery_project, capsys
223226
):
@@ -237,7 +240,7 @@ def test_k_anonymity_analysis_single_field(
237240
assert "Class size:" in out
238241

239242

240-
@pytest.mark.flaky(max_runs=3, min_passes=1)
243+
@pytest.mark.flaky(max_runs=5, min_passes=1)
241244
def test_k_anonymity_analysis_multiple_fields(
242245
topic_id, subscription_id, bigquery_project, capsys
243246
):
@@ -257,7 +260,7 @@ def test_k_anonymity_analysis_multiple_fields(
257260
assert "Class size:" in out
258261

259262

260-
@pytest.mark.flaky(max_runs=3, min_passes=1)
263+
@pytest.mark.flaky(max_runs=5, min_passes=1)
261264
def test_l_diversity_analysis_single_field(
262265
topic_id, subscription_id, bigquery_project, capsys
263266
):
@@ -279,7 +282,7 @@ def test_l_diversity_analysis_single_field(
279282
assert "Sensitive value" in out
280283

281284

282-
@pytest.mark.flaky(max_runs=3, min_passes=1)
285+
@pytest.mark.flaky(max_runs=5, min_passes=1)
283286
def test_l_diversity_analysis_multiple_field(
284287
topic_id, subscription_id, bigquery_project, capsys
285288
):
@@ -301,7 +304,7 @@ def test_l_diversity_analysis_multiple_field(
301304
assert "Sensitive value" in out
302305

303306

304-
@pytest.mark.flaky(max_runs=3, min_passes=1)
307+
@pytest.mark.flaky(max_runs=5, min_passes=1)
305308
def test_k_map_estimate_analysis_single_field(
306309
topic_id, subscription_id, bigquery_project, capsys
307310
):
@@ -323,7 +326,7 @@ def test_k_map_estimate_analysis_single_field(
323326
assert "Values" in out
324327

325328

326-
@pytest.mark.flaky(max_runs=3, min_passes=1)
329+
@pytest.mark.flaky(max_runs=5, min_passes=1)
327330
def test_k_map_estimate_analysis_multiple_field(
328331
topic_id, subscription_id, bigquery_project, capsys
329332
):
@@ -345,7 +348,7 @@ def test_k_map_estimate_analysis_multiple_field(
345348
assert "Values" in out
346349

347350

348-
@pytest.mark.flaky(max_runs=3, min_passes=1)
351+
@pytest.mark.flaky(max_runs=5, min_passes=1)
349352
def test_k_map_estimate_analysis_quasi_ids_info_types_equal(
350353
topic_id, subscription_id, bigquery_project
351354
):

0 commit comments

Comments
 (0)