1+ #! /bin/bash
2+ # Copyright 2020 Google LLC
3+ #
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # https://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
16+ set -x pipefail
17+
18+ # Disable buffering, so that the logs stream through.
19+ export PYTHONUNBUFFERED=1
20+
21+ # Debug: show build environment
22+ env | grep KOKORO
23+
24+ # Setup service account credentials.
25+ # export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
26+
27+ # Setup project id.
28+ # export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
29+
30+ # Export essential environment variables for Django tests.
31+ export RUNNING_SPANNER_BACKEND_TESTS=1
32+
33+ # The emulator is currently unusable for our tests because:
34+ # a) It doesn't support INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
35+ # b) Cannot accept parameters whose types aren't known, so can't be used for
36+ # Python and other dynamic languages.
37+ # export USE_SPANNER_EMULATOR=0
38+
39+ pip3 install .
40+ # Create a unique DJANGO_TESTS_DIR per worker to avoid
41+ # any clashes with configured tests by other workers.
42+ export DJANGO_TESTS_DIR=" django_tests_$DJANGO_WORKER_INDEX "
43+ mkdir -p $DJANGO_TESTS_DIR && git clone --depth 1 --single-branch --branch spanner-2.2.x https://github.com/timgraham/django.git $DJANGO_TESTS_DIR /django
44+
45+ # Install dependencies for Django tests.
46+ sudo apt-get update
47+ apt-get install -y libffi-dev libjpeg-dev zlib1g-dev libmemcached-dev
48+ cd $DJANGO_TESTS_DIR /django && pip3 install -e . && pip3 install -r tests/requirements/py3.txt; cd ../../
49+
50+ python3 create_test_instance.py
51+ bash django_test_suite.sh
0 commit comments