Add a simple test between spdycat and spdyd.
This commit is contained in:
parent
097f59e3d3
commit
9c50bd4c29
|
@ -40,6 +40,6 @@ main_LDFLAGS = -static @CUNIT_LIBS@
|
|||
AM_CFLAGS = -Wall -g -O2 -I${top_srcdir}/lib -I${top_srcdir}/lib/includes -I${top_builddir}/lib/includes \
|
||||
@CUNIT_CFLAGS@
|
||||
|
||||
TESTS = main
|
||||
TESTS = main end_to_end.py
|
||||
|
||||
endif # HAVE_CUNIT
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env python
|
||||
"""End to end tests for the example programs.
|
||||
|
||||
This test assumes the examples have already been built.
|
||||
|
||||
At the moment top_buiddir is not in the environment, but top_builddir would be
|
||||
more reliable than '..', so it's worth trying to pull it from the environment.
|
||||
"""
|
||||
|
||||
__author__ = 'Jim Morrison <jim@twist.com>'
|
||||
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
|
||||
|
||||
_PORT = 9893
|
||||
|
||||
|
||||
def _run_server(port):
|
||||
srcdir = os.environ.get('srcdir', '.')
|
||||
testdata = '%s/testdata' % srcdir
|
||||
top_builddir = os.environ.get('top_builddir', '..')
|
||||
return subprocess.Popen([
|
||||
'%s/examples/spdyd' % top_builddir, str(port),
|
||||
'-d', testdata,
|
||||
'%s/privkey.pem' % testdata,
|
||||
'%s/cacert.pem' % testdata])
|
||||
|
||||
def _check_server_up(port):
|
||||
# Check this check for now.
|
||||
time.sleep(1)
|
||||
|
||||
def _kill_server(server):
|
||||
while server.returncode is None:
|
||||
server.terminate()
|
||||
time.sleep(1)
|
||||
server.poll()
|
||||
|
||||
|
||||
class EndToEndSpdyTests(unittest.TestCase):
|
||||
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]))
|
||||
|
||||
|
||||
class TestProgram(unittest.TestProgram):
|
||||
def runTests(self):
|
||||
self.testRunner = unittest.TextTestRunner()
|
||||
result = self.testRunner.run(self.test)
|
||||
self.successful = result.wasSuccessful()
|
||||
|
||||
|
||||
def main():
|
||||
server = _run_server(_PORT)
|
||||
_check_server_up(_PORT)
|
||||
result = TestProgram()
|
||||
_kill_server(server)
|
||||
return not result.successful
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -0,0 +1,14 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIICKTCCAdOgAwIBAgIJAIsolheWrwMZMA0GCSqGSIb3DQEBBQUAMHAxCzAJBgNV
|
||||
BAYTAlVTMQswCQYDVQQIDAJDQTENMAsGA1UEBwwEQ2l0eTESMBAGA1UECgwJU3Bk
|
||||
eSBUZXN0MRIwEAYDVQQDDAlsb2NhbGhvc3QxHTAbBgkqhkiG9w0BCQEWDnNwZHlA
|
||||
bG9jYWxob3N0MB4XDTEyMDMwMTE5MTI0NVoXDTIzMDUxOTE5MTI0NVowcDELMAkG
|
||||
A1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ0wCwYDVQQHDARDaXR5MRIwEAYDVQQKDAlT
|
||||
cGR5IFRlc3QxEjAQBgNVBAMMCWxvY2FsaG9zdDEdMBsGCSqGSIb3DQEJARYOc3Bk
|
||||
eUBsb2NhbGhvc3QwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAw/2MgzAdlJDm29qH
|
||||
ZlAibgs9mH+8keOtsRrb4B1PiCcZoHvN9eCVZ4WnzT+0zhHF+nO3YfwVFVC3w7TF
|
||||
7fLB3QIDAQABo1AwTjAdBgNVHQ4EFgQUVP2Jw9RX6BB76aV5x2qk5qsrAIQwHwYD
|
||||
VR0jBBgwFoAUVP2Jw9RX6BB76aV5x2qk5qsrAIQwDAYDVR0TBAUwAwEB/zANBgkq
|
||||
hkiG9w0BAQUFAANBAKd9M5FzQLEZW1KPe9/XNZlgxZ2g3EC5Krxo5I4Ul3MnIYS9
|
||||
u4K8t/iprhgOzjFH6+8LVk9v0Za+gU+K43CpUo4=
|
||||
-----END CERTIFICATE-----
|
|
@ -0,0 +1 @@
|
|||
<html><body>small</body></html>
|
|
@ -0,0 +1,9 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIBOwIBAAJBAMP9jIMwHZSQ5tvah2ZQIm4LPZh/vJHjrbEa2+AdT4gnGaB7zfXg
|
||||
lWeFp80/tM4Rxfpzt2H8FRVQt8O0xe3ywd0CAwEAAQJBAIQ8PGP/QNYOdlT8OsLj
|
||||
aneJCgQsm1Rro7ONBbFO1WxslvA6+uJsx4Rs8zLiS8cyqmJ/lmGa7zhwYSOvFQPa
|
||||
XgECIQDgIcgM/2C67peTm1diKKIoGVVKFCfdRi+Dje6mTl2TQQIhAN/bcFWbG73j
|
||||
cUVlIsr9Wk1dJzjPPWKeyirF1qd/WbOdAiEApTsCOeLCssxV3jF02B5QfPNAFx6I
|
||||
zO2C9Z7awque/IECIGCHW3VOoTPMs7dc2Rf3D810cclJdArmtf6juOAZRjDxAiBS
|
||||
AC+H685IBJ99N5nCbF9NWYIVSkuiKVQ8POYVZX+0Jg==
|
||||
-----END RSA PRIVATE KEY-----
|
Loading…
Reference in New Issue