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

fix: smooth over system test bumps #66

Merged
merged 2 commits into from Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions CONTRIBUTING.rst
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
Expand Up @@ -82,6 +82,7 @@

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

# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
Expand All @@ -91,3 +92,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
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