mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
BIT-1941: improve unit test stability
Mostly trying to standardize the way tests sleep for arbitrary amounts of time to make it easier to tell at which particular point the unit test actually may need the timeout interval increased (or else debugged further).
This commit is contained in:
parent
df3ce608e3
commit
15d74ac081
43 changed files with 302 additions and 386 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
|||
|
||||
2.5-725 | 2018-07-03 14:56:10 -0500
|
||||
|
||||
* BIT-1941: improve unit test stability (Corelight)
|
||||
|
||||
2.5-723 | 2018-07-03 09:34:10 -0500
|
||||
|
||||
* Fix unstable config framework test (Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.5-723
|
||||
2.5-725
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
Input::EVENT_NEW, cat |, input0
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input0
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay0
|
||||
Input::EVENT_NEW, cat |, input1
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input1
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay01
|
||||
Input::EVENT_NEW, cat |, input2
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input2
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay012
|
||||
Input::EVENT_NEW, cat |, input3
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input3
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay0123
|
||||
Input::EVENT_NEW, cat |, input4
|
||||
hello
|
||||
Input::EVENT_NEW, cat |, input4
|
||||
there\x01\x02\x03\x04\x05\x01\x02\x03yay01234
|
||||
Input::EVENT_NEW, cat |, input0, hello
|
||||
Input::EVENT_NEW, cat |, input0, there\x01\x02\x03\x04\x05\x01\x02\x03yay0
|
||||
Input::EVENT_NEW, cat |, input1, hello
|
||||
Input::EVENT_NEW, cat |, input1, there\x01\x02\x03\x04\x05\x01\x02\x03yay01
|
||||
Input::EVENT_NEW, cat |, input4, hello
|
||||
Input::EVENT_NEW, cat |, input4, there\x01\x02\x03\x04\x05\x01\x02\x03yay01234
|
||||
Input::EVENT_NEW, cat |, input2, hello
|
||||
Input::EVENT_NEW, cat |, input2, there\x01\x02\x03\x04\x05\x01\x02\x03yay012
|
||||
Input::EVENT_NEW, cat |, input3, hello
|
||||
Input::EVENT_NEW, cat |, input3, there\x01\x02\x03\x04\x05\x01\x02\x03yay0123
|
||||
|
|
|
@ -1,153 +1,25 @@
|
|||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdfkh:KH;fdkncv;ISEUp34:Fkdj;YVpIODhfDF
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
DSF"DFKJ"SDFKLh304yrsdkfj@#(*U$34jfDJup3UF
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
q3r3057fdf
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdfs\d
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
dfsdf
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdf
|
||||
[source=tail -f ../input.log |, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
tail -f ../input.log |, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
3rw43wRRERLlL#RWERERERE.
|
||||
done
|
||||
|
|
|
@ -1,153 +1,25 @@
|
|||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdfkh:KH;fdkncv;ISEUp34:Fkdj;YVpIODhfDF
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
DSF"DFKJ"SDFKLh304yrsdkfj@#(*U$34jfDJup3UF
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
q3r3057fdf
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdfs\d
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
dfsdf
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
sdf
|
||||
[source=../input.log, reader=Input::READER_RAW, mode=Input::STREAM, name=input, fields=<no value description>, want_record=F, ev=line
|
||||
{
|
||||
print A::outfile, A::description;
|
||||
print A::outfile, A::tpe;
|
||||
print A::outfile, A::s;
|
||||
A::try = A::try + 1;
|
||||
if (8 == A::try)
|
||||
{
|
||||
print A::outfile, done;
|
||||
close(A::outfile);
|
||||
Input::remove(input);
|
||||
terminate();
|
||||
}
|
||||
|
||||
}, error_ev=<uninitialized>, config={
|
||||
|
||||
}]
|
||||
../input.log, Input::READER_RAW, Input::STREAM, input
|
||||
Input::EVENT_NEW
|
||||
3rw43wRRERLlL#RWERERERE.
|
||||
done
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Rule added, worker-2:2, 4
|
||||
Rule added, worker-2:3, 5
|
||||
1
|
||||
Rule destroyed, worker-2:3, 5, 0
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro -m %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -m %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 60
|
||||
|
@ -19,6 +18,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global n = 0;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#
|
||||
# @TEST-EXEC: bro -m %INPUT>out
|
||||
# @TEST-EXEC: btest-bg-run manager-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro -m %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro -m runnumber=1 %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro -m runnumber=2 %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 60
|
||||
|
@ -24,6 +23,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global hll_data: event(data: opaque of cardinality);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#
|
||||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro bro -m -b %INPUT
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 8 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got6 8 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 60
|
||||
|
||||
|
@ -48,7 +48,12 @@ event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
|||
print outfile, s;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 16 )
|
||||
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 6 )
|
||||
system("touch got6");
|
||||
else if ( try == 16 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
#
|
||||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro bro -m -b %INPUT
|
||||
# @TEST-EXEC: sleep 60
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 60 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got4 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got6 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input4.log input.log
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got8 10 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input5.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 120
|
||||
|
||||
|
@ -145,7 +145,16 @@ event Input::end_of_data(name: string, source: string)
|
|||
}
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 10 )
|
||||
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 4 )
|
||||
system("touch got4");
|
||||
else if ( try == 6 )
|
||||
system("touch got6");
|
||||
else if ( try == 8 )
|
||||
system("touch got8");
|
||||
else if ( try == 10 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global my_pool_spec: Cluster::PoolSpec =
|
||||
Cluster::PoolSpec(
|
||||
$topic = "bro/cluster/pool/my_pool",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global my_pool_spec: Cluster::PoolSpec =
|
||||
Cluster::PoolSpec(
|
||||
$topic = "bro/cluster/pool/my_pool",
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
#
|
||||
# @TEST-EXEC: btest-bg-run logger-1 BROPATH=$BROPATH:.. CLUSTER_NODE=logger-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run logger-2 BROPATH=$BROPATH:.. CLUSTER_NODE=logger-2 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run manager BROPATH=$BROPATH:.. CLUSTER_NODE=manager bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
# @TEST-EXEC: btest-diff logger-1/test.log
|
||||
|
@ -22,6 +20,10 @@ redef Cluster::nodes = {
|
|||
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0sec;
|
||||
|
||||
module Test;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run logger-1 CLUSTER_NODE=logger-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run manager-1 CLUSTER_NODE=manager-1 BROPATH=$BROPATH:.. bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @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: sleep 1
|
||||
# @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
|
||||
|
@ -29,6 +26,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
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;
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -24,6 +22,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
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;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global proxy_count = 0;
|
||||
|
||||
event go_away()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
|
@ -19,6 +18,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
global proxy_count = 0;
|
||||
global q = 0;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile2 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile3 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv configfile4 configfile
|
||||
# @TEST-EXEC: touch configfile
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
|
@ -103,6 +103,12 @@ event Input::end_of_data(name: string, source:string)
|
|||
|
||||
eolcount += 1;
|
||||
|
||||
if ( eolcount == 4 )
|
||||
if ( eolcount == 1 )
|
||||
system("touch got1");
|
||||
else if ( eolcount == 2 )
|
||||
system("touch got2");
|
||||
else if ( eolcount == 3 )
|
||||
system("touch got3");
|
||||
else if ( eolcount == 4 )
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run controllee BROPATH=$BROPATH:.. bro %INPUT frameworks/control/controllee Broker::default_port=65531/tcp
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: btest-bg-run controller BROPATH=$BROPATH:.. bro %INPUT test-redef frameworks/control/controller Control::host=127.0.0.1 Control::host_port=65531/tcp Control::cmd=configuration_update
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: btest-bg-run controller2 BROPATH=$BROPATH:.. bro %INPUT frameworks/control/controller Control::host=127.0.0.1 Control::host_port=65531/tcp Control::cmd=shutdown
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff controllee/.stdout
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
const test_var = "ORIGINAL VALUE (this should be printed out first)" &redef;
|
||||
|
||||
@TEST-START-FILE test-redef.bro
|
||||
|
@ -23,3 +24,8 @@ event bro_done()
|
|||
{
|
||||
print test_var;
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -75,7 +75,9 @@ event Input::end_of_data(name: string, source: string)
|
|||
print outfile, servers;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 2 )
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
# failing behavior.
|
||||
|
||||
# @TEST-EXEC: btest-bg-run bro bro %INPUT
|
||||
# @TEST-EXEC: sleep 10
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/init 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv does-exist.dat does-not-exist.dat
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/next 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: mv does-not-exist.dat does-not-exist-again.dat
|
||||
# @TEST-EXEC: echo "3 streaming still works" >> does-not-exist-again.dat
|
||||
# @TEST-EXEC: btest-bg-wait -k 3
|
||||
# @TEST-EXEC: btest-bg-wait 5
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff bro/.stdout
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff bro/.stderr
|
||||
|
||||
|
@ -31,9 +31,17 @@ type Val: record {
|
|||
line: string;
|
||||
};
|
||||
|
||||
global line_count = 0;
|
||||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, v: Val)
|
||||
{
|
||||
print fmt("%s: %s", description$name, v$line);
|
||||
++line_count;
|
||||
|
||||
if ( line_count == 4 )
|
||||
system("touch next");
|
||||
if ( line_count == 5 )
|
||||
terminate();
|
||||
}
|
||||
|
||||
event line2(description: Input::EventDescription, tpe: Input::Event, v: Val)
|
||||
|
@ -49,4 +57,5 @@ event bro_init()
|
|||
Input::add_event([$source="../does-not-exist.dat", $name="inputmanual", $reader=Input::READER_ASCII, $mode=Input::MANUAL, $fields=Val, $ev=line, $want_record=T]);
|
||||
Input::add_event([$source="../does-not-exist.dat", $name="input2", $reader=Input::READER_ASCII, $mode=Input::REREAD, $fields=Val, $ev=line2, $want_record=T,
|
||||
$config=table(["fail_on_file_problem"] = "T")]);
|
||||
system("touch init");
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input4.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got4 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input5.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -96,7 +96,15 @@ event Input::end_of_data(name: string, source: string)
|
|||
try = try + 1;
|
||||
print outfile, fmt("Update_finished for %s, try %d", name, try);
|
||||
print outfile, servers;
|
||||
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 4 )
|
||||
system("touch got4");
|
||||
if ( try == 5 )
|
||||
{
|
||||
close(outfile);
|
||||
|
|
|
@ -7,6 +7,7 @@ redef exit_only_after_terminate = T;
|
|||
|
||||
global outfile: file;
|
||||
global processes_finished: count = 0;
|
||||
global lines_received: count = 0;
|
||||
global n: count = 0;
|
||||
global total_processes: count = 0;
|
||||
|
||||
|
@ -20,10 +21,23 @@ type Val: record {
|
|||
s: string;
|
||||
};
|
||||
|
||||
global more_input: function(name_prefix: string);
|
||||
|
||||
function check_terminate_condition()
|
||||
{
|
||||
if ( processes_finished != total_processes )
|
||||
return;
|
||||
|
||||
if ( lines_received != (total_processes - 1) * 2 )
|
||||
return;
|
||||
|
||||
terminate();
|
||||
}
|
||||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
||||
{
|
||||
print outfile, tpe, description$source, description$name;
|
||||
print outfile, s;
|
||||
++lines_received;
|
||||
print outfile, tpe, description$source, description$name, s;
|
||||
}
|
||||
|
||||
event InputRaw::process_finished(name: string, source:string, exit_code:count, signal_exit:bool)
|
||||
|
@ -31,10 +45,18 @@ event InputRaw::process_finished(name: string, source:string, exit_code:count, s
|
|||
print "process_finished", name, source;
|
||||
Input::remove(name);
|
||||
++processes_finished;
|
||||
if ( processes_finished == total_processes )
|
||||
if ( processes_finished == 1 )
|
||||
{
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
}
|
||||
else if ( processes_finished == total_processes )
|
||||
{
|
||||
close(outfile);
|
||||
terminate();
|
||||
check_terminate_condition();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,9 +81,4 @@ event bro_init()
|
|||
$reader=Input::READER_RAW, $mode=Input::STREAM,
|
||||
$name="input", $fields=Val, $ev=line, $want_record=F,
|
||||
$config=config_strings]);
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
more_input("input");
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -38,12 +38,16 @@ global outfile: file;
|
|||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
||||
{
|
||||
print outfile, description;
|
||||
print outfile, description$source, description$reader, description$mode, description$name;
|
||||
print outfile, tpe;
|
||||
print outfile, s;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 8 )
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 8 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: cp input.log input2.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: echo "hi" >> input2.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff out
|
||||
|
@ -24,7 +24,9 @@ event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
|||
{
|
||||
print outfile, s;
|
||||
try = try + 1;
|
||||
if ( try == 3 )
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
{
|
||||
close(outfile);
|
||||
terminate();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -37,12 +37,17 @@ global outfile: file;
|
|||
|
||||
event line(description: Input::EventDescription, tpe: Input::Event, s: string)
|
||||
{
|
||||
print outfile, description;
|
||||
print outfile, description$source, description$reader, description$mode, description$name;
|
||||
print outfile, tpe;
|
||||
print outfile, s;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 8 )
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 8 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input2.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got3 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input4.log input.log
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got4 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input5.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -126,7 +126,16 @@ event Input::end_of_data(name: string, source: string)
|
|||
print outfile, servers;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 5 )
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
system("touch got3");
|
||||
else if ( try == 4 )
|
||||
system("touch got4");
|
||||
else if ( try == 5 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input2.log >> input.log
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cat input3.log >> input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
@ -66,8 +66,12 @@ event line(description: Input::TableDescription, tpe: Input::Event, left: Idx, r
|
|||
print outfile, servers;
|
||||
|
||||
try = try + 1;
|
||||
|
||||
if ( try == 3 )
|
||||
|
||||
if ( try == 1 )
|
||||
system("touch got1");
|
||||
else if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
{
|
||||
print outfile, "done";
|
||||
close(outfile);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# @TEST-EXEC: cp input1.log input.log
|
||||
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
|
||||
# @TEST-EXEC: sleep 5
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp input3.log input.log
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: btest-diff event.out
|
||||
|
@ -116,7 +116,9 @@ event Input::end_of_data(name: string, source: string)
|
|||
#print fin_out, servers;
|
||||
|
||||
try = try + 1;
|
||||
if ( try == 3 )
|
||||
if ( try == 2 )
|
||||
system("touch got2");
|
||||
else if ( try == 3 )
|
||||
{
|
||||
print fin_out, "done";
|
||||
print fin_out, servers;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
|
||||
# @TEST-EXEC: btest-bg-run broproc bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait -k 5
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait -k 10
|
||||
|
@ -26,6 +25,10 @@ e@mail.com Intel::EMAIL source1 Phishing email source http://some-data-distribut
|
|||
@TEST-END-FILE
|
||||
|
||||
@load base/frameworks/control
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval=0sec;
|
||||
|
||||
module Intel;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
|
||||
# @TEST-EXEC: cp intel1.dat intel.dat
|
||||
# @TEST-EXEC: btest-bg-run broproc bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file broproc/got1 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp intel2.dat intel.dat
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-file broproc/got2 5 || (btest-bg-wait -k 1 && false)
|
||||
# @TEST-EXEC: cp intel3.dat intel.dat
|
||||
# @TEST-EXEC: btest-bg-wait 6
|
||||
# @TEST-EXEC: btest-bg-wait 10
|
||||
# @TEST-EXEC: cat broproc/intel.log > output
|
||||
# @TEST-EXEC: cat broproc/notice.log >> output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
@ -35,6 +33,8 @@ redef Intel::read_files += { "../intel.dat" };
|
|||
redef enum Intel::Where += { SOMEWHERE };
|
||||
|
||||
global runs = 0;
|
||||
global entries_read = 0;
|
||||
|
||||
event do_it()
|
||||
{
|
||||
Intel::seen([$host=1.2.3.4,
|
||||
|
@ -43,8 +43,11 @@ event do_it()
|
|||
$where=SOMEWHERE]);
|
||||
|
||||
++runs;
|
||||
if ( runs < 3 )
|
||||
schedule 3sec { do_it() };
|
||||
|
||||
if ( runs == 1 )
|
||||
system("touch got1");
|
||||
if ( runs == 2 )
|
||||
system("touch got2");
|
||||
}
|
||||
|
||||
global log_lines = 0;
|
||||
|
@ -55,7 +58,17 @@ event Intel::log_intel(rec: Intel::Info)
|
|||
terminate();
|
||||
}
|
||||
|
||||
event bro_init() &priority=-10
|
||||
module Intel;
|
||||
|
||||
event Intel::read_entry(desc: Input::EventDescription, tpe: Input::Event, item: Intel::Item)
|
||||
{
|
||||
schedule 1sec { do_it() };
|
||||
++entries_read;
|
||||
print entries_read;
|
||||
|
||||
if ( entries_read == 1 )
|
||||
event do_it();
|
||||
else if ( entries_read == 3 )
|
||||
event do_it();
|
||||
else if ( entries_read == 5 )
|
||||
event do_it();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/wikipedia.trace %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: cat manager-1/reporter.log | grep -v "reporter/" > manager-reporter.log
|
||||
|
@ -21,6 +20,10 @@ redef Cluster::nodes = {
|
|||
redef exit_only_after_terminate = T;
|
||||
@endif
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef Log::default_scope_sep="_";
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/wikipedia.trace %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff manager-1/http.log
|
||||
|
@ -20,6 +19,9 @@ redef Cluster::nodes = {
|
|||
redef exit_only_after_terminate = T;
|
||||
@endif
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef Log::default_scope_sep="_";
|
||||
|
@ -59,9 +61,12 @@ event bro_init()
|
|||
{
|
||||
if ( Cluster::node == "worker-1" )
|
||||
Broker::subscribe("death");
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
if ( Cluster::node == "manager-1" )
|
||||
schedule 13sec { kill_worker() };
|
||||
schedule 2sec { kill_worker() };
|
||||
}
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
|
||||
# @TEST-EXEC: $SCRIPTS/wait-for-pid $(cat worker-1/.pid) 10 || (btest-bg-wait -k 1 && false)
|
||||
|
||||
# @TEST-EXEC: btest-bg-run worker-2 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-2 bro --pseudo-realtime -C -r $TRACES/tls/ecdhe.pcap %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||
|
@ -17,6 +18,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
#redef exit_only_after_terminate = T;
|
||||
|
||||
|
@ -51,9 +56,14 @@ event terminate_me() {
|
|||
terminate();
|
||||
}
|
||||
|
||||
global peers_lost = 0;
|
||||
|
||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
schedule 1sec { terminate_me() };
|
||||
++peers_lost;
|
||||
|
||||
if ( peers_lost == 2 )
|
||||
schedule 2sec { terminate_me() };
|
||||
}
|
||||
|
||||
event NetControl::rule_added(r: NetControl::Rule, p: NetControl::PluginState, msg: string &default="")
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff manager-1/notice.log
|
||||
|
@ -15,6 +14,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef enum Notice::Type += {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 BROPATH=$BROPATH:.. CLUSTER_NODE=proxy-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 2
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
redef enum Notice::Type += {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=worker-1 bro --pseudo-realtime -C -r $TRACES/smtp.trace %INPUT"
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
# @TEST-EXEC: btest-diff manager-1/openflow.log
|
||||
|
@ -13,6 +12,9 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
#redef exit_only_after_terminate = T;
|
||||
|
||||
|
@ -21,6 +23,18 @@ redef Log::default_rotation_interval = 0secs;
|
|||
|
||||
global of_controller: OpenFlow::Controller;
|
||||
|
||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||
event bro_init()
|
||||
{
|
||||
suspend_processing();
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||
{
|
||||
continue_processing();
|
||||
}
|
||||
@endif
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
of_controller = OpenFlow::log_new(42);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -16,6 +15,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global n = 0;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 3
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 20
|
||||
|
@ -15,6 +14,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
event bro_init() &priority=5
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -17,6 +16,10 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
global n = 0;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -15,6 +14,9 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
event bro_init() &priority=5
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# @TEST-SERIALIZE: comm
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 BROPATH=$BROPATH:.. CLUSTER_NODE=manager-1 bro %INPUT
|
||||
# @TEST-EXEC: sleep 1
|
||||
# @TEST-EXEC: btest-bg-run worker-1 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-1 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 BROPATH=$BROPATH:.. CLUSTER_NODE=worker-2 bro %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 15
|
||||
|
@ -16,6 +15,9 @@ redef Cluster::nodes = {
|
|||
};
|
||||
@TEST-END-FILE
|
||||
|
||||
redef Cluster::retry_interval = 1sec;
|
||||
redef Broker::default_listen_retry = 1sec;
|
||||
redef Broker::default_connect_retry = 1sec;
|
||||
redef Log::default_rotation_interval = 0secs;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue