mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
btest: Add test for Cluster::hello zero-timestamp
This commit is contained in:
parent
a9d22611d0
commit
277c3f5245
3 changed files with 54 additions and 0 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
Cluster::hello name=worker-1 is_remote_event=T metadata=[[id=EventMetadata::NETWORK_TIMESTAMP, val=0.0]]
|
||||||
|
Cluster::node_up name=worker-1 is_remote_event=F metadata=[[id=EventMetadata::NETWORK_TIMESTAMP, val=XXXXXXXXXX.XXXXXX]]
|
|
@ -0,0 +1,3 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
Cluster::hello name=manager is_remote_event=T metadata=[[id=EventMetadata::NETWORK_TIMESTAMP, val=XXXXXXXXXX.XXXXXX]]
|
||||||
|
Cluster::node_up name=manager is_remote_event=F metadata=[[id=EventMetadata::NETWORK_TIMESTAMP, val=0.0]]
|
|
@ -0,0 +1,48 @@
|
||||||
|
# @TEST-DOC: Ensure Cluster::hello sent by a worker with a zero network time is observed with a zero network timestamp by the manager.
|
||||||
|
#
|
||||||
|
# @TEST-PORT: BROKER_MANAGER_PORT
|
||||||
|
# @TEST-PORT: BROKER_WORKER1_PORT
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: cp $FILES/broker/cluster-layout.zeek .
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: zeek -b --parse-only %INPUT
|
||||||
|
#
|
||||||
|
# @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-wait 30
|
||||||
|
# @TEST-EXEC: btest-diff ./manager/.stdout
|
||||||
|
# @TEST-EXEC: btest-diff ./worker-1/.stdout
|
||||||
|
|
||||||
|
redef allow_network_time_forward = F;
|
||||||
|
redef EventMetadata::add_network_timestamp = T;
|
||||||
|
|
||||||
|
event do_terminate()
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
event zeek_init()
|
||||||
|
{
|
||||||
|
# Set the manager's time to non-zero, the worker continues to be at 0.0.
|
||||||
|
if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
set_network_time(double_to_time(1748256346));
|
||||||
|
}
|
||||||
|
|
||||||
|
event Cluster::hello(name: string, id: string)
|
||||||
|
{
|
||||||
|
print fmt("Cluster::hello name=%s is_remote_event=%s metadata=%s", name, is_remote_event(), EventMetadata::current_all());
|
||||||
|
}
|
||||||
|
|
||||||
|
event Cluster::node_up(name: string, id: string)
|
||||||
|
{
|
||||||
|
print fmt("Cluster::node_up name=%s is_remote_event=%s metadata=%s", name, is_remote_event(), EventMetadata::current_all());
|
||||||
|
|
||||||
|
if ( Cluster::local_node_type() == Cluster::MANAGER )
|
||||||
|
Cluster::publish(Cluster::worker_topic, do_terminate);
|
||||||
|
}
|
||||||
|
|
||||||
|
event Cluster::node_down(name: string, id: string)
|
||||||
|
{
|
||||||
|
terminate();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue