Skip to content

Commit

Permalink
Merge branch 'googleapis:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
vi3k6i5 committed May 10, 2021
2 parents a1707fb + e27b73a commit ad8e43e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/integration-tests-against-emulator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
push:
branches:
- master
pull_request:
name: Run Django Spanner integration tests against emulator
jobs:
system-tests:
runs-on: ubuntu-latest

services:
emulator:
image: gcr.io/cloud-spanner-emulator/emulator:latest
ports:
- 9010:9010
- 9020:9020

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install nox
run: python -m pip install nox
- name: Run nox
run: nox
env:
SPANNER_EMULATOR_HOST: localhost:9010
GOOGLE_CLOUD_PROJECT: emulator-test-project
GOOGLE_CLOUD_TESTS_CREATE_SPANNER_INSTANCE: true
15 changes: 0 additions & 15 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
export GOOGLE_CLOUD_PROJECT=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
else
python3.6 -m nox
fi

export RUNNING_SPANNER_BACKEND_TESTS=1

pip3 install .
Expand Down
7 changes: 6 additions & 1 deletion run_testing_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def __enter__(self):
name = "spanner-django-test-{}".format(str(int(time.time())))

self._instance = client.instance(name, config)
if self._instance.exists():
# If test instance already exists first delete it and then create.
self._instance.delete()
created_op.result(120) # block until completion
created_op = self._instance.create()
created_op.result(120) # block until completion
return name
Expand All @@ -44,7 +48,8 @@ def __exit__(self, exc, exc_value, traceback):
if worker_index >= worker_count:
print(
"worker_index ({wi}) > worker_count ({wc})".format(
wi=worker_index, wc=worker_count,
wi=worker_index,
wc=worker_count,
)
)
exit()
Expand Down

0 comments on commit ad8e43e

Please sign in to comment.