Management framework: update agent-checkin test to reflect recent changes

This keeps logs produced locally and without rotation, and adopts the simpler
stdout/sterr file naming.
This commit is contained in:
Christian Kreibich 2022-05-13 15:50:52 -07:00
parent 93ea03a081
commit 328e663060
2 changed files with 6 additions and 7 deletions

View file

@ -1,16 +1,15 @@
# This test verifies basic agent-controller communication in the Management
# framework. We launch agent and controller via the supervisor, add an extra
# handler for the notify_agent_hello event that travels agent -> controller, and
# verify its print output in the controller's stdout log.
# verify that it prints receipt of the event to stdout.
# The following env vars is known to the controller framework
# The following environment variables are known to the controller framework:
# @TEST-PORT: ZEEK_CONTROLLER_PORT
# @TEST-PORT: BROKER_PORT
# A bit of a detour to get the port number into the agent configuration
# @TEST-EXEC: btest-bg-run zeek zeek -j %INPUT
# @TEST-EXEC: ZEEK_MANAGEMENT_TESTING=1 btest-bg-run zeek zeek -j %INPUT
# @TEST-EXEC: btest-bg-wait 10
# @TEST-EXEC: btest-diff zeek/controller.stdout
# @TEST-EXEC: btest-diff zeek/nodes/controller/stdout
@load policy/frameworks/management/agent
@load policy/frameworks/management/controller
@ -34,7 +33,7 @@ event zeek_init()
# We're using the controller to shut everything down once the
# notify_agent_hello event has arrived. The controller doesn't normally
# talk to the supervisor, so connect to it.
if ( Supervisor::node()$name == "controller" )
if ( Management::role == Management::CONTROLLER )
{
Broker::peer(getenv("ZEEK_DEFAULT_LISTEN_ADDRESS"), Broker::default_port, Broker::default_listen_retry);
Broker::auto_publish(SupervisorControl::topic_prefix, SupervisorControl::stop_request);
@ -43,7 +42,7 @@ event zeek_init()
event Management::Agent::API::notify_agent_hello(instance: string, host: addr, api_version: count)
{
if ( Supervisor::node()$name == "controller" )
if ( Management::role == Management::CONTROLLER )
{
# On rare occasion it can happen that we log this twice, which'll need
# investigating. For now we ensure we only do so once.