Tighten the scripts.base.frameworks.logging.hooks test

This avoids interference from other log streams in the policy hook test cases,
which could cause deviations in output vs baselines depending on build
configuration.
This commit is contained in:
Christian Kreibich 2023-02-01 12:09:42 -08:00
parent b5c8421ac2
commit f8dbf70e3b
2 changed files with 4 additions and 4 deletions

View file

@ -5,4 +5,3 @@ foo
Log::log_stream_policy
bar
bar
Log::log_stream_policy

View file

@ -237,12 +237,12 @@ global output = open("output");
hook Log::log_stream_policy(rec: any, id: Log::ID)
{
print output, "Log::log_stream_policy";
if ( id == Test::LOG )
{
local r: Test::Info = rec;
print output, "Log::log_stream_policy";
if ( r$status == "foo" )
break;
}
@ -255,7 +255,8 @@ hook Test::log_policy(rec: Test::Info, id: Log::ID, filter: Log::Filter)
event zeek_init()
{
local filter: Log::Filter = [$name="other"];
# An unrelated filter whose log we ignore:
local filter: Log::Filter = [$name="yetanother", $path="yetanother"];
Log::add_filter(Test::LOG, filter);
Log::write(Test::LOG, [$t=network_time(), $status="foo"]);