mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Stabilize a cluster logging unit test
This commit is contained in:
parent
5c9813eadb
commit
1eeecf5fcc
5 changed files with 33 additions and 17 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
2.5-906 | 2018-08-24 14:57:55 -0500
|
||||||
|
|
||||||
|
* Stabilize a cluster logging unit test (Jon Siwek, Corelight)
|
||||||
|
|
||||||
2.5-905 | 2018-08-24 10:21:35 -0500
|
2.5-905 | 2018-08-24 10:21:35 -0500
|
||||||
|
|
||||||
* Detect MaxMind DB changes and auto-reload (Jonathan Perkins, Corelight)
|
* Detect MaxMind DB changes and auto-reload (Jonathan Perkins, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.5-905
|
2.5-906
|
||||||
|
|
|
@ -1,12 +1,2 @@
|
||||||
#separator \x09
|
1535139819.649067 Reporter::INFO qux /home/jon/projects/bro/bro/testing/btest/.tmp/scripts.base.frameworks.logging.field-extension-cluster-error/field-extension-cluster-error.bro, line XX
|
||||||
#set_separator ,
|
1535139821.906059 bah manager-1 0.000000 Reporter::INFO qux /home/jon/projects/bro/bro/testing/btest/.tmp/scripts.base.frameworks.logging.field-extension-cluster-error/field-extension-cluster-error.bro, line XX
|
||||||
#empty_field (empty)
|
|
||||||
#unset_field -
|
|
||||||
#path reporter
|
|
||||||
#open 2018-04-27-22-48-04
|
|
||||||
#fields _write_ts _stream _system_name ts level message location
|
|
||||||
#types time string string time enum string string
|
|
||||||
1524869284.624934 reporter manager-1 0.000000 Reporter::WARNING WriterFrontend broker/Log::WRITER_ASCII expected 9 fields in write, got 6. Skipping line. (empty)
|
|
||||||
1524869284.679015 reporter manager-1 0.000000 Reporter::WARNING WriterFrontend cluster/Log::WRITER_ASCII expected 6 fields in write, got 3. Skipping line. (empty)
|
|
||||||
1524869299.534389 reporter manager-1 0.000000 Reporter::INFO received termination signal (empty)
|
|
||||||
#close 2018-04-27-22-48-19
|
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
# @TEST-EXEC: btest-bg-run manager-1 "cp ../cluster-layout.bro . && CLUSTER_NODE=manager-1 bro %INPUT"
|
||||||
# @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-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-bg-wait 20
|
||||||
# @TEST-EXEC: cat manager-1/reporter.log | grep -v "reporter/" > manager-reporter.log
|
# @TEST-EXEC: grep qux manager-1/reporter.log | sed 's#line ..#line XX#g' > manager-reporter.log
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-canonifier | grep -v ^# | $SCRIPTS/diff-sort" btest-diff manager-reporter.log
|
# @TEST-EXEC: grep qux manager-1/reporter-2.log | sed 's#line ..*#line XX#g' >> manager-reporter.log
|
||||||
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-canonifier | $SCRIPTS/diff-remove-abspath | grep -v ^# | $SCRIPTS/diff-sort" btest-diff manager-reporter.log
|
||||||
|
|
||||||
|
|
||||||
@TEST-START-FILE cluster-layout.bro
|
@TEST-START-FILE cluster-layout.bro
|
||||||
|
@ -35,7 +36,7 @@ type Extension: record {
|
||||||
function add_extension(path: string): Extension
|
function add_extension(path: string): Extension
|
||||||
{
|
{
|
||||||
return Extension($write_ts = network_time(),
|
return Extension($write_ts = network_time(),
|
||||||
$stream = path,
|
$stream = "bah",
|
||||||
$system_name = peer_description);
|
$system_name = peer_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,16 +57,31 @@ event slow_death()
|
||||||
|
|
||||||
event kill_worker()
|
event kill_worker()
|
||||||
{
|
{
|
||||||
|
Reporter::info("qux");
|
||||||
Broker::publish("death", slow_death);
|
Broker::publish("death", slow_death);
|
||||||
}
|
}
|
||||||
|
|
||||||
event bro_init()
|
event bro_init()
|
||||||
{
|
{
|
||||||
if ( Cluster::node == "worker-1" )
|
if ( Cluster::node == "worker-1" )
|
||||||
|
{
|
||||||
Broker::subscribe("death");
|
Broker::subscribe("death");
|
||||||
|
suspend_processing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
{
|
||||||
if ( Cluster::node == "manager-1" )
|
if ( Cluster::node == "manager-1" )
|
||||||
schedule 13sec { kill_worker() };
|
{
|
||||||
|
schedule 2sec { kill_worker() };
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( Cluster::node == "worker-1" )
|
||||||
|
{
|
||||||
|
continue_processing();
|
||||||
|
Reporter::info("qux");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
|
|
@ -57,13 +57,19 @@ event kill_worker()
|
||||||
event bro_init()
|
event bro_init()
|
||||||
{
|
{
|
||||||
if ( Cluster::node == "worker-1" )
|
if ( Cluster::node == "worker-1" )
|
||||||
|
{
|
||||||
|
suspend_processing();
|
||||||
Broker::subscribe("death");
|
Broker::subscribe("death");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
{
|
{
|
||||||
if ( Cluster::node == "manager-1" )
|
if ( Cluster::node == "manager-1" )
|
||||||
schedule 2sec { kill_worker() };
|
schedule 2sec { kill_worker() };
|
||||||
|
|
||||||
|
if ( Cluster::node == "worker-1" )
|
||||||
|
continue_processing();
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue