|
| 1 | +#!/bin/bash |
| 2 | +# Runs the conformance tests locally from https://github.com/GoogleCloudPlatform/functions-framework-conformance |
| 3 | +# |
| 4 | +# Servers may fail to shutdown between tests on error, leaving port 8080 bound. |
| 5 | +# You can see what's running on port 8080 by running `lsof -i :8080`. You can |
| 6 | +# run `kill -9 <PID>` to terminate a process. |
| 7 | +# |
| 8 | +# USAGE: |
| 9 | +# ./run_conformance_tests.sh [client_version] |
| 10 | +# |
| 11 | +# client_version (optional): |
| 12 | +# The version of the conformance tests client to use, formatted as "vX.X.X". |
| 13 | +# Defaults to the latest version of the repo, which may be ahead of the |
| 14 | +# latest release. |
| 15 | + |
| 16 | +CLIENT_VERSION=$1 |
| 17 | +if [ $CLIENT_VERSION ]; then |
| 18 | + CLIENT_VERSION="@$CLIENT_VERSION" |
| 19 | +else |
| 20 | + echo "Defaulting to v1.2.0 client." |
| 21 | + echo "Use './run_conformance_tests vX.X.X' to specify a specific release version." |
| 22 | + CLIENT_VERSION="@v1.2.0" |
| 23 | +fi |
| 24 | + |
| 25 | +function print_header() { |
| 26 | + echo |
| 27 | + echo "========== $1 ==========" |
| 28 | +} |
| 29 | + |
| 30 | +# Fail if any command fails |
| 31 | +set -e |
| 32 | + |
| 33 | +print_header "INSTALLING CLIENT$CLIENT_VERSION" |
| 34 | +echo "Note: only works with Go 1.16+ by default, see run_conformance_tests.sh for more information." |
| 35 | +# Go install @version only works on go 1.16+, if using a lower Go version |
| 36 | +# replace command with: |
| 37 | +# go get github.com/GoogleCloudPlatform/functions-framework-conformance/client$CLIENT_VERSION && go install github.com/GoogleCloudPlatform/functions-framework-conformance/client |
| 38 | +go install github.com/GoogleCloudPlatform/functions-framework-conformance/client$CLIENT_VERSION |
| 39 | +echo "Done installing client$CLIENT_VERSION" |
| 40 | + |
| 41 | +print_header "HTTP CONFORMANCE TESTS" |
| 42 | +client -buildpacks=false -type=http -cmd='mvn -f invoker/conformance/pom.xml function:run -Drun.functionTarget=com.google.cloud.functions.conformance.HttpConformanceFunction' -start-delay 5 |
| 43 | + |
| 44 | +print_header "BACKGROUND EVENT CONFORMANCE TESTS" |
| 45 | +client -buildpacks=false -type=legacyevent -cmd='mvn -f invoker/conformance/pom.xml function:run -Drun.functionTarget=com.google.cloud.functions.conformance.BackgroundEventConformanceFunction' -start-delay 5 -validate-mapping=false |
| 46 | + |
| 47 | +print_header "CLOUDEVENT CONFORMANCE TESTS" |
| 48 | +client -buildpacks=false -type=cloudevent -cmd='mvn -f invoker/conformance/pom.xml function:run -Drun.functionTarget=com.google.cloud.functions.conformance.CloudEventsConformanceFunction' -start-delay 5 -validate-mapping=false |
0 commit comments