Skip to content

Commit 0a80569

Browse files
authored
Fix overlap in sql db creation in E2E tests (#7187)
## Description Fixes #7136 Fixes #6636 Note: It's a good idea to open an issue first for discussion. ## Checklist - [ ] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md) - [ ] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#readme-file) - [ ] **Tests** pass: `nox -s py-3.6` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [ ] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/.github/CODEOWNERS) with the codeowners for this sample
1 parent 937297c commit 0a80569

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

run/django/test/e2e_test_cleanup.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ steps:
3232
"gcloud container images delete gcr.io/${PROJECT_ID}/${_SERVICE}:${_VERSION} --quiet"
3333
3434
./test/retry.sh "gcloud run services describe ${_SERVICE} --region ${_REGION} --platform ${_PLATFORM}" \
35-
"gcloud run services delete ${_SERVICE} --region ${_REGION} --platform ${_PLATFORM} --quiet"
35+
"gcloud run services delete ${_SERVICE} --region ${_REGION} --platform ${_PLATFORM} --async --quiet"
3636
37-
./test/retry.sh "gcloud sql databases describe ${_DB_NAME} --instance ${_DB_INSTANCE} --project $PROJECT_ID" \
37+
WAIT=30 ./test/retry.sh "gcloud sql databases describe ${_DB_NAME} --instance ${_DB_INSTANCE} --project $PROJECT_ID" \
3838
"gcloud sql databases delete ${_DB_NAME} --instance ${_DB_INSTANCE} --quiet --project $PROJECT_ID"
3939
4040
./test/retry.sh "gcloud sql users list --filter \"name=${_DB_USER}\" --instance ${_DB_INSTANCE}" \

run/django/test/e2e_test_setup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ steps:
1919
args:
2020
- "-c"
2121
- |
22-
./test/retry.sh "gcloud sql databases create ${_DB_NAME} \
22+
WAIT=30 ./test/retry.sh "gcloud sql databases create ${_DB_NAME} \
2323
--instance ${_DB_INSTANCE} \
2424
--project ${PROJECT_ID}"
2525

run/django/test/retry.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ runIfSuccessful() {
4848
# Define max retries
4949
max_attempts=3;
5050
attempt_num=1;
51-
51+
seconds="${WAIT:=2}"
5252
arg1="$1"
5353
arg2="$2"
5454

@@ -67,6 +67,6 @@ do
6767
exit 1
6868
else
6969
echo "Attempt $attempt_num / $max_attempts failed!"
70-
sleep $((attempt_num++))
70+
sleep $(( seconds*attempt_num++ ))
7171
fi
7272
done

run/idp-sql/test/e2e_test_cleanup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ steps:
2929
./test/retry.sh "gcloud container images describe gcr.io/${PROJECT_ID}/${_SERVICE}:${_VERSION}" \
3030
"gcloud container images delete gcr.io/${PROJECT_ID}/${_SERVICE}:${_VERSION} --quiet"
3131
32-
./test/retry.sh "gcloud sql databases describe ${_DB_NAME} --instance ${_DB_INSTANCE} --project $PROJECT_ID" \
32+
WAIT=30 ./test/retry.sh "gcloud sql databases describe ${_DB_NAME} --instance ${_DB_INSTANCE} --project $PROJECT_ID" \
3333
"gcloud sql databases delete ${_DB_NAME} --instance ${_DB_INSTANCE} --quiet --project $PROJECT_ID"
3434
3535
substitutions:

run/idp-sql/test/e2e_test_setup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ steps:
2020
args:
2121
- '-c'
2222
- |
23-
./test/retry.sh "gcloud sql databases create ${_DB_NAME} \
23+
WAIT=30 ./test/retry.sh "gcloud sql databases create ${_DB_NAME} \
2424
--instance ${_DB_INSTANCE} \
2525
--project $PROJECT_ID"
2626

run/idp-sql/test/retry.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ runIfSuccessful() {
4848
# Define max retries
4949
max_attempts=3;
5050
attempt_num=1;
51-
51+
seconds="${WAIT:=2}"
5252
arg1="$1"
5353
arg2="$2"
5454

@@ -67,6 +67,6 @@ do
6767
exit 1
6868
else
6969
echo "Attempt $attempt_num / $max_attempts failed!"
70-
sleep $((attempt_num++))
70+
sleep $(( seconds*attempt_num++ ))
7171
fi
7272
done

0 commit comments

Comments
 (0)