btest: Use Broker for Broker specific tests

Now that Cluster::backend defaults to NONE by default, some tests won't
just work anymore for various reasons (mostly due to the logging
framework not sending log writes to broker anymore).

Load the new frameworks/cluster/backend/broker package for these to keep them
functional. Also add the @load to the common broker/cluster-layout.zeek file
to avoid changing all of the files that use that layout.
This commit is contained in:
Arne Welzel 2025-09-25 16:34:19 +02:00
parent 1570dd6a96
commit 5a10772b7d
13 changed files with 27 additions and 2 deletions

View file

@ -19,6 +19,12 @@
# to Cluster::nodes. # to Cluster::nodes.
# Using this testing cluster-layout.zeek switches Zeek to use Broker.
#
# This is side-loaded here to keep all existing tests that rely on
# this Broker testing cluster setup to continue working.
@load frameworks/cluster/backend/broker
# Redef'ed to F if logger-1 or logger-2 are active. # Redef'ed to F if logger-1 or logger-2 are active.
redef Cluster::manager_is_logger = T; redef Cluster::manager_is_logger = T;

View file

@ -1,7 +1,7 @@
# @TEST-DOC: Test errors of cluster bifs # @TEST-DOC: Test errors of cluster bifs
# #
# @TEST-EXEC: zeek --parse-only -b %INPUT # @TEST-EXEC: zeek --parse-only -b %INPUT
# @TEST-EXEC: zeek -b %INPUT # @TEST-EXEC: zeek -b %INPUT frameworks/cluster/backend/broker
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stdout # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stdout

View file

@ -19,6 +19,9 @@
# @TEST-EXEC: btest-diff ./client/.stderr # @TEST-EXEC: btest-diff ./client/.stderr
# @TEST-START-FILE manager.zeek # @TEST-START-FILE manager.zeek
@load frameworks/cluster/backend/broker
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
# Force dispatcher queue being full quickly! # Force dispatcher queue being full quickly!

View file

@ -15,6 +15,8 @@
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff worker/.stdout # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff worker/.stdout
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff client/.stdout # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff client/.stdout
@load frameworks/cluster/backend/broker
global my_new_connection: event(uid: string, c: count); global my_new_connection: event(uid: string, c: count);
event zeek_init() event zeek_init()

View file

@ -4,8 +4,9 @@
# @TEST-EXEC: ZEEK_PLUGIN_PATH=`pwd` zeek -b Demo::PublishEvent %INPUT > output # @TEST-EXEC: ZEEK_PLUGIN_PATH=`pwd` zeek -b Demo::PublishEvent %INPUT > output
# @TEST-EXEC: btest-diff output # @TEST-EXEC: btest-diff output
redef allow_network_time_forward = F; @load frameworks/cluster/backend/broker
redef allow_network_time_forward = F;
module App; module App;

View file

@ -5,6 +5,8 @@
# @TEST-EXEC: btest-bg-wait 30 # @TEST-EXEC: btest-bg-wait 30
# @TEST-EXEC: btest-diff controllee/.stdout # @TEST-EXEC: btest-diff controllee/.stdout
@load frameworks/cluster/backend/broker
@load base/frameworks/control @load base/frameworks/control
const test_var = "ORIGINAL VALUE (this should be printed out first)" &redef; const test_var = "ORIGINAL VALUE (this should be printed out first)" &redef;

View file

@ -9,6 +9,8 @@
# @TEST-EXEC: btest-bg-wait 30 # @TEST-EXEC: btest-bg-wait 30
# @TEST-EXEC: btest-diff controller/.stdout # @TEST-EXEC: btest-diff controller/.stdout
@load frameworks/cluster/backend/broker
@load base/frameworks/control @load base/frameworks/control
# This value shouldn't ever be printed to the controllers stdout. # This value shouldn't ever be printed to the controllers stdout.

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-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 # @TEST-EXEC: btest-bg-wait 20
@load frameworks/cluster/backend/broker

View file

@ -17,6 +17,9 @@
# @TEST-START-FILE common.zeek # @TEST-START-FILE common.zeek
@load base/frameworks/notice/weird @load base/frameworks/notice/weird
# Ensure logging is done via Broker
@load frameworks/cluster/backend/broker
module Test; module Test;
# Disable the string and container length filtering. # Disable the string and container length filtering.

View file

@ -12,6 +12,7 @@
# @TEST-EXEC: btest-diff zeek/worker-1/stdout # @TEST-EXEC: btest-diff zeek/worker-1/stdout
# @TEST-EXEC: btest-diff zeek/proxy-1/stdout # @TEST-EXEC: btest-diff zeek/proxy-1/stdout
@load frameworks/cluster/backend/broker
@load policy/frameworks/cluster/experimental @load policy/frameworks/cluster/experimental
# So the supervised node doesn't terminate right away. # So the supervised node doesn't terminate right away.

View file

@ -13,6 +13,7 @@
# @TEST-EXEC: btest-diff zeek/worker-2/stdout # @TEST-EXEC: btest-diff zeek/worker-2/stdout
# @TEST-EXEC: btest-diff zeek/proxy-1/stdout # @TEST-EXEC: btest-diff zeek/proxy-1/stdout
@load frameworks/cluster/backend/broker
@load policy/frameworks/cluster/experimental @load policy/frameworks/cluster/experimental
# So the supervised node doesn't terminate right away. # So the supervised node doesn't terminate right away.

View file

@ -55,6 +55,7 @@ for host in $(echo ${services_data} | jq -r '.[0].targets[]' | sort); do
done done
# @TEST-END-FILE # @TEST-END-FILE
@load policy/frameworks/cluster/backend/broker
@load policy/frameworks/cluster/experimental @load policy/frameworks/cluster/experimental
@load base/frameworks/telemetry @load base/frameworks/telemetry

View file

@ -11,6 +11,7 @@
# @TEST-EXEC: btest-diff zeek/worker-1/stdout # @TEST-EXEC: btest-diff zeek/worker-1/stdout
# @TEST-EXEC: btest-diff zeek/proxy-1/stdout # @TEST-EXEC: btest-diff zeek/proxy-1/stdout
@load policy/frameworks/cluster/backend/broker
@load policy/frameworks/cluster/experimental @load policy/frameworks/cluster/experimental
# So the supervised node doesn't terminate right away. # So the supervised node doesn't terminate right away.