-
Notifications
You must be signed in to change notification settings - Fork 2k
engine: fail startup when HTTP server cannot start #12176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| import concurrent.futures | ||
| import os | ||
| import socket | ||
| import subprocess | ||
|
|
||
| import pytest | ||
| from utils.fluent_bit_manager import FluentBitManager, FluentBitStartupError | ||
| from utils.http_matrix import curl_supports_http2, run_curl_request | ||
| from utils.test_service import FluentBitTestService | ||
|
|
||
|
|
@@ -146,3 +148,28 @@ def test_internal_http_server_http2_subset(): | |
| assert result["http_version"] == "2" | ||
| finally: | ||
| service.stop() | ||
|
|
||
|
|
||
| def test_internal_http_server_bind_failure_fails_startup(monkeypatch): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This commit combines the engine implementation in AGENTS.md reference: AGENTS.md:L167-L172 Useful? React with 👍 / 👎. |
||
| config_file = os.path.abspath( | ||
| os.path.join(os.path.dirname(__file__), "../config/internal_http_server.yaml") | ||
| ) | ||
| holder = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
| holder.bind(("127.0.0.1", 0)) | ||
| port = holder.getsockname()[1] | ||
| fluent_bit = FluentBitManager(config_file) | ||
|
|
||
| monkeypatch.setenv("FLUENT_BIT_HTTP_MONITORING_PORT", str(port)) | ||
|
|
||
| def use_occupied_monitoring_port(_env_var_name, starting_port=0): | ||
| fluent_bit.http_monitoring_port = str(port) | ||
|
|
||
| fluent_bit.set_http_monitoring_port = use_occupied_monitoring_port | ||
|
|
||
| try: | ||
| with pytest.raises(FluentBitStartupError, match="exited early with code"): | ||
| fluent_bit.start() | ||
| assert fluent_bit.process.returncode != 0 | ||
| finally: | ||
| holder.close() | ||
| fluent_bit.stop() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reviewed commit message has no
Signed-off-bytrailer, so it does not satisfy this repository's mandatory DCO policy and may be rejected during contribution checks; recreate the commit with an appropriate sign-off before submission.AGENTS.md reference: AGENTS.md:L140-L140
Useful? React with 👍 / 👎.