From 5a134528c7862437c957f536e9169f2a79c76527 Mon Sep 17 00:00:00 2001 From: Shanika Kuruppu Date: Tue, 7 Jul 2020 12:38:14 +1000 Subject: [PATCH 1/3] test: change system-test setup against emulator Use Docker image instead of manually downloading the emulator binary and running it. --- .../integration-tests-against-emulator.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests-against-emulator.yaml b/.github/workflows/integration-tests-against-emulator.yaml index ac27f8e17ea..733095e7f21 100644 --- a/.github/workflows/integration-tests-against-emulator.yaml +++ b/.github/workflows/integration-tests-against-emulator.yaml @@ -7,6 +7,14 @@ name: integration-tests-against-emulator jobs: units: runs-on: ubuntu-latest + + services: + emulator: + image: gcr.io/cloud-spanner-emulator/emulator:0.8.0 + ports: + - 9010:9010 + - 9020:9020 + steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v1 @@ -14,6 +22,8 @@ jobs: java-version: 8 - run: java -version - run: .kokoro/build.sh - - run: sh .github/workflows/integration-tests-against-emulator.sh + - run: mvn -B -Dspanner.testenv.instance="" -Penable-integration-tests -DtrimStackTrace=false -Dclirr.skip=true -Denforcer.skip=true -fae verify env: JOB_TYPE: test + SPANNER_EMULATOR_HOST: localhost:9010 + GOOGLE_CLOUD_PROJECT: emulator-test-project From 522b5cd8ba39feed089d0696609eeb229fc8f7df Mon Sep 17 00:00:00 2001 From: Shanika Kuruppu Date: Tue, 7 Jul 2020 12:56:19 +1000 Subject: [PATCH 2/3] chore: cleanup unusued script file --- .../integration-tests-against-emulator.sh | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 .github/workflows/integration-tests-against-emulator.sh diff --git a/.github/workflows/integration-tests-against-emulator.sh b/.github/workflows/integration-tests-against-emulator.sh deleted file mode 100644 index 2125d5f3089..00000000000 --- a/.github/workflows/integration-tests-against-emulator.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License.. - -# Fail on any error -set -e - -# Display commands being run -set -x - -export SPANNER_EMULATOR_HOST=localhost:9010 -export GOOGLE_CLOUD_PROJECT=emulator-test-project -echo "Running the Cloud Spanner emulator: $SPANNER_EMULATOR_HOST"; - -# Download the emulator -EMULATOR_VERSION=0.8.0 -wget https://storage.googleapis.com/cloud-spanner-emulator/releases/${EMULATOR_VERSION}/cloud-spanner-emulator_linux_amd64-${EMULATOR_VERSION}.tar.gz -tar zxvf cloud-spanner-emulator_linux_amd64-${EMULATOR_VERSION}.tar.gz -chmod u+x emulator_main - -# Start the emulator -./emulator_main --host_port $SPANNER_EMULATOR_HOST & - -EMULATOR_PID=$! - -# Stop the emulator & clean the environment variable -trap "kill -15 $EMULATOR_PID; unset SPANNER_EMULATOR_HOST; unset GOOGLE_CLOUD_PROJECT; echo \"Cleanup the emulator\";" EXIT - -mvn -B -Dspanner.testenv.instance="" \ - -Penable-integration-tests \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify From ed5ce03c8645ac3e3d40345a1e8dd84d7f7aa059 Mon Sep 17 00:00:00 2001 From: Shanika Kuruppu Date: Tue, 7 Jul 2020 13:14:33 +1000 Subject: [PATCH 3/3] fix: use latest version of docker image --- .github/workflows/integration-tests-against-emulator.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests-against-emulator.yaml b/.github/workflows/integration-tests-against-emulator.yaml index 733095e7f21..adb38152d12 100644 --- a/.github/workflows/integration-tests-against-emulator.yaml +++ b/.github/workflows/integration-tests-against-emulator.yaml @@ -10,7 +10,7 @@ jobs: services: emulator: - image: gcr.io/cloud-spanner-emulator/emulator:0.8.0 + image: gcr.io/cloud-spanner-emulator/emulator:latest ports: - 9010:9010 - 9020:9020