zeek/testing/btest/scripts/base/utils/active-http.test
Daniel Thayer fdb6d190b8 Add check for curl command to active-http.test
Added a check if the curl command is available when running the
active-http.test so that it fails more quickly and with a clear error
message if it's not available.
2013-10-13 20:31:48 -05:00

28 lines
660 B
Text

# @TEST-REQUIRES: which python
#
# @TEST-EXEC: which curl
# @TEST-EXEC: btest-bg-run httpd python $SCRIPTS/httpd.py --max 1
# @TEST-EXEC: sleep 3
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
# @TEST-EXEC: btest-bg-wait 15
# @TEST-EXEC: btest-diff bro/.stdout
@load base/utils/active-http
@load base/frameworks/communication # let network-time run. otherwise there are no heartbeats...
redef exit_only_after_terminate = T;
event bro_init()
{
local req = ActiveHTTP::Request($url="localhost:32123");
when ( local resp = ActiveHTTP::request(req) )
{
print resp;
terminate();
}
timeout 1min
{
print "HTTP request timeout";
terminate();
}
}