Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mitchhentges opened this issue Oct 13, 2016 · 5 comments
Closed

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

mitchhentges opened this issue Oct 13, 2016 · 5 comments
Assignees
Labels
api: datastore Issues related to the Datastore API.

Comments

@mitchhentges
Copy link

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.

@mitchhentges
Copy link
Author

mitchhentges commented Oct 13, 2016

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 😉

@mziccard
Copy link
Contributor

@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.

@mziccard mziccard added the api: datastore Issues related to the Datastore API. label Oct 13, 2016
@mitchhentges
Copy link
Author

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

@mziccard
Copy link
Contributor

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.

@mitchhentges
Copy link
Author

(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).

github-actions bot pushed a commit that referenced this issue Aug 18, 2022
…1314)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-core](https://togithub.com/googleapis/java-core) | `2.8.8` -> `2.8.9` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.9/compatibility-slim/2.8.8)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/2.8.9/confidence-slim/2.8.8)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-core</summary>

### [`v2.8.9`](https://togithub.com/googleapis/java-core/blob/HEAD/CHANGELOG.md#&#8203;289-httpsgithubcomgoogleapisjava-corecomparev288v289-2022-08-16)

[Compare Source](https://togithub.com/googleapis/java-core/compare/v2.8.8...v2.8.9)

##### Dependencies

-   update dependency com.google.auth:google-auth-library-bom to v1.10.0 ([#&#8203;900](https://togithub.com/googleapis/java-core/issues/900)) ([c01b47a](https://togithub.com/googleapis/java-core/commit/c01b47a122a9036f8c594cb583dab3512a257597))
-   update dependency com.google.protobuf:protobuf-bom to v3.21.5 ([#&#8203;901](https://togithub.com/googleapis/java-core/issues/901)) ([13e2fd6](https://togithub.com/googleapis/java-core/commit/13e2fd6fbae1d34385ec500aaf4a2b38e19dd6de))
-   update dependency org.threeten:threetenbp to v1.6.1 ([#&#8203;902](https://togithub.com/googleapis/java-core/issues/902)) ([02dac62](https://togithub.com/googleapis/java-core/commit/02dac62784a6614291836917b022a32745312157))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-asset).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNjEuMCIsInVwZGF0ZWRJblZlciI6IjMyLjE2MS4wIn0=-->
github-actions bot pushed a commit that referenced this issue Sep 16, 2022
🤖 I have created a release *beep* *boop*
---


## [3.6.0](googleapis/java-asset@v3.5.0...v3.6.0) (2022-09-15)


### Features

* Add client library support for AssetService v1 BatchGetEffectiveIamPolicies API ([3919a1d](googleapis/java-asset@3919a1d))
* Add client library support for AssetService v1 BatchGetEffectiveIamPolicies API ([#1300](googleapis/java-asset#1300)) ([3919a1d](googleapis/java-asset@3919a1d))
* Release of query system ([3919a1d](googleapis/java-asset@3919a1d))


### Dependencies

* Update dependency com.google.api.grpc:proto-google-cloud-orgpolicy-v1 to v2.3.2 ([#1302](googleapis/java-asset#1302)) ([d01d900](googleapis/java-asset@d01d900))
* Update dependency com.google.api.grpc:proto-google-cloud-orgpolicy-v1 to v2.3.3 ([#1332](googleapis/java-asset#1332)) ([c1511c2](googleapis/java-asset@c1511c2))
* Update dependency com.google.api.grpc:proto-google-cloud-os-config-v1 to v2.5.2 ([#1309](googleapis/java-asset#1309)) ([cf96ee9](googleapis/java-asset@cf96ee9))
* Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.11 ([#1297](googleapis/java-asset#1297)) ([d56eedd](googleapis/java-asset@d56eedd))
* Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.12 ([#1316](googleapis/java-asset#1316)) ([a3713fd](googleapis/java-asset@a3713fd))
* Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.13 ([#1321](googleapis/java-asset#1321)) ([883b7b8](googleapis/java-asset@883b7b8))
* Update dependency com.google.api.grpc:proto-google-cloud-pubsub-v1 to v1.102.14 ([#1334](googleapis/java-asset#1334)) ([56cb4b4](googleapis/java-asset@56cb4b4))
* Update dependency com.google.api.grpc:proto-google-identity-accesscontextmanager-v1 to v1.4.1 ([#1307](googleapis/java-asset#1307)) ([b90baf7](googleapis/java-asset@b90baf7))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.4 ([#1301](googleapis/java-asset#1301)) ([64f7ea5](googleapis/java-asset@64f7ea5))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.6 ([#1315](googleapis/java-asset#1315)) ([fa179e2](googleapis/java-asset@fa179e2))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.14.7 ([#1320](googleapis/java-asset#1320)) ([06d1a16](googleapis/java-asset@06d1a16))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.15.0 ([#1326](googleapis/java-asset#1326)) ([df36595](googleapis/java-asset@df36595))
* Update dependency com.google.cloud:google-cloud-bigquery to v2.16.0 ([#1336](googleapis/java-asset#1336)) ([870779d](googleapis/java-asset@870779d))
* Update dependency com.google.cloud:google-cloud-core to v2.8.10 ([#1323](googleapis/java-asset#1323)) ([09e03b8](googleapis/java-asset@09e03b8))
* Update dependency com.google.cloud:google-cloud-core to v2.8.11 ([#1331](googleapis/java-asset#1331)) ([a112cec](googleapis/java-asset@a112cec))
* Update dependency com.google.cloud:google-cloud-core to v2.8.9 ([#1314](googleapis/java-asset#1314)) ([8edc2b8](googleapis/java-asset@8edc2b8))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.11 ([#1298](googleapis/java-asset#1298)) ([172b34b](googleapis/java-asset@172b34b))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.12 ([#1317](googleapis/java-asset#1317)) ([1ea636f](googleapis/java-asset@1ea636f))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.13 ([#1322](googleapis/java-asset#1322)) ([b7522b9](googleapis/java-asset@b7522b9))
* Update dependency com.google.cloud:google-cloud-pubsub to v1.120.14 ([#1335](googleapis/java-asset#1335)) ([e9142b4](googleapis/java-asset@e9142b4))
* Update dependency com.google.cloud:google-cloud-resourcemanager to v1.5.3 ([#1318](googleapis/java-asset#1318)) ([aa3a1bb](googleapis/java-asset@aa3a1bb))
* Update dependency com.google.cloud:google-cloud-resourcemanager to v1.5.4 ([#1328](googleapis/java-asset#1328)) ([fca0ce5](googleapis/java-asset@fca0ce5))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#1330](googleapis/java-asset#1330)) ([ccb704c](googleapis/java-asset@ccb704c))
* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#1340](googleapis/java-asset#1340)) ([0d87a9d](googleapis/java-asset@0d87a9d))
* Update dependency com.google.cloud:google-cloud-storage to v2.11.3 ([#1299](googleapis/java-asset#1299)) ([d59e6c6](googleapis/java-asset@d59e6c6))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API.
Projects
None yet
Development

No branches or pull requests

2 participants