mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
btest: Remove Broker::auto_publish() usages
The ones that seemed to test Broker::auto_publish() were annotated for removal.
This commit is contained in:
parent
927e936653
commit
455e05bc2e
14 changed files with 35 additions and 72 deletions
|
@ -1,4 +1,5 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
option changed, testcount, 1,
|
||||||
option changed, testport, 44/tcp,
|
option changed, testport, 44/tcp,
|
||||||
option changed, teststring, b, comment
|
option changed, teststring, b, comment
|
||||||
option changed, testcount, 1,
|
option changed, testcount, 1,
|
||||||
|
|
|
@ -28,11 +28,6 @@ global hll_data: event(data: opaque of cardinality);
|
||||||
|
|
||||||
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
@if ( Cluster::local_node_type() == Cluster::WORKER )
|
||||||
|
|
||||||
event zeek_init()
|
|
||||||
{
|
|
||||||
Broker::auto_publish(Cluster::manager_topic, hll_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
global runnumber: count &redef; # differentiate runs
|
global runnumber: count &redef; # differentiate runs
|
||||||
|
|
||||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
@ -84,7 +79,7 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
print hll_cardinality_estimate(c);
|
print hll_cardinality_estimate(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
event hll_data(c);
|
Broker::publish(Cluster::manager_topic, hll_data, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
|
@ -21,13 +21,12 @@ global ping: event(msg: string, c: count);
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
Broker::subscribe("zeek/event/my_topic");
|
Broker::subscribe("zeek/event/my_topic");
|
||||||
Broker::auto_publish("zeek/event/my_topic", ping);
|
|
||||||
Broker::peer("127.0.0.1", to_port(getenv("BROKER_PORT")));
|
Broker::peer("127.0.0.1", to_port(getenv("BROKER_PORT")));
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_event()
|
function send_event()
|
||||||
{
|
{
|
||||||
event ping("my-message", ++event_count);
|
Broker::publish("zeek/event/my_topic", ping, "my-message", ++event_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
@ -70,7 +69,6 @@ event delayed_listen()
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
Broker::subscribe("zeek/event/my_topic");
|
Broker::subscribe("zeek/event/my_topic");
|
||||||
Broker::auto_publish("zeek/event/my_topic", pong);
|
|
||||||
schedule 5secs { delayed_listen() };
|
schedule 5secs { delayed_listen() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +94,7 @@ event ping(msg: string, n: count)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event pong(msg, n);
|
Broker::publish("zeek/event/my_topic", pong, msg, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# @TEST-DOC: Disabling an unrelated event group caused auto-publish to break because the remote event had no bodies and got disabled. This is a regression test it's not being done again.
|
# @TEST-DOC: Disabling an unrelated event group caused auto-publish to break because the remote event had no bodies and got disabled. This is a regression test it's not being done again.
|
||||||
#
|
#
|
||||||
|
# Remove in v8.1 when auto_publish() is removed.
|
||||||
|
#
|
||||||
# @TEST-GROUP: broker
|
# @TEST-GROUP: broker
|
||||||
#
|
#
|
||||||
# @TEST-PORT: BROKER_PORT
|
# @TEST-PORT: BROKER_PORT
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Remove in v8.1 when auto_publish() is gone.
|
||||||
|
#
|
||||||
# @TEST-GROUP: broker
|
# @TEST-GROUP: broker
|
||||||
#
|
#
|
||||||
# @TEST-PORT: BROKER_PORT
|
# @TEST-PORT: BROKER_PORT
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Remove in v8.1 when auto_publish() is gone.
|
||||||
|
#
|
||||||
# Not compatible with -O C++ testing since includes two distinct scripts.
|
# Not compatible with -O C++ testing since includes two distinct scripts.
|
||||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||||
#
|
#
|
||||||
|
|
|
@ -30,6 +30,7 @@ function print_index(k: any)
|
||||||
|
|
||||||
event done()
|
event done()
|
||||||
{
|
{
|
||||||
|
Broker::publish("zeek/events", done);
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +51,6 @@ event inserted()
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
Broker::auto_publish("zeek/events", done);
|
|
||||||
Broker::subscribe("zeek/");
|
Broker::subscribe("zeek/");
|
||||||
|
|
||||||
h = Broker::create_master("test");
|
h = Broker::create_master("test");
|
||||||
|
@ -84,7 +84,11 @@ global query_timeout = 1sec;
|
||||||
global h: opaque of Broker::Store;
|
global h: opaque of Broker::Store;
|
||||||
|
|
||||||
|
|
||||||
global inserted: event();
|
event inserted()
|
||||||
|
{
|
||||||
|
# Propagate inserted()
|
||||||
|
Broker::publish("zeek/events", inserted);
|
||||||
|
}
|
||||||
|
|
||||||
function print_index(k: any)
|
function print_index(k: any)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +135,6 @@ event lookup(stage: count)
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
Broker::auto_publish("zeek/events", inserted);
|
|
||||||
Broker::subscribe("zeek/");
|
Broker::subscribe("zeek/");
|
||||||
Broker::listen("127.0.0.1", to_port(getenv("BROKER_PORT")));
|
Broker::listen("127.0.0.1", to_port(getenv("BROKER_PORT")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ event do_terminate()
|
||||||
event print_something(i: int)
|
event print_something(i: int)
|
||||||
{
|
{
|
||||||
print "Something sender", i;
|
print "Something sender", i;
|
||||||
|
Broker::publish("zeek/event/my_topic", print_something, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
event unpeer(endpoint: Broker::EndpointInfo)
|
event unpeer(endpoint: Broker::EndpointInfo)
|
||||||
|
@ -39,7 +40,6 @@ event unpeer(endpoint: Broker::EndpointInfo)
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
Broker::subscribe("zeek/event/my_topic");
|
Broker::subscribe("zeek/event/my_topic");
|
||||||
Broker::auto_publish("zeek/event/my_topic", print_something);
|
|
||||||
Broker::peer("127.0.0.1", to_port(getenv("BROKER_PORT")));
|
Broker::peer("127.0.0.1", to_port(getenv("BROKER_PORT")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,15 +51,6 @@ event fully_connected(n: string)
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print "sent fully_connected event";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
event zeek_init()
|
|
||||||
{
|
|
||||||
Broker::auto_publish(Cluster::logger_topic, fully_connected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
@ -74,16 +65,14 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
print "termination condition met: shutting down";
|
print "termination condition met: shutting down";
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if ( Cluster::node == "manager-1" )
|
|
||||||
|
local expected_nodes = Cluster::node == "manager-1" ? 5 : 4;
|
||||||
|
if ( peer_count == expected_nodes )
|
||||||
{
|
{
|
||||||
if ( peer_count == 5 )
|
Broker::publish(Cluster::logger_topic, fully_connected, Cluster::node);
|
||||||
event fully_connected(Cluster::node);
|
print "sent fully_connected event";
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( peer_count == 4 )
|
|
||||||
event fully_connected(Cluster::node);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ redef Cluster::nodes = {
|
||||||
};
|
};
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
global fully_connected: event();
|
|
||||||
|
|
||||||
global peer_count = 0;
|
global peer_count = 0;
|
||||||
|
|
||||||
global fully_connected_nodes = 0;
|
global fully_connected_nodes = 0;
|
||||||
|
@ -49,11 +47,6 @@ event fully_connected()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event zeek_init()
|
|
||||||
{
|
|
||||||
Broker::auto_publish(Cluster::manager_topic, fully_connected);
|
|
||||||
}
|
|
||||||
|
|
||||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
{
|
{
|
||||||
print "Connected to a peer";
|
print "Connected to a peer";
|
||||||
|
@ -67,7 +60,7 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( peer_count == 3 )
|
if ( peer_count == 3 )
|
||||||
event fully_connected();
|
Broker::publish(Cluster::manager_topic, fully_connected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,6 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
global ready_for_data: event();
|
|
||||||
|
|
||||||
event zeek_init()
|
|
||||||
{
|
|
||||||
Broker::auto_publish(Cluster::worker_topic, ready_for_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@if ( Cluster::node == "worker-1" )
|
@if ( Cluster::node == "worker-1" )
|
||||||
event Cluster::Experimental::cluster_started()
|
event Cluster::Experimental::cluster_started()
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,10 +38,6 @@ global n = 0;
|
||||||
|
|
||||||
event ready_for_data()
|
event ready_for_data()
|
||||||
{
|
{
|
||||||
@if ( Cluster::node == "manager-1" )
|
|
||||||
Config::set_value("testcount", 1);
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ( Cluster::node == "worker-1" )
|
@if ( Cluster::node == "worker-1" )
|
||||||
Config::set_value("testport", 44/tcp);
|
Config::set_value("testport", 44/tcp);
|
||||||
Config::set_value("teststring", "b", "comment");
|
Config::set_value("teststring", "b", "comment");
|
||||||
|
@ -66,7 +62,6 @@ function option_changed(ID: string, new_value: any, location: string): any
|
||||||
|
|
||||||
event zeek_init() &priority=5
|
event zeek_init() &priority=5
|
||||||
{
|
{
|
||||||
Broker::auto_publish(Cluster::worker_topic, ready_for_data);
|
|
||||||
Option::set_change_handler("testport", option_changed, -100);
|
Option::set_change_handler("testport", option_changed, -100);
|
||||||
Option::set_change_handler("teststring", option_changed, -100);
|
Option::set_change_handler("teststring", option_changed, -100);
|
||||||
Option::set_change_handler("testcount", option_changed, -100);
|
Option::set_change_handler("testcount", option_changed, -100);
|
||||||
|
@ -79,9 +74,11 @@ event Cluster::node_up(name: string, id: string) &priority=-5
|
||||||
{
|
{
|
||||||
++peer_count;
|
++peer_count;
|
||||||
if ( peer_count == 1 )
|
if ( peer_count == 1 )
|
||||||
event ready_for_data();
|
{
|
||||||
|
Config::set_value("testcount", 1);
|
||||||
|
Broker::publish(Cluster::worker_topic, ready_for_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
|
|
|
@ -50,9 +50,7 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string)
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
global ready_for_data: event();
|
event ready_for_data() &is_used
|
||||||
|
|
||||||
event ready_for_data()
|
|
||||||
{
|
{
|
||||||
if ( Cluster::node == "worker-1" )
|
if ( Cluster::node == "worker-1" )
|
||||||
{
|
{
|
||||||
|
@ -74,8 +72,6 @@ event ready_for_data()
|
||||||
SumStats::observe("test", [$host=7.2.1.5], [$num=91]);
|
SumStats::observe("test", [$host=7.2.1.5], [$num=91]);
|
||||||
SumStats::observe("test", [$host=10.10.10.10], [$num=5]);
|
SumStats::observe("test", [$host=10.10.10.10], [$num=5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
did_data = T;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
@if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
@ -91,7 +87,8 @@ event second_test()
|
||||||
event send_ready_for_data()
|
event send_ready_for_data()
|
||||||
{
|
{
|
||||||
print "Sending ready for data";
|
print "Sending ready for data";
|
||||||
event ready_for_data();
|
Broker::publish(Cluster::worker_topic, ready_for_data);
|
||||||
|
did_data = T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,10 +101,4 @@ event Cluster::Experimental::cluster_started()
|
||||||
schedule 5secs { send_ready_for_data() };
|
schedule 5secs { send_ready_for_data() };
|
||||||
schedule 10secs { second_test() };
|
schedule 10secs { second_test() };
|
||||||
}
|
}
|
||||||
|
|
||||||
event zeek_init() &priority=100
|
|
||||||
{
|
|
||||||
Broker::auto_publish(Cluster::worker_topic, ready_for_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
|
@ -34,10 +34,7 @@ event zeek_init()
|
||||||
# notify_agent_hello event has arrived. The controller doesn't normally
|
# notify_agent_hello event has arrived. The controller doesn't normally
|
||||||
# talk to the supervisor, so connect to it.
|
# talk to the supervisor, so connect to it.
|
||||||
if ( Management::role == Management::CONTROLLER )
|
if ( Management::role == Management::CONTROLLER )
|
||||||
{
|
|
||||||
Broker::peer(getenv("ZEEK_DEFAULT_LISTEN_ADDRESS"), Broker::default_port, Broker::default_listen_retry);
|
Broker::peer(getenv("ZEEK_DEFAULT_LISTEN_ADDRESS"), Broker::default_port, Broker::default_listen_retry);
|
||||||
Broker::auto_publish(SupervisorControl::topic_prefix, SupervisorControl::stop_request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event Management::Agent::API::notify_agent_hello(instance: string, id: string, connecting: bool, api_version: count)
|
event Management::Agent::API::notify_agent_hello(instance: string, id: string, connecting: bool, api_version: count)
|
||||||
|
@ -50,7 +47,7 @@ event Management::Agent::API::notify_agent_hello(instance: string, id: string, c
|
||||||
logged = T;
|
logged = T;
|
||||||
|
|
||||||
# This takes down the whole process tree.
|
# This takes down the whole process tree.
|
||||||
event SupervisorControl::stop_request();
|
Broker::publish(SupervisorControl::topic_prefix, SupervisorControl::stop_request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue