mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
btest/frameworks/cluster: Use generic cluster-layout.zeek
This commit is contained in:
parent
e114b0e371
commit
0a06a77c69
18 changed files with 101 additions and 173 deletions
|
@ -5,7 +5,7 @@ Connected to a peer
|
|||
Connected to a peer
|
||||
Connected to a peer
|
||||
Connected to a peer
|
||||
got fully_connected event from, manager-1
|
||||
got fully_connected event from, manager
|
||||
got fully_connected event from, proxy-1
|
||||
got fully_connected event from, proxy-2
|
||||
got fully_connected event from, worker-1
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_PORT5
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY2_PORT
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 45
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager/.stdout
|
||||
|
||||
@load policy/frameworks/cluster/experimental
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
||||
["proxy-2"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
global my_pool_spec: Cluster::PoolSpec =
|
||||
Cluster::PoolSpec(
|
||||
$topic = "zeek/cluster/pool/my_pool",
|
||||
|
@ -76,7 +68,7 @@ function print_stuff(heading: string)
|
|||
|
||||
event Cluster::Experimental::cluster_started()
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
print_stuff("1st stuff");
|
||||
|
@ -86,7 +78,7 @@ event Cluster::Experimental::cluster_started()
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
if ( name == "proxy-1" )
|
||||
|
@ -105,6 +97,6 @@ event Cluster::node_down(name: string, id: string)
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( name == "manager-1" )
|
||||
if ( name == "manager" )
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_PORT5
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY2_PORT
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 45
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager/.stdout
|
||||
|
||||
@load policy/frameworks/cluster/experimental
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
||||
["proxy-2"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
global my_pool_spec: Cluster::PoolSpec =
|
||||
Cluster::PoolSpec(
|
||||
$topic = "zeek/cluster/pool/my_pool",
|
||||
|
@ -76,7 +68,7 @@ function print_stuff(heading: string)
|
|||
|
||||
event Cluster::Experimental::cluster_started()
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
print_stuff("1st stuff");
|
||||
|
@ -86,7 +78,7 @@ event Cluster::Experimental::cluster_started()
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
if ( name == "proxy-1" )
|
||||
|
@ -105,6 +97,6 @@ event Cluster::node_down(name: string, id: string)
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( name == "manager-1" )
|
||||
if ( name == "manager" )
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,32 +1,26 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||
# @TEST-PORT: BROKER_WORKER2_PORT
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -B broker -b %INPUT
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 45
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager/.stdout
|
||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||
# @TEST-EXEC: btest-diff worker-2/.stdout
|
||||
|
||||
@load policy/frameworks/cluster/experimental
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
redef Broker::forward_messages = T;
|
||||
|
||||
event forwarded_event()
|
||||
{
|
||||
print "got forwarded event";
|
||||
|
||||
if ( Cluster::node == "manager-1" )
|
||||
if ( Cluster::node == "manager" )
|
||||
print "manager should NOT have raised the forwarded event";
|
||||
|
||||
terminate();
|
||||
|
@ -43,7 +37,7 @@ event Cluster::Experimental::cluster_started()
|
|||
|
||||
event zeek_init()
|
||||
{
|
||||
if ( Cluster::node == "manager-1" )
|
||||
if ( Cluster::node == "manager" )
|
||||
Broker::forward("test_topic");
|
||||
if ( Cluster::node == "worker-1" )
|
||||
Broker::subscribe("test_topic");
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||
# @TEST-PORT: BROKER_LOGGER1_PORT
|
||||
# @TEST-PORT: BROKER_LOGGER10_PORT
|
||||
#
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
# Add an additional logger-10 node, the template only has logger-1 and logger-2
|
||||
# @TEST-EXEC: echo 'redef Cluster::nodes += { ["logger-10"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_LOGGER10_PORT")), $manager="manager"], };' >> cluster-layout.zeek
|
||||
#
|
||||
# Note: the logger names are chosen on purpose such that one is a prefix of the
|
||||
# other to help verify that the node-specific Cluster topics are able to
|
||||
|
@ -16,18 +20,6 @@
|
|||
|
||||
@load policy/frameworks/cluster/experimental
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::manager_is_logger = F;
|
||||
|
||||
redef Cluster::nodes = {
|
||||
["manager"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager"],
|
||||
["logger-1"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager"],
|
||||
["logger-10"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT4")), $manager="manager"]
|
||||
};
|
||||
|
||||
# @TEST-END-FILE
|
||||
|
||||
redef Log::default_rotation_interval = 0sec;
|
||||
|
||||
module Test;
|
||||
|
|
|
@ -1,38 +1,28 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_PORT5
|
||||
# @TEST-PORT: BROKER_PORT6
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_LOGGER1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY2_PORT
|
||||
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||
# @TEST-PORT: BROKER_WORKER2_PORT
|
||||
#
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run logger-1 CLUSTER_NODE=logger-1 ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run manager-1 CLUSTER_NODE=manager-1 ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run manager CLUSTER_NODE=manager ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 CLUSTER_NODE=proxy-1 ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 CLUSTER_NODE=proxy-2 ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-1 CLUSTER_NODE=worker-1 ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 CLUSTER_NODE=worker-2 ZEEKPATH=$ZEEKPATH:.. zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 40
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff logger-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-2/.stdout
|
||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||
# @TEST-EXEC: btest-diff worker-2/.stdout
|
||||
|
||||
@load base/frameworks/cluster
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::manager_is_logger = F;
|
||||
redef Cluster::nodes = {
|
||||
["logger-1"] = [$node_type=Cluster::LOGGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2"))],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
["proxy-2"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT4")), $manager="manager-1"],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT5")), $manager="manager-1"],
|
||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT6")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
global peer_count = 0;
|
||||
|
||||
global fully_connected_nodes = 0;
|
||||
|
@ -68,7 +58,7 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
|||
return;
|
||||
}
|
||||
|
||||
local expected_nodes = Cluster::node == "manager-1" ? 5 : 4;
|
||||
local expected_nodes = Cluster::node == "manager" ? 5 : 4;
|
||||
if ( peer_count == expected_nodes )
|
||||
{
|
||||
Broker::publish(Cluster::logger_topic, fully_connected, Cluster::node);
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_PORT5
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY2_PORT
|
||||
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||
# @TEST-PORT: BROKER_WORKER2_PORT
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run worker-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 40
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-sort btest-diff manager/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-2/.stdout
|
||||
# @TEST-EXEC: btest-diff worker-1/.stdout
|
||||
|
@ -18,16 +20,6 @@
|
|||
|
||||
@load base/frameworks/cluster
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
||||
["proxy-2"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
["worker-1"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT4")), $manager="manager-1"],
|
||||
["worker-2"] = [$node_type=Cluster::WORKER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT5")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
global peer_count = 0;
|
||||
|
||||
global fully_connected_nodes = 0;
|
||||
|
@ -40,7 +32,7 @@ event fully_connected()
|
|||
print "Got fully_connected event";
|
||||
fully_connected_nodes = fully_connected_nodes + 1;
|
||||
|
||||
if ( Cluster::node == "manager-1" )
|
||||
if ( Cluster::node == "manager" )
|
||||
{
|
||||
if ( peer_count == 4 && fully_connected_nodes == 4 )
|
||||
terminate();
|
||||
|
@ -52,7 +44,7 @@ event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string)
|
|||
print "Connected to a peer";
|
||||
peer_count = peer_count + 1;
|
||||
|
||||
if ( Cluster::node == "manager-1" )
|
||||
if ( Cluster::node == "manager" )
|
||||
{
|
||||
if ( peer_count == 4 && fully_connected_nodes == 4 )
|
||||
terminate();
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_PORT5
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY2_PORT
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 40
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager/.stdout
|
||||
|
||||
@load policy/frameworks/cluster/experimental
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
||||
["proxy-2"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
event go_away()
|
||||
{
|
||||
terminate();
|
||||
|
@ -46,7 +38,7 @@ function print_stuff(heading: string)
|
|||
|
||||
event Cluster::Experimental::cluster_started()
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
print_stuff("1st stuff");
|
||||
|
@ -56,7 +48,7 @@ event Cluster::Experimental::cluster_started()
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
if ( name == "proxy-1" )
|
||||
|
@ -75,6 +67,6 @@ event Cluster::node_down(name: string, id: string)
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( name == "manager-1" )
|
||||
if ( name == "manager" )
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,27 +1,19 @@
|
|||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_PORT5
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY2_PORT
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-2/.stdout
|
||||
|
||||
@load policy/frameworks/cluster/experimental
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
||||
["proxy-2"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
global q = 0;
|
||||
|
||||
event go_away()
|
||||
|
@ -58,7 +50,7 @@ function send_stuff(heading: string)
|
|||
|
||||
event Cluster::Experimental::cluster_started()
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
send_stuff("1st stuff");
|
||||
|
@ -68,7 +60,7 @@ event Cluster::Experimental::cluster_started()
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
if ( name == "proxy-1" )
|
||||
|
@ -87,6 +79,6 @@ event Cluster::node_down(name: string, id: string)
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( name == "manager-1" )
|
||||
if ( name == "manager" )
|
||||
terminate();
|
||||
}
|
||||
|
|
|
@ -1,29 +1,21 @@
|
|||
# @TEST-DOC: Broker::make_event() together with Cluster::publish_hrw() and Cluster::publish_rr()
|
||||
# @TEST-PORT: BROKER_PORT1
|
||||
# @TEST-PORT: BROKER_PORT2
|
||||
# @TEST-PORT: BROKER_PORT3
|
||||
# @TEST-PORT: BROKER_PORT4
|
||||
# @TEST-PORT: BROKER_PORT5
|
||||
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||
# @TEST-PORT: BROKER_PROXY1_PORT
|
||||
# @TEST-PORT: BROKER_PROXY2_PORT
|
||||
#
|
||||
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||
#
|
||||
# @TEST-EXEC: zeek -b --parse-only %INPUT
|
||||
# @TEST-EXEC: btest-bg-run manager-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run manager ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-1 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-1 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-run proxy-2 ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=proxy-2 zeek -b %INPUT
|
||||
# @TEST-EXEC: btest-bg-wait 30
|
||||
# @TEST-EXEC: btest-diff manager-1/.stdout
|
||||
# @TEST-EXEC: btest-diff manager/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-1/.stdout
|
||||
# @TEST-EXEC: btest-diff proxy-2/.stdout
|
||||
|
||||
@load policy/frameworks/cluster/experimental
|
||||
|
||||
# @TEST-START-FILE cluster-layout.zeek
|
||||
redef Cluster::nodes = {
|
||||
["manager-1"] = [$node_type=Cluster::MANAGER, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT1"))],
|
||||
["proxy-1"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT2")), $manager="manager-1"],
|
||||
["proxy-2"] = [$node_type=Cluster::PROXY, $ip=127.0.0.1, $p=to_port(getenv("BROKER_PORT3")), $manager="manager-1"],
|
||||
};
|
||||
# @TEST-END-FILE
|
||||
|
||||
global q = 0;
|
||||
|
||||
event go_away()
|
||||
|
@ -65,7 +57,7 @@ function send_stuff(heading: string)
|
|||
|
||||
event Cluster::Experimental::cluster_started()
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
send_stuff("1st stuff");
|
||||
|
@ -75,7 +67,7 @@ event Cluster::Experimental::cluster_started()
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( Cluster::node != "manager-1" )
|
||||
if ( Cluster::node != "manager" )
|
||||
return;
|
||||
|
||||
if ( name == "proxy-1" )
|
||||
|
@ -94,6 +86,6 @@ event Cluster::node_down(name: string, id: string)
|
|||
|
||||
event Cluster::node_down(name: string, id: string)
|
||||
{
|
||||
if ( name == "manager-1" )
|
||||
if ( name == "manager" )
|
||||
terminate();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue