btest/control: Use Broker explicitly

At least the control/controller script looks as if it always intended to
peer with just one node in a cluster using Broker. The controllee script
will start listening for such connections if the selected backend is
actually Broker, so explicitly switch to that here.
This commit is contained in:
Arne Welzel 2025-09-24 15:01:04 +02:00
parent 2f89d59aa5
commit 777a05fd0d
5 changed files with 13 additions and 0 deletions

View file

@ -13,6 +13,9 @@ const test_var = "ORIGINAL VALUE (this should be printed out first)" &redef;
redef test_var = "NEW VALUE (this should be printed out second)";
# @TEST-END-FILE
# This ensures the controllee script starts listening using Broker.
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;
event zeek_init()
{
print test_var;

View file

@ -20,6 +20,9 @@ const test_var = "Original value" &redef;
redef test_var = "This is the value from the controllee";
# @TEST-END-FILE
# This ensures the controllee script starts listening using Broker.
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;
event Control::id_value_response(id: string, val: string)
{
print fmt("Got an id_value_response(%s, %s) event", id, val);

View file

@ -4,3 +4,5 @@
# @TEST-EXEC: btest-bg-run controller ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT frameworks/control/controller Control::host=127.0.0.1 Control::host_port=$BROKER_PORT Control::cmd=shutdown
# @TEST-EXEC: btest-bg-wait 20
# This ensures the controllee script starts listening using Broker.
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;

View file

@ -38,6 +38,9 @@ redef Log::max_log_record_size = 1024 * 1024;
redef Broker::disable_ssl = T;
# Pass log record from logging manager to broker.
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;
event zeek_init()
{
Log::create_stream(LOG, [$columns=Info, $path="test"]);

View file

@ -24,6 +24,8 @@
# @TEST-EXEC: btest-diff manager/services.out
# @TEST-START-FILE cluster-layout.zeek
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;
redef Cluster::nodes = {
["manager"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_MANAGER_PORT")), $metrics_port=to_port(getenv("METRICS_PORT1"))],
["logger-1"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_LOGGER1_PORT")), $manager="manager", $metrics_port=to_port(getenv("METRICS_PORT2"))],