Repository: trafficserver
Updated Branches:
  refs/heads/master 189c843f3 -> 6f71be9b3


Use requests instead of raw sockets


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c4a18790
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c4a18790
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c4a18790

Branch: refs/heads/master
Commit: c4a187905cbdb719b428010d2d4c032e00b76fe1
Parents: 189c843
Author: Thomas Jackson <jackso...@apache.org>
Authored: Thu Apr 30 16:44:04 2015 -0700
Committer: Thomas Jackson <jackso...@apache.org>
Committed: Thu Apr 30 16:44:04 2015 -0700

----------------------------------------------------------------------
 ci/tsqa/tests/test_keepalive.py | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c4a18790/ci/tsqa/tests/test_keepalive.py
----------------------------------------------------------------------
diff --git a/ci/tsqa/tests/test_keepalive.py b/ci/tsqa/tests/test_keepalive.py
index 0e501ce..3e77388 100644
--- a/ci/tsqa/tests/test_keepalive.py
+++ b/ci/tsqa/tests/test_keepalive.py
@@ -77,22 +77,16 @@ class KeepAliveInMixin(object):
         return request
 
     def _aux_KA_working_path_connid(self, protocol, headers=None):
-        # connect tcp
-        s = self._get_socket()
-
-        request = ('GET / HTTP/1.1\r\n'
-                   'Host: foobar.com\r\n')
-        request += self._headers_to_str(headers)
-        request += '\r\n'
-
-        for x in xrange(1, 10):
-            s.send(request)
-            response = s.recv(4096)
-            # cheat, since we know what the body should have
-            if '\r\n\r\n' not in response:
-                response += s.recv(4096)
-            self.assertIn('HTTP/1.1 200 OK', response)
-            self.assertIn('hello', response)
+        with requests.Session() as s:
+            url = '{0}://127.0.0.1:{1}/'.format(protocol, 
int(self.configs['records.config']['CONFIG']['proxy.config.http.server_ports']))
+            conn_id = None
+            for x in xrange(1, 10):
+                ret = requests.get(url)
+                self.assertEqual(ret.status_code, 200)
+                if conn_id is None:
+                    conn_id = ret.text
+                else:
+                    self.assertEqual(ret.text, conn_id)
 
     def _aux_working_path(self, protocol, headers=None):
         # connect tcp

Reply via email to