[tests] add simple mod-proxy check

personal/stbuehler/wip
Stefan Bühler 12 years ago
parent 81429d4eb5
commit e2376dbd15

@ -114,6 +114,10 @@ class TestBase(object):
if None != self.config:
errorlog = self.PrepareFile("log/error.log-%s" % self.vhost, "")
accesslog = self.PrepareFile("log/access.log-%s" % self.vhost, "")
if None != self.vhostdir:
docroot = 'docroot "%s";' % self.vhostdir
else:
docroot = ''
if self.subdomains:
config = """
# %s
@ -121,11 +125,11 @@ class TestBase(object):
var.reg_vhosts = var.reg_vhosts + [ "%s" : ${
log = [ "*": "file:%s" ];
accesslog = "%s";
docroot "%s";
%s
%s
}
];
""" % (self.name, regex_subvhosts(self.vhost), errorlog, accesslog, self.vhostdir, self.config)
""" % (self.name, regex_subvhosts(self.vhost), errorlog, accesslog, docroot, self.config)
else:
config = """
# %s
@ -133,11 +137,11 @@ var.reg_vhosts = var.reg_vhosts + [ "%s" : ${
var.vhosts = var.vhosts + [ "%s" : ${
log = [ "*": "file:%s" ];
accesslog = "%s";
docroot "%s";
%s
%s
}
];
""" % (self.name, self.vhost, errorlog, accesslog, self.vhostdir, self.config)
""" % (self.name, self.vhost, errorlog, accesslog, docroot, self.config)
self.tests.append_vhosts_config(config)

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
from base import *
from requests import *
LUA_SET_HOST_HEADER="""
function set_host_header(vr)
vr.req.headers["Host"] = "basic-gets";
end
actions = set_host_header
"""
class TestSimple(CurlRequest):
URL = "/test.txt"
EXPECT_RESPONSE_CODE = 200
def Prepare(self):
# we don't want a docroot action this time
self.vhostdir = None
self.config = """
set_host_header_basic_gets_lua;
proxy "127.0.0.1:%i";
""" % (Env.port + self.PORT)
class Test(GroupTest):
group = [
TestSimple,
]
def Prepare(self):
set_host_header_lua = self.PrepareFile("lua/set_host_header.lua", LUA_SET_HOST_HEADER)
self.plain_config = """
setup {{ module_load "mod_proxy"; }}
set_host_header_basic_gets_lua {{
lua.handler "{set_host_header_lua}";
}}
""".format(set_host_header_lua = set_host_header_lua)
Loading…
Cancel
Save