mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Misc. unit test improvements
This commit is contained in:
parent
ff22230a73
commit
9f12b56105
11 changed files with 38 additions and 17 deletions
|
@ -1,3 +1,3 @@
|
|||
Ok error
|
||||
171249.90868
|
||||
167377.950902
|
||||
Ok error
|
||||
|
|
|
@ -2,4 +2,10 @@ Connected to a peer
|
|||
Connected to a peer
|
||||
Connected to a peer
|
||||
Connected to a peer
|
||||
got fully_connected event from, worker-1
|
||||
Connected to a peer
|
||||
got fully_connected event from, proxy-1
|
||||
got fully_connected event from, proxy-2
|
||||
got fully_connected event from, manager-1
|
||||
got fully_connected event from, worker-2
|
||||
termination condition met: shutting down
|
||||
|
|
|
@ -3,3 +3,4 @@ Connected to a peer
|
|||
Connected to a peer
|
||||
Connected to a peer
|
||||
Connected to a peer
|
||||
sent fully_connected event
|
||||
|
|
|
@ -2,3 +2,4 @@ Connected to a peer
|
|||
Connected to a peer
|
||||
Connected to a peer
|
||||
Connected to a peer
|
||||
sent fully_connected event
|
||||
|
|
|
@ -2,3 +2,4 @@ Connected to a peer
|
|||
Connected to a peer
|
||||
Connected to a peer
|
||||
Connected to a peer
|
||||
sent fully_connected event
|
||||
|
|
|
@ -2,3 +2,4 @@ Connected to a peer
|
|||
Connected to a peer
|
||||
Connected to a peer
|
||||
Connected to a peer
|
||||
sent fully_connected event
|
||||
|
|
|
@ -2,3 +2,4 @@ Connected to a peer
|
|||
Connected to a peer
|
||||
Connected to a peer
|
||||
Connected to a peer
|
||||
sent fully_connected event
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
event bro_init()
|
||||
{
|
||||
local cp: opaque of cardinality = hll_cardinality_init(0.1, 0.99);
|
||||
local cp: opaque of cardinality = hll_cardinality_init(0.1, 1.0);
|
||||
local base: count = 2130706432; # 127.0.0.0
|
||||
local i: count = 0;
|
||||
while ( ++i < 170000 )
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run logger-1 CLUSTER_NODE=logger-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run logger-1 CLUSTER_NODE=logger-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run manager-1 CLUSTER_NODE=manager-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 CLUSTER_NODE=proxy-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 CLUSTER_NODE=proxy-2 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-1 CLUSTER_NODE=worker-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 CLUSTER_NODE=worker-2 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 CLUSTER_NODE=proxy-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 CLUSTER_NODE=proxy-2 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-1 CLUSTER_NODE=worker-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 CLUSTER_NODE=worker-2 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
# @TEST-EXEC: btest-diff logger-1/.stdout
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff logger-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-2/.stdout
|
||||
|
@ -30,20 +30,27 @@ redef Cluster::retry_interval = 1sec;
|
|||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global fully_connected: event();
|
||||
|
||||
global peer_count = 0;
|
||||
|
||||
global fully_connected_nodes = 0;
|
||||
|
||||
event fully_connected()
|
||||
event fully_connected(n: string)
|
||||
{
|
||||
++fully_connected_nodes;
|
||||
|
||||
if ( Cluster::node == "logger-1" )
|
||||
{
|
||||
print "got fully_connected event from", n;
|
||||
|
||||
if ( peer_count == 5 && fully_connected_nodes == 5 )
|
||||
{
|
||||
print "termination condition met: shutting down";
|
||||
terminate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sent fully_connected event";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,17 +67,20 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
|||
if ( Cluster::node == "logger-1" )
|
||||
{
|
||||
if ( peer_count == 5 && fully_connected_nodes == 5 )
|
||||
{
|
||||
print "termination condition met: shutting down";
|
||||
terminate();
|
||||
}
|
||||
}
|
||||
else if ( Cluster::node == "manager-1" )
|
||||
{
|
||||
if ( peer_count == 5 )
|
||||
event fully_connected();
|
||||
event fully_connected(Cluster::node);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( peer_count == 4 )
|
||||
event fully_connected();
|
||||
event fully_connected(Cluster::node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile2 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile3 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile4 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
|
|
2
testing/external/scripts/diff-all
vendored
2
testing/external/scripts/diff-all
vendored
|
@ -22,7 +22,7 @@ files_cwd=`ls $@`
|
|||
files_baseline=`cd $TEST_BASELINE && ls $@`
|
||||
|
||||
for i in `echo $files_cwd $files_baseline | sort | uniq`; do
|
||||
if [[ "$i" != "loaded_scripts.log" && "$i" != "prof.log" && "$i" != "debug.log" && "$i" != "stats.log" ]]; then
|
||||
if [[ "$i" != "loaded_scripts.log" && "$i" != "prof.log" && "$i" != "debug.log" && "$i" != "stats.log" && "$i" != broker_*.log ]]; then
|
||||
|
||||
if [[ "$i" == "reporter.log" ]]; then
|
||||
# Do not diff the reporter.log if it only complains about missing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue