Skip to content

Commit

Permalink
Adding support for queries in regression test.
Browse files Browse the repository at this point in the history
This is an attempt port the gcloud-node regression tests
for queries over to gcloud-python.

This surfaced some API differences (i.e. issue #280)
and some missing features (projection, offset and group_by).

In addition, __eq__ was implemented on datastore.key.Key
to allow for easy comparison within tests.
  • Loading branch information
dhermes committed Oct 22, 2014
1 parent f74b0cf commit f26dfc5
Show file tree
Hide file tree
Showing 3 changed files with 321 additions and 19 deletions.
30 changes: 30 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ Running Regression Tests

$ python regression/run_regression.py --package {package}

This alone will not run the tests. You'll need to change some local
auth settings and change some configuration in your project to
run all the tests.

- Regression tests will be run against an actual project and
so you'll need to provide some environment variables to facilitate
authentication to your project:
Expand All @@ -149,6 +153,9 @@ Running Regression Tests
- ``GCLOUD_TESTS_CLIENT_EMAIL``: The email for the service account you're
authenticating with
- ``GCLOUD_TESTS_KEY_FILE``: The path to an encrypted key file.
See private key
`docs <https://cloud.google.com/storage/docs/authentication#generating-a-private-key>`__
for explanation on how to get a private key.

- Examples of these can be found in ``regression/local_test_setup.sample``. We
recommend copying this to ``regression/local_test_setup``, editing the values
Expand All @@ -160,6 +167,29 @@ Running Regression Tests
absolute) on your system where the key file for your service account can
be found.

- For datastore tests, you'll need to create composite
`indexes <https://cloud.google.com/datastore/docs/tools/indexconfig>`__
with the ``gcloud`` command line
`tool <https://developers.google.com/cloud/sdk/gcloud/>`__::

# Install the app (App Engine Command Line Interface) component.
$ gcloud components update app

# See https://cloud.google.com/sdk/crypto for details on PyOpenSSL and
# http://stackoverflow.com/a/25067729/1068170 for why we must persist.
$ export CLOUDSDK_PYTHON_SITEPACKAGES=1

# Authenticate the gcloud tool with your account.
$ gcloud auth activate-service-account $GCLOUD_TESTS_CLIENT_EMAIL \
> --key-file=$GCLOUD_TESTS_KEY_FILE

# Create the indexes
$ gcloud preview datastore create-indexes regression/data/ \
> --project=$GCLOUD_TESTS_DATASET_ID

# Restore your environment to its previous state.
$ unset CLOUDSDK_PYTHON_SITEPACKAGES

Test Coverage
-------------

Expand Down
11 changes: 11 additions & 0 deletions regression/data/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
indexes:

- kind: Character
properties:
- name: family
- name: appearances

- kind: Character
properties:
- name: name
- name: family
Loading

0 comments on commit f26dfc5

Please sign in to comment.