Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ def _run_in_app(test_configuration: IntegrationTestConfiguration, direct_interfa
# server for Pulsar - webtest doesn't seem to like having two test
# servers alive at same time.
with files_server("/") as test_files_server:
files_endpoint = to_infrastructure_uri(test_files_server.application_url)
files_endpoint = to_infrastructure_uri(
environ.get("PULSAR_TEST_INTERNAL_JOB_FILES_URL", test_files_server.application_url)
)
if direct_interface:
_run_direct(test_configuration, files_endpoint=files_endpoint, **kwds)
else:
Expand Down
19 changes: 12 additions & 7 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,15 @@ def __init__(self):


@contextmanager
def server_for_test_app(test_app):
def server_for_test_app(test_app, host=None, port=None):
app = test_app.app
create_kwds = {
}
if os.environ.get("PULSAR_TEST_FILE_SERVER_HOST"):
create_kwds["host"] = os.environ.get("PULSAR_TEST_FILE_SERVER_HOST")

create_kwds = {}
if host:
create_kwds["host"] = host
if port:
create_kwds["port"] = port

server = StopableWSGIServer.create(app, **create_kwds)
Comment on lines -258 to 260
Copy link
Contributor Author

@kysrpex kysrpex Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reviewers: now the test Pulsar app won't bind to PULSAR_TEST_FILE_SERVER_HOST (only the files server). Please consider whether this is a breaking change before approving the changes from the PR.

try:
server.wait()
Expand Down Expand Up @@ -469,14 +472,16 @@ def files_server(directory=None):
else:
yield Bunch(application_url=external_url)
else:
host = os.environ.get("PULSAR_TEST_FILE_SERVER_HOST")
port = os.environ.get("PULSAR_TEST_FILE_SERVER_PORT")
if not directory:
with temp_directory() as directory:
app = TestApp(JobFilesApp(directory))
with server_for_test_app(app) as server:
with server_for_test_app(app, host=host, port=port) as server:
yield server, directory
else:
app = TestApp(JobFilesApp(directory))
with server_for_test_app(app) as server:
with server_for_test_app(app, host=host, port=port) as server:
yield server


Expand Down
Loading