# @TEST-DOC: Start each node type and ensure there are no unexpected warnings to be seen
#
# @TEST-PORT: BROKER_MANAGER_PORT
# @TEST-PORT: BROKER_LOGGER1_PORT
# @TEST-PORT: BROKER_PROXY1_PORT
# @TEST-PORT: BROKER_WORKER1_PORT
#
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
#
# @TEST-EXEC: CLUSTER_NODE=manager zeek %INPUT
# @TEST-EXEC: CLUSTER_NODE=logger-1 zeek %INPUT
# @TEST-EXEC: CLUSTER_NODE=proxy-1 zeek %INPUT
# @TEST-EXEC: CLUSTER_NODE=worker-1 zeek %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER='$SCRIPTS/diff-remove-abspath' btest-diff .stderr

@load base/frameworks/cluster
@load misc/loaded-scripts

@load test-all-policy

# Flip this to broker to avoid warnings() due Broker::publish()
# calls in some scripts.
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;

# Make this a single-node cluster-layout so no connection attempts happen
# to other nodes.
redef Cluster::nodes = {
	[Cluster::node] = Cluster::nodes[Cluster::node],
};

# Avoid rotation commands to be executed.
redef Log::default_rotation_interval = 0sec;

event zeek_init()
	{
	# Prevent connections to the manager defined in Cluster::nodes.
	delete Cluster::nodes[Cluster::node]$manager;
	print Cluster::node, "zeek_init()";
	terminate();
	}
