Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9990a3e

Browse filesBrowse files
author
Ace Nassri
authored
chore(functions): support env variables in integration tests (GoogleCloudPlatform#5047)
1 parent c0a8f14 commit 9990a3e
Copy full SHA for 9990a3e

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎functions/helloworld/sample_http_test_integration.py

Copy file name to clipboardExpand all lines: functions/helloworld/sample_http_test_integration.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
def test_args():
2525
name = str(uuid.uuid4())
26-
port = 8080 # Each functions framework instance needs a unique por
26+
port = os.getenv('PORT', 8080) # Each functions framework instance needs a unique port
2727

2828
process = subprocess.Popen(
2929
[
@@ -37,7 +37,7 @@ def test_args():
3737

3838
# Send HTTP request simulating Pub/Sub message
3939
# (GCF translates Pub/Sub messages to HTTP requests internally)
40-
BASE_URL = os.getenv('BASE_URL')
40+
BASE_URL = os.getenv('BASE_URL', f'http://localhost:{port}')
4141

4242
retry_policy = Retry(total=6, backoff_factor=1)
4343
retry_adapter = requests.adapters.HTTPAdapter(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.