From 2d2267802086a4ac64c76e524cabeece0bfd5aab Mon Sep 17 00:00:00 2001 From: David Lee Date: Wed, 19 Jul 2023 09:51:34 -0700 Subject: [PATCH 1/5] try to fix flaky test --- integration-tests/serverless/test-gcloud-function.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/integration-tests/serverless/test-gcloud-function.sh b/integration-tests/serverless/test-gcloud-function.sh index 904f547e1b6..2612ebae292 100755 --- a/integration-tests/serverless/test-gcloud-function.sh +++ b/integration-tests/serverless/test-gcloud-function.sh @@ -29,10 +29,13 @@ gcloud functions deploy dd-trace-js-sls-mini-agent-integration-test-${STAGE} \ echo "Calling deployed cloud function" -curl -s "https://us-east1-datadog-sandbox.cloudfunctions.net/dd-trace-js-sls-mini-agent-integration-test-${STAGE}" +for i in {0..2}; +do + curl -s "https://us-east1-datadog-sandbox.cloudfunctions.net/dd-trace-js-sls-mini-agent-integration-test-${STAGE}" +done -echo "Waiting 1 minute before tailing logs" -sleep 60 +echo "Waiting 90 seconds before tailing logs" +sleep 90 LOGS=$(gcloud functions logs read dd-trace-js-sls-mini-agent-integration-test-${STAGE} --region us-east1 --gen2 --limit 1000) From 1ede7feb44aa94cdf3a0a253965173a8807d3da4 Mon Sep 17 00:00:00 2001 From: David Lee Date: Wed, 19 Jul 2023 09:59:37 -0700 Subject: [PATCH 2/5] Update test-gcloud-function.sh --- integration-tests/serverless/test-gcloud-function.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/integration-tests/serverless/test-gcloud-function.sh b/integration-tests/serverless/test-gcloud-function.sh index 2612ebae292..42c6780d656 100755 --- a/integration-tests/serverless/test-gcloud-function.sh +++ b/integration-tests/serverless/test-gcloud-function.sh @@ -27,6 +27,9 @@ gcloud functions deploy dd-trace-js-sls-mini-agent-integration-test-${STAGE} \ --allow-unauthenticated \ --env-vars-file "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/.env.yaml" +echo "Waiting 30 seconds before invoking function" +sleep 30 + echo "Calling deployed cloud function" for i in {0..2}; @@ -34,8 +37,8 @@ do curl -s "https://us-east1-datadog-sandbox.cloudfunctions.net/dd-trace-js-sls-mini-agent-integration-test-${STAGE}" done -echo "Waiting 90 seconds before tailing logs" -sleep 90 +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) From f3062145940416163ace1e105b86eb47151e4eea Mon Sep 17 00:00:00 2001 From: David Lee Date: Wed, 19 Jul 2023 10:13:32 -0700 Subject: [PATCH 3/5] Update test-gcloud-function.sh --- integration-tests/serverless/test-gcloud-function.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/integration-tests/serverless/test-gcloud-function.sh b/integration-tests/serverless/test-gcloud-function.sh index 42c6780d656..e3072610266 100755 --- a/integration-tests/serverless/test-gcloud-function.sh +++ b/integration-tests/serverless/test-gcloud-function.sh @@ -32,10 +32,7 @@ sleep 30 echo "Calling deployed cloud function" -for i in {0..2}; -do - curl -s "https://us-east1-datadog-sandbox.cloudfunctions.net/dd-trace-js-sls-mini-agent-integration-test-${STAGE}" -done +gcloud functions call "dd-trace-js-sls-mini-agent-integration-test-${STAGE}" --project datadog-sandbox --region us-east1 echo "Waiting 60 seconds before tailing logs" sleep 60 From 998113a74f6db29ef71a054a7688e81b3bbaf4f2 Mon Sep 17 00:00:00 2001 From: David Lee Date: Wed, 19 Jul 2023 10:19:02 -0700 Subject: [PATCH 4/5] Update test-gcloud-function.sh --- integration-tests/serverless/test-gcloud-function.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integration-tests/serverless/test-gcloud-function.sh b/integration-tests/serverless/test-gcloud-function.sh index e3072610266..99c74ff8b59 100755 --- a/integration-tests/serverless/test-gcloud-function.sh +++ b/integration-tests/serverless/test-gcloud-function.sh @@ -21,6 +21,7 @@ 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 \ @@ -32,7 +33,7 @@ sleep 30 echo "Calling deployed cloud function" -gcloud functions call "dd-trace-js-sls-mini-agent-integration-test-${STAGE}" --project datadog-sandbox --region us-east1 +gcloud functions call dd-trace-js-sls-mini-agent-integration-test-${STAGE} --project datadog-sandbox --region us-east1 --gen2 echo "Waiting 60 seconds before tailing logs" sleep 60 From f2d0d150f9e4bb71d2820f59672f942dcc266330 Mon Sep 17 00:00:00 2001 From: David Lee Date: Wed, 19 Jul 2023 10:48:52 -0700 Subject: [PATCH 5/5] Update test-gcloud-function.sh --- .../serverless/test-gcloud-function.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/integration-tests/serverless/test-gcloud-function.sh b/integration-tests/serverless/test-gcloud-function.sh index 99c74ff8b59..cf997cbda60 100755 --- a/integration-tests/serverless/test-gcloud-function.sh +++ b/integration-tests/serverless/test-gcloud-function.sh @@ -11,34 +11,33 @@ ls "${SERVERLESS_INTEGRATION_DIR_PATH}/test-project/" STAGE=$(xxd -l 4 -c 4 -p