Simplify btests using cluster_started event.

This commit is contained in:
Jan Grashoefer 2023-04-26 20:00:44 +02:00
parent 4ddf7562b9
commit 342d88fbd4
30 changed files with 92 additions and 405 deletions

View file

@ -9,7 +9,7 @@
# @TEST-EXEC: btest-diff manager-1/intel.log
@load base/frameworks/intel
@load base/frameworks/cluster
@load policy/frameworks/cluster/experimental
# @TEST-START-FILE cluster-layout.zeek
redef Cluster::nodes = {
@ -41,8 +41,11 @@ event test_manager()
Broker::publish(Cluster::worker_topic, test_worker);
}
event ready()
event Cluster::Experimental::cluster_started()
{
if ( Cluster::node != "manager-1" )
return;
# Insert the data once all workers are connected.
Intel::insert([$indicator="192.168.0.1", $indicator_type=Intel::ADDR, $meta=[$source="source1"]]);
Intel::insert([$indicator="192.168.0.2", $indicator_type=Intel::ADDR, $meta=[$source="source1"]]);
@ -54,12 +57,6 @@ event ready()
event test_manager();
}
event Cluster::node_up(name: string, id: string)
{
if ( Cluster::node == "worker-1" )
Broker::publish(Cluster::manager_topic, ready);
}
event Intel::remove_item(item: Item, purge_indicator: bool)
{
print fmt("Removing %s (source: %s).", item$indicator, item$meta$source);