[ADD] added baseline for the new active-http test and added a test to check for the content-length 0 fix.

This commit is contained in:
Christian Struck 2014-10-22 16:04:04 -07:00
parent 0a59772043
commit d17b3746cf
2 changed files with 28 additions and 9 deletions

View file

@ -1,4 +1,9 @@
[code=200, msg=OK^M, body=It works!, headers={ test1, [code=200, msg=OK^M, body=It works!, headers={
[Server] = 1.0,
[Content-type] = text/plain,
[Date] = July 22, 2013
}]
test2, [code=200, msg=OK^M, body=, headers={
[Server] = 1.0, [Server] = 1.0,
[Content-type] = text/plain, [Content-type] = text/plain,
[Date] = July 22, 2013 [Date] = July 22, 2013

View file

@ -1,7 +1,7 @@
# @TEST-REQUIRES: which python # @TEST-REQUIRES: which python
# @TEST-REQUIRES: which curl # @TEST-REQUIRES: which curl
# #
# @TEST-EXEC: btest-bg-run httpd python $SCRIPTS/httpd.py --max 1 --addr=127.0.0.1 # @TEST-EXEC: btest-bg-run httpd python $SCRIPTS/httpd.py --max 2 --addr=127.0.0.1
# @TEST-EXEC: sleep 3 # @TEST-EXEC: sleep 3
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT # @TEST-EXEC: btest-bg-run bro bro -b %INPUT
# @TEST-EXEC: btest-bg-wait 15 # @TEST-EXEC: btest-bg-wait 15
@ -11,18 +11,32 @@
@load base/frameworks/communication # let network-time run. otherwise there are no heartbeats... @load base/frameworks/communication # let network-time run. otherwise there are no heartbeats...
redef exit_only_after_terminate = T; redef exit_only_after_terminate = T;
event bro_init() global c: count = 0;
{
local req = ActiveHTTP::Request($url="127.0.0.1:32123");
when ( local resp = ActiveHTTP::request(req) ) function check_exit_condition()
{ {
print resp; c += 1;
if ( c == 2 )
terminate(); terminate();
}
function test_request(label: string, req: ActiveHTTP::Request)
{
when ( local response = ActiveHTTP::request(req) )
{
print label, response;
check_exit_condition();
} }
timeout 1min timeout 1min
{ {
print "HTTP request timeout"; print "HTTP request timeout";
terminate(); check_exit_condition();
} }
} }
event bro_init()
{
test_request("test1", [$url="127.0.0.1:32123"]);
test_request("test2", [$url="127.0.0.1:32123/empty", $method="POST"]);
}