Skip to content

Commit e212361

Browse files
author
Takashi Matsuo
committed
[datastore] fix: handle datastore eventual consistency
fixes #2884
1 parent fb9ef51 commit e212361

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

datastore/cloud-ndb/quickstart_test.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import uuid
1616

17+
import backoff
1718
import pytest
1819

1920
import quickstart
@@ -34,6 +35,10 @@ def test_book():
3435

3536

3637
def test_quickstart(capsys, test_book):
37-
quickstart.list_books()
38-
out, _ = capsys.readouterr()
39-
assert test_book.title in out
38+
@backoff.on_exception(backoff.expo, AssertionError, max_time=60)
39+
def eventually_consistent_test():
40+
quickstart.list_books()
41+
out, _ = capsys.readouterr()
42+
assert test_book.title in out
43+
44+
eventually_consistent_test()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
backoff==1.10.0
12
pytest==5.3.2

0 commit comments

Comments
 (0)