Commit 627cc358 authored by Jérome Perrin's avatar Jérome Perrin

erp5: test logs

parent 68f323f5
......@@ -20,6 +20,7 @@ import subprocess
import tempfile
import time
import logging
import urlparse
setUpModule # pyflakes
......@@ -32,6 +33,8 @@ class TestHandler(BaseHTTPRequestHandler):
'Path': self.path,
'Incoming Headers': self.headers.dict
}
if self.path == '/slow':
time.sleep(2)
response = json.dumps(response, indent=2)
self.end_headers()
self.wfile.write(response)
......@@ -107,7 +110,7 @@ class BalancerTestCase(ERP5InstanceTestCase, EchoServerMixin):
}
class LogTestCase(BalancerTestCase):
class TestAccessLog(BalancerTestCase):
"""Check access logs emitted by balancer
"""
__partition_reference__ = 'l'
......@@ -115,15 +118,13 @@ class LogTestCase(BalancerTestCase):
def test_log_format(self):
balancer_url = json.loads(self.computer_partition.getConnectionParameterDict()['_'])['default']
requests.get(
balancer_url,
urlparse.urljoin(balancer_url, '/slow'),
verify=False,
)
import pdb; pdb.set_trace()
#self.assertEqual(result['Incoming Headers'].get('x-forwarded-for').split(', ')[0], '1.2.3.4')
class TestFrontendXForwardedFor(BalancerTestCase, EchoServerMixin):
__partition_reference__ = 'xff'
......@@ -360,4 +361,4 @@ class TestFrontendXForwardedFor(BalancerTestCase, EchoServerMixin):
verify=False,
)
del TestFrontendXForwardedFor, LogTestCase
\ No newline at end of file
del TestFrontendXForwardedFor, TestAccessLog
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment