Skip to content

Commit 9990873

Browse files
authored
fix(appengine): set project for bundled tests (#13165)
1 parent bb69110 commit 9990873

File tree

9 files changed

+36
-9
lines changed

9 files changed

+36
-9
lines changed

appengine/standard_python3/bundled-services/blobstore/django/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import re
1718
import subprocess
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

appengine/standard_python3/bundled-services/blobstore/flask/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import re
1718
import subprocess
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

appengine/standard_python3/bundled-services/blobstore/wsgi/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import re
1718
import subprocess
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=5)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

appengine/standard_python3/bundled-services/deferred/django/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import subprocess
1718
import time
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

appengine/standard_python3/bundled-services/deferred/flask/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import subprocess
1718
import time
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

appengine/standard_python3/bundled-services/deferred/wsgi/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import subprocess
1718
import time
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

appengine/standard_python3/bundled-services/mail/django/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import subprocess
1718
import time
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

appengine/standard_python3/bundled-services/mail/flask/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import subprocess
1718
import uuid
1819

1920
import backoff
2021
import pytest
2122
import requests
2223

24+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
25+
2326

2427
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2528
def gcloud_cli(command):
@@ -36,7 +39,7 @@ def gcloud_cli(command):
3639
3740
Raises Exception with the stderr output of the last attempt on failure.
3841
"""
39-
full_command = f"gcloud {command} --quiet --format=json"
42+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4043
print("Running command:", full_command)
4144

4245
output = subprocess.run(

appengine/standard_python3/bundled-services/mail/wsgi/main_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
import os
1617
import subprocess
1718
import time
1819
import uuid
@@ -21,6 +22,8 @@
2122
import pytest
2223
import requests
2324

25+
project_id = os.environ["GOOGLE_CLOUD_PROJECT"]
26+
2427

2528
@backoff.on_exception(backoff.expo, Exception, max_tries=3)
2629
def gcloud_cli(command):
@@ -37,7 +40,7 @@ def gcloud_cli(command):
3740
3841
Raises Exception with the stderr output of the last attempt on failure.
3942
"""
40-
full_command = f"gcloud {command} --quiet --format=json"
43+
full_command = f"gcloud {command} --quiet --format=json --project {project_id}"
4144
print("Running command:", full_command)
4245

4346
output = subprocess.run(

0 commit comments

Comments
 (0)