Skip to content

Commit

Permalink
Merge branch 'master' into unit_tests_2
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t committed May 11, 2021
2 parents cf3acb8 + e27b73a commit 451ca43
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
@@ -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
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
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 451ca43

Please sign in to comment.