Skip to content

Commit 4f46eba

Browse files
authored
Run e2e tests on GAE flex (#350)
1 parent 816b992 commit 4f46eba

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

cloudbuild-e2e-gae.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
steps:
16+
# Wait for the image to exist
17+
- name: "docker"
18+
id: wait-for-image
19+
entrypoint: "sh"
20+
timeout: 10m
21+
env: ["_TEST_SERVER_IMAGE=${_TEST_SERVER_IMAGE}"]
22+
args:
23+
- e2e-test-server/wait-for-image.sh
24+
25+
# Run the test
26+
- name: $_TEST_RUNNER_IMAGE
27+
id: run-tests-gae
28+
dir: /
29+
env: ["PROJECT_ID=$PROJECT_ID"]
30+
args:
31+
- gae
32+
- --image=$_TEST_SERVER_IMAGE
33+
- --runtime=python
34+
35+
logsBucket: gs://opentelemetry-ops-e2e-cloud-build-logs
36+
timeout: 20m
37+
substitutions:
38+
_TEST_RUNNER_IMAGE: gcr.io/${PROJECT_ID}/opentelemetry-operations-e2e-testing:0.19.0
39+
_TEST_SERVER_IMAGE: gcr.io/${PROJECT_ID}/opentelemetry-operations-python-e2e-test-server:${SHORT_SHA}

e2e-test-server/e2e_test_server/server.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,18 @@ def pubsub_push() -> None:
154154
app = Flask(__name__)
155155
responder = _Responder()
156156

157+
# Health checks for GAE. See:
158+
# https://cloud.google.com/appengine/docs/flexible/reference/app-yaml#updated_health_checks
159+
# https://github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/blob/v0.16.0/tf/gae/gae.tf#L32-L38
160+
@app.route("/alive")
161+
def alive() -> Response:
162+
return Response(status=200)
163+
164+
@app.route("/ready")
165+
def ready() -> Response:
166+
return Response(status=200)
167+
168+
# Actual pub/sub handler
157169
@app.route("/", methods=["POST"])
158170
def index() -> Response:
159171
if not request.is_json:

0 commit comments

Comments
 (0)