Skip to content

Commit edacd8a

Browse files
thedavlszegedi
authored andcommitted
Fix flaky serverless integration test (#3418)
* try to fix flaky test * Update test-gcloud-function.sh * Update test-gcloud-function.sh * Update test-gcloud-function.sh * Update test-gcloud-function.sh
1 parent 748d865 commit edacd8a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

integration-tests/serverless/test-gcloud-function.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,33 @@ ls "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/"
1111
STAGE=$(xxd -l 4 -c 4 -p </dev/random)
1212

1313
function cleanup {
14-
gcloud functions delete dd-trace-js-sls-mini-agent-integration-test-${STAGE} --region us-east1 --gen2 --quiet
14+
gcloud functions delete dd-trace-js-sls-mini-agent-integration-test-${STAGE} --region us-east1 --gen2 --quiet --project datadog-sandbox
1515
}
1616
trap cleanup EXIT
1717

1818
echo "Deploying integration test cloud function"
1919

20-
gcloud functions deploy dd-trace-js-sls-mini-agent-integration-test-${STAGE} \
20+
DEPLOY_OUTPUT=$(gcloud functions deploy dd-trace-js-sls-mini-agent-integration-test-${STAGE} \
2121
--gen2 \
2222
--runtime=nodejs18 \
2323
--region=us-east1 \
24+
--project=datadog-sandbox \
2425
--source "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/" \
2526
--entry-point=helloGET \
2627
--trigger-http \
2728
--allow-unauthenticated \
28-
--env-vars-file "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/.env.yaml"
29+
--env-vars-file "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/.env.yaml")
30+
31+
INVOKE_URL=$(echo "$DEPLOY_OUTPUT" | awk 'END {print $NF}')
2932

3033
echo "Calling deployed cloud function"
3134

32-
curl -s "https://us-east1-datadog-sandbox.cloudfunctions.net/dd-trace-js-sls-mini-agent-integration-test-${STAGE}"
35+
curl -s "${INVOKE_URL}"
3336

34-
echo "Waiting 1 minute before tailing logs"
37+
echo "Waiting 60 seconds before tailing logs"
3538
sleep 60
3639

37-
LOGS=$(gcloud functions logs read dd-trace-js-sls-mini-agent-integration-test-${STAGE} --region us-east1 --gen2 --limit 1000)
40+
LOGS=$(gcloud functions logs read dd-trace-js-sls-mini-agent-integration-test-${STAGE} --region us-east1 --gen2 --limit 1000 --project datadog-sandbox)
3841

3942
echo "$LOGS"
4043

0 commit comments

Comments
 (0)