Add a test for spdy version 3.
This commit is contained in:
parent
9c50bd4c29
commit
3b1b4a6ca0
|
@ -20,15 +20,15 @@ import unittest
|
||||||
_PORT = 9893
|
_PORT = 9893
|
||||||
|
|
||||||
|
|
||||||
def _run_server(port):
|
def _run_server(port, args):
|
||||||
srcdir = os.environ.get('srcdir', '.')
|
srcdir = os.environ.get('srcdir', '.')
|
||||||
testdata = '%s/testdata' % srcdir
|
testdata = '%s/testdata' % srcdir
|
||||||
top_builddir = os.environ.get('top_builddir', '..')
|
top_builddir = os.environ.get('top_builddir', '..')
|
||||||
return subprocess.Popen([
|
base_args = ['%s/examples/spdyd' % top_builddir, str(port), '-d', testdata,
|
||||||
'%s/examples/spdyd' % top_builddir, str(port),
|
'%s/privkey.pem' % testdata, '%s/cacert.pem' % testdata]
|
||||||
'-d', testdata,
|
if args:
|
||||||
'%s/privkey.pem' % testdata,
|
base_args.extend(args)
|
||||||
'%s/cacert.pem' % testdata])
|
return subprocess.Popen(base_args)
|
||||||
|
|
||||||
def _check_server_up(port):
|
def _check_server_up(port):
|
||||||
# Check this check for now.
|
# Check this check for now.
|
||||||
|
@ -42,6 +42,15 @@ def _kill_server(server):
|
||||||
|
|
||||||
|
|
||||||
class EndToEndSpdyTests(unittest.TestCase):
|
class EndToEndSpdyTests(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
cls.server = _run_server(_PORT, None)
|
||||||
|
_check_server_up(_PORT)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
_kill_server(cls.server)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
build_dir = os.environ.get('top_builddir', '..')
|
build_dir = os.environ.get('top_builddir', '..')
|
||||||
self.client = '%s/examples/spdycat' % build_dir
|
self.client = '%s/examples/spdycat' % build_dir
|
||||||
|
@ -51,19 +60,24 @@ class EndToEndSpdyTests(unittest.TestCase):
|
||||||
0, subprocess.call([self.client, 'http://localhost:%d/' % _PORT]))
|
0, subprocess.call([self.client, 'http://localhost:%d/' % _PORT]))
|
||||||
|
|
||||||
|
|
||||||
class TestProgram(unittest.TestProgram):
|
class EndToEndSpdy3Tests(unittest.TestCase):
|
||||||
def runTests(self):
|
@classmethod
|
||||||
self.testRunner = unittest.TextTestRunner()
|
def setUpClass(cls):
|
||||||
result = self.testRunner.run(self.test)
|
cls.server = _run_server(_PORT, '-3')
|
||||||
self.successful = result.wasSuccessful()
|
_check_server_up(_PORT)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
_kill_server(cls.server)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
build_dir = os.environ.get('top_builddir', '..')
|
||||||
|
self.client = '%s/examples/spdycat' % build_dir
|
||||||
|
|
||||||
|
def testSimpleRequest(self):
|
||||||
|
self.assertEquals(
|
||||||
|
0, subprocess.call([self.client, 'http://localhost:%d/' % _PORT]))
|
||||||
|
|
||||||
def main():
|
|
||||||
server = _run_server(_PORT)
|
|
||||||
_check_server_up(_PORT)
|
|
||||||
result = TestProgram()
|
|
||||||
_kill_server(server)
|
|
||||||
return not result.successful
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue