8000 Merge branch 'googleapis:master' into master · googleapis/python-spanner-django@ad8e43e · GitHub
[go: up one dir, main page]

Skip to content

Commit ad8e43e

Browse files
committed
Merge branch 'googleapis:master' into master
2 parents a1707fb + e27b73a commit ad8e43e

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
name: Run Django Spanner integration tests against emulator
7+
jobs:
8+
system-tests:
9+
runs-on: ubuntu-latest
10+
11+
services:
12+
emulator:
13+
image: gcr.io/cloud-spanner-emulator/emulator:latest
14+
ports:
15+
- 9010:9010
16+
- 9020:9020
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
- name: Setup Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.8
25+
- name: Install nox
26+
run: python -m pip install nox
27+
- name: Run nox
28+
run: nox
29+
env:
30+
SPANNER_EMULATOR_HOST: localhost:9010
31+
GOOGLE_CLOUD_PROJECT: emulator-test-project
32+
GOOGLE_CLOUD_TESTS_CREATE_SPANNER_INSTANCE: true

.kokoro/build.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
2525
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
2626
export GOOGLE_CLOUD_PROJECT=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
2727

28-
# Remove old nox
29-
python3.6 -m pip uninstall --yes --quiet nox-automation
30-
31-
# Install nox
32-
python3.6 -m pip install --upgrade --quiet nox
33-
python3.6 -m nox --version
34-
35-
# If NOX_SESSION is set, it only runs the specified session,
36-
# otherwise run all the sessions.
37-
if [[ -n "${NOX_SESSION:-}" ]]; then
38-
python3.6 -m nox -s "${NOX_SESSION:-}"
39-
else
40-
python3.6 -m nox
41-
fi
42-
4328
export RUNNING_SPANNER_BACKEND_TESTS=1
4429

4530
pip3 install .

run_testing_worker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ def __enter__(self):
3030
name = "spanner-django-test-{}".format(str(int(time.time())))
3131

3232
self._instance = client.instance(name, config)
33+
if self._instance.exists():
34+
# If test instance already exists first delete it and then create.
35+
self._instance.delete()
36+
created_op.result(120) # block until completion
3337
created_op = self._instance.create()
3438
created_op.result(120) # block until completion
3539
return name
@@ -44,7 +48,8 @@ def __exit__(self, exc, exc_value, traceback):
4448
if worker_index >= worker_count:
4549
print(
4650
"worker_index ({wi}) > worker_count ({wc})".format(
47-
wi=worker_index, wc=worker_count,
51+
wi=worker_index,
52+
wc=worker_count,
4853
)
4954
)
5055
exit()

0 commit comments

Comments
 (0)
0