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

How can we cover unit testing for datastore? #2

Closed
jgeewax opened this issue Jan 29, 2014 · 6 comments
Closed

How can we cover unit testing for datastore? #2

jgeewax opened this issue Jan 29, 2014 · 6 comments
Assignees
Labels
api: datastore Issues related to the Datastore API. testing type: question Request for information or clarification. Not an issue.

Comments

@jgeewax
Copy link
Contributor

jgeewax commented Jan 29, 2014

Right now, the only way to develop this is by hitting the live Cloud Datastore API. Is there a way we can use these API calls in unit tests without mocking?

Can we have a "local datastore" server that understands the API and makes it easy for local development?

@proppy
Copy link
Contributor

proppy commented Jan 29, 2014

You could use gcd: the local development server, see:
https://developers.google.com/datastore/docs/tools/devserver

@jgeewax
Copy link
Contributor Author

jgeewax commented Jan 30, 2014

That looks good for local development. It runs on Java right ?

I wonder how difficult it would be to patch in the stubs from AppEngine's dev_appserver.py so that i can use something akin to ext.testbed to unittest locally (ie, without hitting the wire, stay all in Python).

@proppy
Copy link
Contributor

proppy commented Jan 30, 2014

That looks good for local development. It runs on Java right ?

Yes, it is embedding the App Engine Java development server and running the same servlet that is running in production.

I wonder how difficult it would be to patch in the stubs from AppEngine's dev_appserver.py so that i can use something akin to ext.testbed to unittest locally (ie, without hitting the wire, stay all in Python).

You would have to handle the datastore_v1.proto to datastore_v4 convertion somehow.

Keep in mind that datastore_v4 private interface is not really documented and also subject to change: datastore_v1 is the public versionned interface.

@jgeewax
Copy link
Contributor Author

jgeewax commented Jan 30, 2014

Yikes. Well I realllly don't want to force people to spin up a local server in order to run unit tests...

We'll have to come up with a way to stub this out.

@tseaver
Copy link
Contributor

tseaver commented Sep 23, 2014

#130 adds 100% unit test coverage for modules in gcloud, gcloud.datastore. I would call its strategy "stubbing" (testcases explicitly stub out the http or connection objects) rather than "mocking" (using a general-purpose utilitiy like 'mock').

@tseaver
Copy link
Contributor

tseaver commented Oct 17, 2014

#106 exists to cover the deficiencies of testing with stubbed / mocked backends.

@tseaver tseaver closed this as completed Oct 17, 2014
@jgeewax jgeewax modified the milestone: Datastore Stable Jan 30, 2015
tseaver added a commit that referenced this issue Jul 12, 2017
* Defend against back-end returning instance configs for disallowed regions.

* Additional system tests for 'Snapshot.read':

- Read single key.
- Read multiple keys.
- Read open-closed ranges.
- Read open-open ranges.
- Read closed-open ranges.
- Read closed-closed ranges.
- Read timestamp.
- Min read timestamp.
- Max staleness.
- Exact staleness.
- Strong.

* Additional system tests for 'Snapshot.execute_sql':

- Query returning 'ARRAY<STRUCT>'.
- Bind INT64 parameter to null.
landrito pushed a commit to landrito/google-cloud-python that referenced this issue Aug 21, 2017
* Defend against back-end returning instance configs for disallowed regions.

* Additional system tests for 'Snapshot.read':

- Read single key.
- Read multiple keys.
- Read open-closed ranges.
- Read open-open ranges.
- Read closed-open ranges.
- Read closed-closed ranges.
- Read timestamp.
- Min read timestamp.
- Max staleness.
- Exact staleness.
- Strong.

* Additional system tests for 'Snapshot.execute_sql':

- Query returning 'ARRAY<STRUCT>'.
- Bind INT64 parameter to null.
landrito pushed a commit to landrito/google-cloud-python that referenced this issue Aug 22, 2017
* Defend against back-end returning instance configs for disallowed regions.

* Additional system tests for 'Snapshot.read':

- Read single key.
- Read multiple keys.
- Read open-closed ranges.
- Read open-open ranges.
- Read closed-open ranges.
- Read closed-closed ranges.
- Read timestamp.
- Min read timestamp.
- Max staleness.
- Exact staleness.
- Strong.

* Additional system tests for 'Snapshot.execute_sql':

- Query returning 'ARRAY<STRUCT>'.
- Bind INT64 parameter to null.
landrito pushed a commit to landrito/google-cloud-python that referenced this issue Aug 22, 2017
* Defend against back-end returning instance configs for disallowed regions.

* Additional system tests for 'Snapshot.read':

- Read single key.
- Read multiple keys.
- Read open-closed ranges.
- Read open-open ranges.
- Read closed-open ranges.
- Read closed-closed ranges.
- Read timestamp.
- Min read timestamp.
- Max staleness.
- Exact staleness.
- Strong.

* Additional system tests for 'Snapshot.execute_sql':

- Query returning 'ARRAY<STRUCT>'.
- Bind INT64 parameter to null.
davidebelloni added a commit to davidebelloni/google-cloud-python that referenced this issue Dec 7, 2017
urshala pushed a commit to urshala/google-cloud-python that referenced this issue Jan 17, 2020
urshala pushed a commit to urshala/google-cloud-python that referenced this issue Jan 17, 2020
parthea added a commit that referenced this issue Jun 4, 2023
* chore: update documentation link in README

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md

* coverage

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea added a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Mon Jan 11 09:43:06 2021 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 16ec872dd898d7de6e1822badfac32484b5d9031
Source-Link: googleapis/synthtool@16ec872
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea pushed a commit that referenced this issue Jun 4, 2023
parthea added a commit that referenced this issue Jun 4, 2023
Fixes #2  🦕

This PR adds the auto generated `v3` client for Resource Manager and changes the release status from `alpha` to `beta`. This is a significant change from the previous version `v1beta1`, as this is the first version of an auto generated client.  

chore(release_status): upgrade release status from alpha to beta
fix: remove v1beta1
chore(deps): require python 3.6+
parthea added a commit that referenced this issue Jun 5, 2023
* chore: add SECURITY.md

* chore: use a valid post processor image

* 🦉 Updates from OwlBot

Co-authored-by: google-cloud-policy-bot[bot] <80869356+google-cloud-policy-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea added a commit that referenced this issue Jul 6, 2023
* chore(main): release 0.1.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* remove python 3.6 sample configs

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): require google-api-core >= 2.8.0

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this issue Aug 15, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this issue Sep 14, 2023
* chore(main): release 0.1.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* use latest post processor image

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): require google-api-core >= 2.8.0

* remove python 3.6 sample configs

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea added a commit that referenced this issue Sep 14, 2023
* chore(main): release 0.1.0

* add commit to trigger gh actions

* add commit to trigger gh actions

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this issue Sep 20, 2023
- [ ] Regenerate this pull request now.

chore: fix snippet region tag format
chore: fix docstring code block formatting
PiperOrigin-RevId: 430730865

Source-Link: googleapis/googleapis@ea58002

Source-Link: googleapis/googleapis-gen@ca893ff
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9
parthea pushed a commit that referenced this issue Sep 22, 2023
* updated CHANGELOG.md [ci skip]

* updated setup.cfg [ci skip]

* updated setup.py [ci skip]

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Sep 22, 2023
parthea pushed a commit that referenced this issue Sep 22, 2023
* chore: add split repo templates

* test: increase coverage values
parthea added a commit that referenced this issue Oct 21, 2023
parthea added a commit that referenced this issue Oct 21, 2023
parthea pushed a commit that referenced this issue Oct 21, 2023
Fix the development status classifier to be consistent with 'alpha' in the README.


Also fixes some docs related kokoro configs. The `docs/docs.cfg` job that is triggered by successfulrelease jobs was failing because `NOX_SESSION` was in the required env vars list.
parthea pushed a commit that referenced this issue Oct 21, 2023
🤖 I have created a release \*beep\* \*boop\* 
---
## [0.2.0](https://www.github.com/googleapis/python-compute/compare/v0.1.0...v0.2.0) (2021-02-11)


### Features

* run synthtool to pick up mtls feature ([#6](https://www.github.com/googleapis/python-compute/issues/6)) ([3abec21](https://www.github.com/googleapis/python-compute/commit/3abec21a1d5b1384779c48b899f23ba18ca0ddb3))


### Bug Fixes

* don't use integers for enums in json encoding ([a3685b5](https://www.github.com/googleapis/python-compute/commit/a3685b5a03a75256d2d00b89dcc8fda34596edde))
* fix body encoding for rest transport  ([#17](https://www.github.com/googleapis/python-compute/issues/17)) ([a3685b5](https://www.github.com/googleapis/python-compute/commit/a3685b5a03a75256d2d00b89dcc8fda34596edde))
* regenerate the client lib ([#9](https://www.github.com/googleapis/python-compute/issues/9)) ([b9def52](https://www.github.com/googleapis/python-compute/commit/b9def52a47067804d5b79e867fb3ff895f8f4c21))
* set development status classifier to alpha ([#2](https://www.github.com/googleapis/python-compute/issues/2)) ([54814f8](https://www.github.com/googleapis/python-compute/commit/54814f8ad15b8f8dff051c7c7819bc4a7b8e099f))
* stabilize order of query_params ([a3685b5](https://www.github.com/googleapis/python-compute/commit/a3685b5a03a75256d2d00b89dcc8fda34596edde))
* update paging implementation to handle unconventional pagination ([a3685b5](https://www.github.com/googleapis/python-compute/commit/a3685b5a03a75256d2d00b89dcc8fda34596edde))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Oct 21, 2023
parthea pushed a commit that referenced this issue Oct 21, 2023
parthea added a commit that referenced this issue Oct 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
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. testing type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants