Skip to content

Commit 8bb17ea

Browse files
Chris Rossitseaver
andauthored
fix: smooth over system test bumps (#66)
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>
1 parent 43ff64a commit 8bb17ea

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

CONTRIBUTING.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,31 @@ Running System Tests
170170

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

173+
- You'll need to create composite
174+
`indexes <https://cloud.google.com/datastore/docs/tools/indexconfig>`__
175+
with the ``gcloud`` command line
176+
`tool <https://developers.google.com/cloud/sdk/gcloud/>`__::
177+
178+
# Install the app (App Engine Command Line Interface) component.
179+
$ gcloud components install app-engine-python
180+
181+
# Authenticate the gcloud tool with your account.
182+
$ GOOGLE_APPLICATION_CREDENTIALS="path/to/app_credentials.json"
183+
$ gcloud auth activate-service-account > --key-file=${GOOGLE_APPLICATION_CREDENTIALS}
184+
185+
# Create the indexes
186+
$ gcloud datastore indexes create tests/system/index.yaml
187+
188+
- You'll also need stored data in your dataset. To populate this data, run::
189+
190+
$ python tests/system/utils/populate_datastore.py
191+
192+
- If you make a mistake during development (i.e. a failing test that
193+
prevents clean-up) you can clear all system test data from your
194+
datastore instance via::
195+
196+
$ python tests/system/utils/clear_datastore.py
197+
173198

174199
*************
175200
Test Coverage

synth.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989

9090
if num != 1:
9191
raise Exception("Required replacement not made.")
92+
9293
# ----------------------------------------------------------------------------
9394
# Add templated files
9495
# ----------------------------------------------------------------------------
@@ -98,3 +99,39 @@
9899
s.replace("noxfile.py", """["']sphinx['"]""", '''"sphinx<3.0.0"''')
99100

100101
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
102+
103+
# Add documentation about creating indexes and populating data for system
104+
# tests.
105+
num = s.replace(
106+
"CONTRIBUTING.rst",
107+
'app_credentials.json"',
108+
"""app_credentials.json"
109+
110+
- You'll need to create composite
111+
`indexes <https://cloud.google.com/datastore/docs/tools/indexconfig>`__
112+
with the ``gcloud`` command line
113+
`tool <https://developers.google.com/cloud/sdk/gcloud/>`__::
114+
115+
# Install the app (App Engine Command Line Interface) component.
116+
$ gcloud components install app-engine-python
117+
118+
# Authenticate the gcloud tool with your account.
119+
$ GOOGLE_APPLICATION_CREDENTIALS="path/to/app_credentials.json"
120+
$ gcloud auth activate-service-account \
121+
> --key-file=${GOOGLE_APPLICATION_CREDENTIALS}
122+
123+
# Create the indexes
124+
$ gcloud datastore indexes create tests/system/index.yaml
125+
126+
- You'll also need stored data in your dataset. To populate this data, run::
127+
128+
$ python tests/system/utils/populate_datastore.py
129+
130+
- If you make a mistake during development (i.e. a failing test that
131+
prevents clean-up) you can clear all system test data from your
132+
datastore instance via::
133+
134+
$ python tests/system/utils/clear_datastore.py""")
135+
136+
if num != 1:
137+
raise Exception("Required replacement not made.")

tests/system/utils/populate_datastore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def add_timestamp_keys(client=None):
156156
# Get a client that uses the test dataset.
157157
client = datastore.Client()
158158

159-
num_batches = 2
159+
num_batches = 20
160160
batch_size = 500
161161

162162
timestamp_micros = set()

0 commit comments

Comments
 (0)