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
11 changes: 10 additions & 1 deletion src/flb_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,16 @@ int flb_engine_start(struct flb_config *config)
if (config->http_server == FLB_TRUE) {
config->http_ctx = flb_hs_create(config->http_listen, config->http_port,
config);
flb_hs_start(config->http_ctx);
if (!config->http_ctx) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add the required DCO sign-off

The reviewed commit message has no Signed-off-by trailer, 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 👍 / 👎.

flb_error("[engine] could not initialize HTTP server");
return -1;
}

ret = flb_hs_start(config->http_ctx);
if (ret != 0) {
flb_error("[engine] could not start HTTP server");
return -1;
}
}
#endif

Expand Down
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

Expand Down Expand Up @@ -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):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Split the integration coverage into a separate commit

This commit combines the engine implementation in src/flb_engine.c with Python integration-suite changes, although repository branch practice requires core plumbing and integration tests to be committed separately; split the implementation and regression coverage into component-scoped commits before submission.

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()
Loading