Commit 07456502 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend/test: Check QUIC after USR1

Asserts Caddy issue https://github.com/mholt/caddy/issues/2394
parent cdd718e1
...@@ -35,6 +35,7 @@ import multiprocessing ...@@ -35,6 +35,7 @@ import multiprocessing
import subprocess import subprocess
from unittest import skip from unittest import skip
import ssl import ssl
import signal
from BaseHTTPServer import HTTPServer from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler from BaseHTTPServer import BaseHTTPRequestHandler
from forcediphttpsadapter.adapters import ForcedIPHTTPSAdapter from forcediphttpsadapter.adapters import ForcedIPHTTPSAdapter
...@@ -3466,26 +3467,38 @@ class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -3466,26 +3467,38 @@ class TestQuicEnabled(SlaveHttpFrontendTestCase, TestDataMixin):
self.assertKeyWithPop('Date', result.headers) self.assertKeyWithPop('Date', result.headers)
self.assertKeyWithPop('Content-Length', result.headers) self.assertKeyWithPop('Content-Length', result.headers)
quic_status, quic_result = getQUIC( def assertQUIC():
'https://%s/%s' % (parameter_dict['domain'], 'test-path'), quic_status, quic_result = getQUIC(
parameter_dict['public-ipv4'], 'https://%s/%s' % (parameter_dict['domain'], 'test-path'),
HTTPS_PORT parameter_dict['public-ipv4'],
) HTTPS_PORT
)
self.assertTrue(quic_status, quic_result) self.assertTrue(quic_status, quic_result)
try: try:
quic_jsoned = quic_result.split('body: ')[2].split('trailers')[0] quic_jsoned = quic_result.split('body: ')[2].split('trailers')[0]
except Exception: except Exception:
raise ValueError('JSON not found at all in QUIC result:\n%s' % ( raise ValueError('JSON not found at all in QUIC result:\n%s' % (
quic_result,)) quic_result,))
try: try:
j = json.loads(quic_jsoned) j = json.loads(quic_jsoned)
except Exception: except Exception:
raise ValueError('JSON decode problem in:\n%s' % (quic_jsoned,)) raise ValueError('JSON decode problem in:\n%s' % (quic_jsoned,))
key = 'Path' key = 'Path'
self.assertTrue(key in j, 'No key %r in %s' % (key, j)) self.assertTrue(key in j, 'No key %r in %s' % (key, j))
self.assertEqual('/test-path', j[key]) self.assertEqual('/test-path', j[key])
assertQUIC()
# https://github.com/mholt/caddy/issues/2394
# after sending USR1 to Caddy QUIC does not work, check current behaviour
caddy_pid = [
q['pid'] for q
in self.getSupervisorRPCServer().supervisor.getAllProcessInfo()
if 'frontend_caddy' in q['name']][0]
os.kill(caddy_pid, signal.SIGUSR1)
assertQUIC()
class TestSlaveBadParameters(SlaveHttpFrontendTestCase, TestDataMixin): class TestSlaveBadParameters(SlaveHttpFrontendTestCase, TestDataMixin):
......
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