Skip to content

Commit

Permalink
test: refactor concurrency test using orchestrate (#709)
Browse files Browse the repository at this point in the history
Towards #691
  • Loading branch information
Chris Rossi authored Aug 24, 2021
1 parent 7e8d5b1 commit b27725e
Show file tree
Hide file tree
Showing 5 changed files with 882 additions and 128 deletions.
2 changes: 1 addition & 1 deletion google/cloud/ndb/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def _update_key(key, new_value):
utils.logging_debug(log, "old value: {}", old_value)

value = new_value(old_value)
utils.logging_debug(log, "new value: {}", value)
utils.logging_debug(log, "new value: {}", value) # pragma: SYNCPOINT update key

if old_value is not None:
utils.logging_debug(log, "compare and swap")
Expand Down
35 changes: 22 additions & 13 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,31 @@ def initialize_environment(request, environ):


@pytest.fixture
def context():
client = mock.Mock(
project="testing",
namespace=None,
spec=("project", "namespace"),
stub=mock.Mock(spec=()),
)
context = context_module.Context(
client,
eventloop=TestingEventLoop(),
datastore_policy=True,
legacy_data=False,
)
def context_factory():
def context(**kwargs):
client = mock.Mock(
project="testing",
namespace=None,
spec=("project", "namespace"),
stub=mock.Mock(spec=()),
)
context = context_module.Context(
client,
eventloop=TestingEventLoop(),
datastore_policy=True,
legacy_data=False,
**kwargs
)
return context

return context


@pytest.fixture
def context(context_factory):
return context_factory()


@pytest.fixture
def in_context(context):
assert not context_module._state.context
Expand Down
Loading

0 comments on commit b27725e

Please sign in to comment.