Skip to content

Commit 3bbd9e2

Browse files
committed
add e2e tests scaffolding for appengine flex
1 parent cb8837d commit 3bbd9e2

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.kokoro/tests/build_appengine_flex.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Copyright 2023 Google LLC.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -eo pipefail
18+
19+
file="$(pwd)"
20+
APP_REGION="us-central1"
21+
export SAMPLE_VERSION="${KOKORO_GIT_COMMIT:-latest}"
22+
# Builds not triggered by a PR will fall back to the commit hash then "latest".
23+
SUFFIX=${KOKORO_GITHUB_PULL_REQUEST_NUMBER:-${SAMPLE_VERSION:0:12}}-$(date +%s%N)
24+
export SERVICE_NAME="${SAMPLE_NAME}-${SUFFIX}"
25+
26+
set -x
27+
28+
if [[ "$file" == *"hello"* ]]; then
29+
echo "Deploying App Engine Flex project: ${file}"
30+
mvn clean package appengine:deploy \
31+
--Dservice-account=$SERVICE_NAME \
32+
--region $APP_REGION
33+
34+
fi
35+
set +x
36+
37+
echo
38+
echo '---'
39+
echo
40+
41+
# Do not use exec to preserve trap behavior.
42+
"$@"
43+

.kokoro/tests/run_test_java.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ if [[ "$file" == *"functions/helloworld/"* ]]; then
6060
fi
6161
fi
6262

63+
# Build and deploy Appengine flex samples
64+
if [[ "$file" == *"flexible/java-11/"* ]]; then
65+
source "$SCRIPT_DIR"/build_appengine_flex.sh
66+
EXIT=$?
67+
68+
if [[ $EXIT -ne 0 ]]; then
69+
RTN=1
70+
echo -e "\n Appengine Flex build/deploy failed: gcloud returned a non-zero exit code. \n"
71+
else
72+
echo -e "\n Appengine Flex build/deploy completed.\n"
73+
74+
# Wait for functions to warm up (and start detecting events)
75+
sleep 1m
76+
fi
77+
fi
78+
79+
6380
# Use maven to execute the tests for the project.
6481
mvn --quiet --batch-mode --fail-at-end clean verify \
6582
-Dfile.encoding="UTF-8" \

0 commit comments

Comments
 (0)