[CalendarServer-changes] [12688] CalendarServer/trunk/txweb2/dav/test
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:24:57 PDT 2014
Revision: 12688
http://trac.calendarserver.org//changeset/12688
Author: cdaboo at apple.com
Date: 2014-02-13 11:51:17 -0800 (Thu, 13 Feb 2014)
Log Message:
-----------
Add some debug logging to help diagnose a buildbot test issue.
Modified Paths:
--------------
CalendarServer/trunk/txweb2/dav/test/test_pipeline.py
CalendarServer/trunk/txweb2/dav/test/tworequest_client.py
Modified: CalendarServer/trunk/txweb2/dav/test/test_pipeline.py
===================================================================
--- CalendarServer/trunk/txweb2/dav/test/test_pipeline.py 2014-02-13 02:38:16 UTC (rev 12687)
+++ CalendarServer/trunk/txweb2/dav/test/test_pipeline.py 2014-02-13 19:51:17 UTC (rev 12688)
@@ -7,10 +7,10 @@
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
-#
+#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -21,8 +21,10 @@
#
# DRI: Wilfredo Sanchez, wsanchez at apple.com
##
-import sys, os
+import os
+import sys
+
from twisted.internet import utils
from txweb2.test import test_server
from txweb2 import resource
@@ -39,24 +41,29 @@
"""
class TestResource(resource.LeafResource):
def render(self, req):
- return http.Response(stream="Host:%s, Path:%s"%(req.host, req.path))
-
+ return http.Response(stream="Host:%s, Path:%s" % (req.host, req.path))
+
+
def setUp(self):
self.root = self.TestResource()
+
def chanrequest(self, root, uri, length, headers, method, version, prepath, content):
self.cr = super(Pipeline, self).chanrequest(root, uri, length, headers, method, version, prepath, content)
return self.cr
+
def test_root(self):
-
+
def _testStreamRead(x):
self.assertTrue(self.cr.request.stream.length == 0)
return self.assertResponse(
- (self.root, 'http://host/path', {"content-type":"text/plain",}, "PUT", None, '', "This is some text."),
+ (self.root, 'http://host/path', {"content-type": "text/plain", }, "PUT", None, '', "This is some text."),
(405, {}, None)).addCallback(_testStreamRead)
+
+
class SSLPipeline(test_http.SSLServerTest):
@deferredGenerator
@@ -66,7 +73,8 @@
d = waitForDeferred(utils.getProcessOutputAndValue(sys.executable,
args=args,
env=os.environ))
- yield d; out,err,code = d.getResult()
-
+ yield d
+ out, err, code = d.getResult()
+ print err
self.assertEquals(code, 0, "Error output:\n%s" % (err,))
self.assertEquals(out, "HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\nHTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\n\r\n")
Modified: CalendarServer/trunk/txweb2/dav/test/tworequest_client.py
===================================================================
--- CalendarServer/trunk/txweb2/dav/test/tworequest_client.py 2014-02-13 02:38:16 UTC (rev 12687)
+++ CalendarServer/trunk/txweb2/dav/test/tworequest_client.py 2014-02-13 19:51:17 UTC (rev 12688)
@@ -1,4 +1,6 @@
-import socket, sys
+import socket
+import sys
+import time
test_type = sys.argv[1]
port = int(sys.argv[2])
@@ -10,38 +12,39 @@
if socket_type == 'ssl':
s2 = socket.ssl(s)
- send=s2.write
- recv=s2.read
+ send = s2.write
+ recv = s2.read
else:
- send=s.send
- recv=s.recv
-
-print >> sys.stderr, ">> Making %s request to port %d" % (socket_type, port)
+ send = s.send
+ recv = s.recv
+print >> sys.stderr, "\n>> Making %s request to port %d" % (socket_type, port)
+
send("PUT /forbidden HTTP/1.1\r\n")
send("Host: localhost\r\n")
-print >> sys.stderr, ">> Sending lots of data"
+print >> sys.stderr, ">> Sending lots of data: t={}".format(time.time())
send("Content-Length: 100\r\n\r\n")
-send("X"*100)
+send("X" * 100)
send("PUT /forbidden HTTP/1.1\r\n")
send("Host: localhost\r\n")
-print >> sys.stderr, ">> Sending lots of data"
+print >> sys.stderr, ">> Sending lots of data: t={}".format(time.time())
send("Content-Length: 100\r\n\r\n")
-send("X"*100)
+send("X" * 100)
#import time
#time.sleep(5)
-print >> sys.stderr, ">> Getting data"
-data=''
+print >> sys.stderr, ">> Getting data: t={}".format(time.time())
+data = ''
while len(data) < 299999:
try:
- x=recv(10000)
+ x = recv(10000)
except:
break
if x == '':
break
- data+=x
+ data += x
+print >> sys.stderr, ">> Done data: t={}".format(time.time())
sys.stdout.write(data)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/050db5a9/attachment.html>
More information about the calendarserver-changes
mailing list