GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Client Datastore API: default consistency of 1.0 when testing · Issue #1314 · googleapis/google-cloud-java

Client Datastore API: default consistency of 1.0 when testing #1314

New issue
Copy link
New issue
Copy link
Closed
Closed
Client Datastore API: default consistency of 1.0 when testing#1314
Copy link
Assignees
mitchhentges
Labels
api: datastoreIssues related to the Datastore API.

Description

@mitchhentges
mitchhentges
opened on Oct 13, 2016
Issue body actions

I just spent a few hours debugging flaky tests, and I finally realized that it was due to the "consistency" settings that I was using.

When LocalDatastoreHelper.create() is called, perhaps a default consistency of 1.0 should be used? Otherwise, integration tests to verify proper API usage will "randomly" fail, even if the tests are fairly small.

Activity

  1. mitchhentges commented on Oct 13, 2016

    @mitchhentges
    mitchhentges
    on Oct 13, 2016
    Author
    More actions

    For reference, I've made a minimal reproducible suite of tests that would (within a few runs) "randomly" fail. The tests are fairly simple, so I was a little surprised that the default values bit me as they did 😉

  2. mziccard commented on Oct 13, 2016

    @mziccard
    mziccard
    on Oct 13, 2016
    Contributor
    More actions

    @mitchhentges Thanks for you interest in google-cloud. You are right, LocalDatastoreHelpe.create() starts the emulator with a consistency of 0.9. The Datastore service is not strongly consistent, hence we decided to offer a default method that creates a non-consistent datastore emulator.

    The consistency level used by LocalDatastoreHelper.create() is documented in the javadoc. LocalDatastoreHelper also exposes a create(double) method that allows you to set your favorite consistency, see the javadoc.

  3. mziccard
    added
    api: datastoreIssues related to the Datastore API.
    on Oct 13, 2016
  4. mitchhentges commented on Oct 13, 2016

    @mitchhentges
    mitchhentges
    on Oct 13, 2016
    Author
    More actions

    Other than having the same behaviour as "production" datastore, what's the point of having a "test" datastore with a default consistency of 0.9?

    IMHO, if someone is using the LocalDatastoreHelper, they're using it for tests. Probably, they want to verify that their integration with datastore is working (passing tests if integration is good, failing tests if integration is bad).
    Perhaps I'm shortsighted, but I cannot imagine a case where having an inconstent datastore is helpful in unit/integration tests.

    Finally, to be honest, I've got everything working on my end, so this isn't an issue for me. I just don't want future consumers of the "Client Datastore API" to run into a similar issue that I did

  5. mziccard commented on Oct 13, 2016

    @mziccard
    mziccard
    on Oct 13, 2016
    Contributor
    More actions

    Perhaps I'm shortsighted, but I cannot imagine a case where having an inconstent datastore is helpful in unit/integration tests.

    Some Datastore operations are eventually consistent, testing against an eventual consistent emulator is useful in all cases you want to verify that your code is not depending on strong consistency when it should not. Having your integration tests pass against a strongly consistent emulator don't necessarily guarantee that your code will also work against the actual Datastore service.

    Also notice that 0.9 is the default consistency level used by the gcloud command line tool when starting the datastore emulator:

    gcloud beta emulators datastore start

    Finally, to be honest, I've got everything working on my end, so this isn't an issue for me. I just don't want future consumers of the "Client Datastore API" to run into a similar issue that I did

    I am sorry you spent time on this. Probably our TESTING readme or javadoc could have saved you some time.

  6. mitchhentges
    closed this as completedon Oct 13, 2016
  7. JustinBeckwith
    assigned
    mitchhentges
    on Feb 1, 2021
  8. mitchhentges
    removed their assignment
    on Feb 1, 2021
  9. mitchhentges commented on Feb 1, 2021

    @mitchhentges
    mitchhentges
    on Feb 1, 2021
    Author
    More actions

    (fun 4 years update: mziccard was right, it's good to be aware of potential consistency issues in your tests, otherwise you could be surprised in production).

  10. JustinBeckwith
    assigned
    mitchhentges
    on Feb 1, 2021
  11. github-actions
    added a commit that references this issue on Aug 18, 2022

    deps: update dependency com.google.cloud:google-cloud-core to v2.8.9 (#…

    8edc2b8
  12. github-actions
    added a commit that references this issue on Sep 16, 2022

    chore(main): release 3.6.0 (#1313)

    1fbaf40
  13. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore: README template fix in google-cloud-java (#1785) (#1314)

    9306715
  14. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore(main): release 0.131.7-alpha-SNAPSHOT (#1314)

    63a63a1
  15. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore(main): release 2.18.4-SNAPSHOT (#1314)

    6264b99
  16. chingor13
    added a commit that references this issue on Feb 24, 2026

    chore(deps): update dependency org.apache.maven.plugins:maven-failsaf…

    0c39464
  17. suztomo
    added a commit that references this issue on Mar 11, 2026

    chore: README template fix in google-cloud-java (googleapis#1785) (go…

    0722f96
  18. chingor13
    added a commit that references this issue on Mar 12, 2026

    chore(deps): update dependency org.apache.maven.plugins:maven-failsaf…

    9a1994e
  19. suztomo
    added a commit that references this issue on Mar 23, 2026

    chore(main): release 2.11.8-SNAPSHOT (googleapis#1314)

    a61b0d3
  20. suztomo
    added 2 commits that reference this issue on Mar 30, 2026

    deps: update the dependency com.google.apis:google-api-services-stora… (

    663f8b6

    chore(main): release 0.127.8 (#1310)

    b93b7b0
  21. lqiu96
    added 2 commits that reference this issue on Apr 1, 2026

    deps: update the dependency com.google.apis:google-api-services-stora… (

    949e46c

    chore(main): release 0.127.8 (#1310)

    95ac931
  22. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    deps: update dependency importlib-metadata to v4.12.0 (#1314)

    e319df0

    deps: update dependency importlib-metadata to v4.12.0 (#1314)

    7f05f92
  23. benjaminp
    added 2 commits that reference this issue on Jul 13, 2026

    test(deps): update dependency com.google.cloud:google-cloud-conforman…

    2a425d6

    feat: Support Cloud Bigtable Changestream (googleapis#1569)

    99071f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @mitchhentges
    mitchhentges

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.