Skip to content

Commit da6d4af

Browse files
- Docker host name.
1 parent d157534 commit da6d4af

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,8 @@ jobs:
14611461

14621462

14631463
dockertest:
1464+
env:
1465+
IS_DOCKER: 'true'
14641466
name: Docker Test
14651467
needs:
14661468
- dockerbuild

test/python/stackql_test_tooling/flask/gcp/app.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
import logging
33
from flask import Flask, render_template, request, jsonify
44

5+
import os
6+
57
app = Flask(__name__)
68

9+
_IS_DOCKER = True is os.getenv('IS_DOCKER', 'false').lower() == 'true'
10+
711
# Configure logging
812
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
913
logger = logging.getLogger(__name__)
@@ -43,7 +47,8 @@ def compute_networks_insert(project_name: str):
4347
operation_id = '1000000000001'
4448
operation_name = 'operation-100000000001-10000000001-10000001-10000001'
4549
network_name = body['name']
46-
target_link = f'https://localhost:1080/compute/v1/projects/{ project_name }/global/networks/{ network_name }'
50+
host_name = 'host.docker.internal' if _IS_DOCKER else 'localhost'
51+
target_link = f'https://{host_name}:1080/compute/v1/projects/{ project_name }/global/networks/{ network_name }'
4752
if not body or 'name' not in body:
4853
return '{"msg": "Invalid request body"}', 400, {'Content-Type': 'application/json'}
4954
if not project_name:
@@ -55,6 +60,7 @@ def compute_networks_insert(project_name: str):
5560
operation_id=operation_id,
5661
operation_name=operation_name,
5762
project_name=project_name,
63+
host_name=host_name,
5864
kind='compute#operation',
5965
operation_type='insert',
6066
progress=0,
@@ -66,13 +72,15 @@ def projects_testing_project_global_operation_detail(project_name: str, operatio
6672
if project_name == 'mutable-project' and 'operation-100000000001-10000000001-10000001-10000001':
6773
operation_id = '1000000000001'
6874
network_name = 'auto-test-01'
69-
target_link = f'https://localhost:1080/compute/v1/projects/{ project_name }/global/networks/{ network_name }'
75+
host_name = 'host.docker.internal' if _IS_DOCKER else 'localhost'
76+
target_link = f'https://{host_name}:1080/compute/v1/projects/{ project_name }/global/networks/{ network_name }'
7077
return render_template(
7178
'global-operation.jinja.json',
7279
target_link=target_link,
7380
operation_id=operation_id,
7481
operation_name=operation_name,
7582
project_name=project_name,
83+
host_name=host_name,
7684
kind='compute#operation',
7785
operation_type='insert',
7886
progress=100,

test/python/stackql_test_tooling/flask/gcp/templates/global-operation.jinja.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"insertTime": "2025-07-05T19:42:34.488-07:00",
1212
"startTime": "2025-07-05T19:42:34.491-07:00",
1313
{% if end_time %}"endTime": "{{ end_time }}",{% endif %}
14-
"selfLink": "https://localhost:1080/compute/v1/projects/{{ project_name }}/global/operations/{{ operation_name }}"
14+
"selfLink": "https://{{ host_name }}:1080/compute/v1/projects/{{ project_name }}/global/operations/{{ operation_name }}"
1515
}

0 commit comments

Comments
 (0)