Skip to content

Commit

Permalink
fix: smooth over system test bumps (#66)
Browse files Browse the repository at this point in the history
Adds back some missing documentation to `CONTRIBUTING.rst` that covers
creating indexes and populating test data for system tests.

Also increases the number of `timestamp_key` entities created by
`populate_datastore.py` to 10000, so that system tests can pass.

Co-authored-by: Tres Seaver <tseaver@palladion.com>
  • Loading branch information
Chris Rossi and tseaver committed Aug 12, 2020
1 parent 43ff64a commit 8bb17ea
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
25 changes: 25 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,31 @@ Running System Tests

$ export GOOGLE_APPLICATION_CREDENTIALS="/Users/<your_username>/path/to/app_credentials.json"

- 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 install app-engine-python

# Authenticate the gcloud tool with your account.
$ GOOGLE_APPLICATION_CREDENTIALS="path/to/app_credentials.json"
$ gcloud auth activate-service-account > --key-file=${GOOGLE_APPLICATION_CREDENTIALS}

# Create the indexes
$ gcloud datastore indexes create tests/system/index.yaml

- You'll also need stored data in your dataset. To populate this data, run::

$ python tests/system/utils/populate_datastore.py

- If you make a mistake during development (i.e. a failing test that
prevents clean-up) you can clear all system test data from your
datastore instance via::

$ python tests/system/utils/clear_datastore.py


*************
Test Coverage
Expand Down
37 changes: 37 additions & 0 deletions synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@

if num != 1:
raise Exception("Required replacement not made.")

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
Expand All @@ -98,3 +99,39 @@
s.replace("noxfile.py", """["']sphinx['"]""", '''"sphinx<3.0.0"''')

s.shell.run(["nox", "-s", "blacken"], hide_output=False)

# Add documentation about creating indexes and populating data for system
# tests.
num = s.replace(
"CONTRIBUTING.rst",
'app_credentials.json"',
"""app_credentials.json"
- 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 install app-engine-python
# Authenticate the gcloud tool with your account.
$ GOOGLE_APPLICATION_CREDENTIALS="path/to/app_credentials.json"
$ gcloud auth activate-service-account \
> --key-file=${GOOGLE_APPLICATION_CREDENTIALS}
# Create the indexes
$ gcloud datastore indexes create tests/system/index.yaml
- You'll also need stored data in your dataset. To populate this data, run::
$ python tests/system/utils/populate_datastore.py
- If you make a mistake during development (i.e. a failing test that
prevents clean-up) you can clear all system test data from your
datastore instance via::
$ python tests/system/utils/clear_datastore.py""")

if num != 1:
raise Exception("Required replacement not made.")
2 changes: 1 addition & 1 deletion tests/system/utils/populate_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def add_timestamp_keys(client=None):
# Get a client that uses the test dataset.
client = datastore.Client()

num_batches = 2
num_batches = 20
batch_size = 500

timestamp_micros = set()
Expand Down

0 comments on commit 8bb17ea

Please sign in to comment.