Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions integration-tests/serverless/test-gcloud-function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,33 @@ ls "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/"
STAGE=$(xxd -l 4 -c 4 -p </dev/random)

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

echo "Deploying integration test cloud function"

gcloud functions deploy dd-trace-js-sls-mini-agent-integration-test-${STAGE} \
DEPLOY_OUTPUT=$(gcloud functions deploy dd-trace-js-sls-mini-agent-integration-test-${STAGE} \
--gen2 \
--runtime=nodejs18 \
--region=us-east1 \
--project=datadog-sandbox \
--source "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/" \
--entry-point=helloGET \
--trigger-http \
--allow-unauthenticated \
--env-vars-file "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/.env.yaml"
--env-vars-file "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/.env.yaml")

INVOKE_URL=$(echo "$DEPLOY_OUTPUT" | awk 'END {print $NF}')

echo "Calling deployed cloud function"

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

echo "Waiting 1 minute before tailing logs"
echo "Waiting 60 seconds before tailing logs"
sleep 60

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

echo "$LOGS"

Expand Down