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

@ -28,6 +28,7 @@ e@mail.com Intel::EMAIL source1 Phishing email source http://some-data-distribut
@load base/frameworks/control
@load base/frameworks/intel
@load policy/frameworks/cluster/experimental
redef Log::default_rotation_interval=0sec;
module Intel;
@ -55,31 +56,16 @@ event do_it()
Broker::publish(Cluster::node_topic("manager-1"), do_it);
}
global hi_count = 0;
event start_it()
{
Broker::publish(Cluster::node_topic("worker-1"), do_it);
}
event hi()
event Cluster::Experimental::cluster_started()
{
if ( Cluster::node == "manager-1" )
{
++hi_count;
if ( hi_count == 2 )
# Give more time for intel distribution.
schedule 1sec { start_it() };
}
else
Broker::publish(Cluster::node_topic("manager-1"), hi);
}
event Cluster::node_up(name: string, id: string) &priority=-100
{
if ( Cluster::node == "manager-1" )
Broker::publish(Cluster::node_topic(name), hi);
# Give more time for intel distribution.
schedule 1sec { start_it() };
}
event do_terminate()