mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
btest remaining: Use generic cluster-layout.zeek
This commit is contained in:
parent
9365f71965
commit
00eabb6cbb
11 changed files with 47 additions and 81 deletions
|
@ -1,4 +1,4 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
node_up, manager-1
|
node_up, manager
|
||||||
dhcp_message, CHhAvVGS1DHFjwGM9
|
dhcp_message, CHhAvVGS1DHFjwGM9
|
||||||
file_done
|
file_done
|
||||||
|
|
|
@ -1,27 +1,21 @@
|
||||||
# @TEST-PORT: BROKER_PORT1
|
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||||
# @TEST-PORT: BROKER_PORT2
|
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||||
# @TEST-PORT: BROKER_PORT3
|
# @TEST-PORT: BROKER_WORKER2_PORT
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: zeek -b %INPUT>out
|
# @TEST-EXEC: zeek -b %INPUT>out
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b %INPUT runnumber=1
|
# @TEST-EXEC: btest-bg-run worker-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b %INPUT runnumber=1
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b %INPUT runnumber=2
|
# @TEST-EXEC: btest-bg-run worker-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b %INPUT runnumber=2
|
||||||
# @TEST-EXEC: btest-bg-wait 30
|
# @TEST-EXEC: btest-bg-wait 30
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
# @TEST-EXEC: btest-diff manager/.stdout
|
||||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||||
# @TEST-EXEC: btest-diff worker-2/.stdout
|
# @TEST-EXEC: btest-diff worker-2/.stdout
|
||||||
|
|
||||||
@load base/frameworks/cluster
|
@load base/frameworks/cluster
|
||||||
|
|
||||||
# @TEST-START-FILE cluster-layout.zeek
|
|
||||||
redef Cluster::nodes = {
|
|
||||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
|
||||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
|
||||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
|
||||||
};
|
|
||||||
# @TEST-END-FILE
|
|
||||||
|
|
||||||
redef Log::default_rotation_interval = 0secs;
|
redef Log::default_rotation_interval = 0secs;
|
||||||
|
|
||||||
global hll_data: event(data: opaque of cardinality);
|
global hll_data: event(data: opaque of cardinality);
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
# @TEST-DOC: Start each node type and ensure there are no unexpected warnings to be seen
|
# @TEST-DOC: Start each node type and ensure there are no unexpected warnings to be seen
|
||||||
#
|
#
|
||||||
# @TEST-PORT: BROKER_PORT1
|
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||||
# @TEST-PORT: BROKER_PORT2
|
# @TEST-PORT: BROKER_LOGGER1_PORT
|
||||||
# @TEST-PORT: BROKER_PORT3
|
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||||
# @TEST-PORT: BROKER_PORT4
|
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: CLUSTER_NODE=manager zeek %INPUT
|
# @TEST-EXEC: CLUSTER_NODE=manager zeek %INPUT
|
||||||
# @TEST-EXEC: CLUSTER_NODE=logger-1 zeek %INPUT
|
# @TEST-EXEC: CLUSTER_NODE=logger-1 zeek %INPUT
|
||||||
|
@ -20,16 +22,6 @@
|
||||||
# calls in some scripts.
|
# calls in some scripts.
|
||||||
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;
|
redef Cluster::backend = Cluster::CLUSTER_BACKEND_BROKER;
|
||||||
|
|
||||||
# @TEST-START-FILE cluster-layout.zeek
|
|
||||||
redef Cluster::nodes = {
|
|
||||||
["manager"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
|
||||||
["logger-1"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2"))],
|
|
||||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3"))],
|
|
||||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT4"))],
|
|
||||||
};
|
|
||||||
|
|
||||||
# @TEST-END-FILE
|
|
||||||
|
|
||||||
# Make this a single-node cluster-layout so no connection attempts happen
|
# Make this a single-node cluster-layout so no connection attempts happen
|
||||||
# to other nodes.
|
# to other nodes.
|
||||||
redef Cluster::nodes = {
|
redef Cluster::nodes = {
|
||||||
|
@ -41,6 +33,8 @@ redef Log::default_rotation_interval = 0sec;
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
|
# Prevent connections to the manager defined in Cluster::nodes.
|
||||||
|
delete Cluster::nodes[Cluster::node]$manager;
|
||||||
print Cluster::node, "zeek_init()";
|
print Cluster::node, "zeek_init()";
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
# @TEST-PORT: BROKER_PORT1
|
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||||
# @TEST-PORT: BROKER_PORT2
|
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||||
# @TEST-PORT: BROKER_PORT3
|
# @TEST-PORT: BROKER_WORKER2_PORT
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager-1 zeek -b %INPUT"
|
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek -b --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
#
|
||||||
|
# @TEST-EXEC: btest-bg-run manager "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager zeek -b %INPUT"
|
||||||
|
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek -b --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
||||||
|
|
||||||
# @TEST-EXEC: $SCRIPTS/wait-for-file manager-1/lost 45 || (btest-bg-wait -k 1 && false)
|
# @TEST-EXEC: $SCRIPTS/wait-for-file manager/lost 45 || (btest-bg-wait -k 1 && false)
|
||||||
|
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-2 zeek -b --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
# @TEST-EXEC: btest-bg-run worker-2 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-2 zeek -b --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
||||||
# This timeout needs to be large to accommodate ZAM compilation delays.
|
# This timeout needs to be large to accommodate ZAM compilation delays.
|
||||||
|
@ -13,14 +15,6 @@
|
||||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||||
# @TEST-EXEC: btest-diff worker-2/.stdout
|
# @TEST-EXEC: btest-diff worker-2/.stdout
|
||||||
|
|
||||||
# @TEST-START-FILE cluster-layout.zeek
|
|
||||||
redef Cluster::nodes = {
|
|
||||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
|
||||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
|
||||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
|
||||||
};
|
|
||||||
# @TEST-END-FILE
|
|
||||||
|
|
||||||
redef Log::default_rotation_interval = 0secs;
|
redef Log::default_rotation_interval = 0secs;
|
||||||
redef exit_only_after_terminate = T;
|
redef exit_only_after_terminate = T;
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
# @TEST-PORT: BROKER_PORT1
|
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||||
# @TEST-PORT: BROKER_PORT2
|
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager-1 zeek %INPUT"
|
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek --pseudo-realtime -C -r $TRACES/smtp.trace %INPUT"
|
#
|
||||||
|
# @TEST-EXEC: btest-bg-run manager "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager zeek %INPUT"
|
||||||
|
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek --pseudo-realtime -C -r $TRACES/smtp.trace %INPUT"
|
||||||
# @TEST-EXEC: btest-bg-wait 45
|
# @TEST-EXEC: btest-bg-wait 45
|
||||||
# @TEST-EXEC: btest-diff manager-1/openflow.log
|
# @TEST-EXEC: btest-diff manager/openflow.log
|
||||||
|
|
||||||
# @TEST-START-FILE cluster-layout.zeek
|
|
||||||
redef Cluster::nodes = {
|
|
||||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
|
||||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
|
||||||
};
|
|
||||||
# @TEST-END-FILE
|
|
||||||
|
|
||||||
redef Log::default_rotation_interval = 0secs;
|
redef Log::default_rotation_interval = 0secs;
|
||||||
#redef exit_only_after_terminate = T;
|
#redef exit_only_after_terminate = T;
|
||||||
|
|
|
@ -2,14 +2,16 @@
|
||||||
|
|
||||||
# @TEST-REQUIRES: have-redis
|
# @TEST-REQUIRES: have-redis
|
||||||
# @TEST-PORT: REDIS_PORT
|
# @TEST-PORT: REDIS_PORT
|
||||||
# @TEST-PORT: BROKER_PORT1
|
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||||
# @TEST-PORT: BROKER_PORT2
|
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||||
# @TEST-PORT: BROKER_PORT3
|
# @TEST-PORT: BROKER_WORKER2_PORT
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||||
|
|
||||||
# @TEST-EXEC: btest-bg-run redis-server run-redis-server ${REDIS_PORT%/tcp}
|
# @TEST-EXEC: btest-bg-run redis-server run-redis-server ${REDIS_PORT%/tcp}
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b %INPUT
|
# @TEST-EXEC: btest-bg-run worker-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b %INPUT
|
# @TEST-EXEC: btest-bg-run worker-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b %INPUT
|
||||||
# @TEST-EXEC: btest-bg-wait -k 5
|
# @TEST-EXEC: btest-bg-wait -k 5
|
||||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||||
# @TEST-EXEC: btest-diff worker-2/.stdout
|
# @TEST-EXEC: btest-diff worker-2/.stdout
|
||||||
|
@ -20,14 +22,6 @@
|
||||||
@load policy/frameworks/storage/backend/redis
|
@load policy/frameworks/storage/backend/redis
|
||||||
@load policy/frameworks/cluster/experimental
|
@load policy/frameworks/cluster/experimental
|
||||||
|
|
||||||
# @TEST-START-FILE cluster-layout.zeek
|
|
||||||
redef Cluster::nodes = {
|
|
||||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
|
||||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
|
||||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
|
||||||
};
|
|
||||||
# @TEST-END-FILE
|
|
||||||
|
|
||||||
global redis_data_written: event() &is_used;
|
global redis_data_written: event() &is_used;
|
||||||
|
|
||||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
# Test in cluster mode, the manager produces the cluster.log
|
# Test in cluster mode, the manager produces the cluster.log
|
||||||
#
|
#
|
||||||
# @TEST-PORT: BROKER_PORT1
|
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||||
# @TEST-PORT: BROKER_PORT2
|
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: zeek -b --parse-only %INPUT
|
# @TEST-EXEC: zeek -b --parse-only %INPUT
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager-1 zeek -b %INPUT"
|
# @TEST-EXEC: btest-bg-run manager "cp ../cluster-layout.zeek . && CLUSTER_NODE=manager zeek -b %INPUT"
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek -b --pseudo-realtime -C -r $TRACES/dhcp/dhcp_ack_subscriber_id_and_agent_remote_id.trace %INPUT"
|
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.zeek . && CLUSTER_NODE=worker-1 zeek -b --pseudo-realtime -C -r $TRACES/dhcp/dhcp_ack_subscriber_id_and_agent_remote_id.trace %INPUT"
|
||||||
|
|
||||||
# @TEST-EXEC: btest-bg-wait 10
|
# @TEST-EXEC: btest-bg-wait 10
|
||||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
# @TEST-EXEC: btest-diff manager/.stdout
|
||||||
# @TEST-EXEC: btest-diff manager-1/dhcp.log
|
# @TEST-EXEC: btest-diff manager/dhcp.log
|
||||||
|
|
||||||
# @TEST-START-FILE cluster-layout.zeek
|
|
||||||
redef Cluster::nodes = {
|
|
||||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
|
||||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
|
||||||
};
|
|
||||||
# @TEST-END-FILE
|
|
||||||
|
|
||||||
@load base/protocols/dhcp
|
@load base/protocols/dhcp
|
||||||
@load base/frameworks/broker
|
@load base/frameworks/broker
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue