Commit graph

8 commits

Author SHA1 Message Date
Lukas Puehringer
7dbb30ae10 Fix failing AppVeyor Python2.7 tests
Since #885 the tests in TestUpdater and TestKeyRevocation fail on
Appveyor Python 2.7 builds. After some live debugging, it turns out
that the tests fail due to the extra amount of http requests to
the simple http server (see tests/simple_server.py) that were
added in #885.

The simple server runs in a subprocess and is re-used for the
entire TestCase. After a certain amount of requests it becomes
unresponsive. Note that neither the subprocess exits (ps -W), nor
does the port get closed (netstat -a). It just doesn't serve the
request, making it time out and fail the test.

The following script can be used to reproduce the issue (run in
tests directory):

```python
import subprocess
import requests
import random

counter = 0

port = random.randint(30000, 45000)
command = ['python', 'simple_server.py', str(port)]
server_process = subprocess.Popen(command, stderr=subprocess.PIPE)
url = 'http://localhost:'+str(port) + '/'

sess = requests.Session()

try:
  while True:
    sess.get(url, timeout=3)
    counter +=1

finally:
  print(counter)
  server_process.kill()
```

It fails repeatedly on the 69th request, but only if
`stderr=subprocess.PIPE` is passed to Popen. Given that for each
request the simple server writes about ~60 characters to stderr,
e.g. ...
```
127.0.0.1 - - [24/Feb/2020 12:01:23] "GET / HTTP/1.1" 200 -
```
... it looks a lot like a full pipe buffer of size 4096. Note that the
`bufsize` argument to Popen does not change anything.

As a simple work around we silence the test server on
Windows/Python2 to not fill the buffer.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
2020-02-24 16:32:26 +01:00
Vladimir Diaz
8f65fa4154
Rename license files in modules
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2018-02-05 11:31:19 -05:00
Vladimir Diaz
f2514bdc4d
Add copyright and license to test-related files
Signed-off-by: Vladimir Diaz <vladimir.v.diaz@gmail.com>
2017-11-30 13:33:11 -05:00
Vladimir Diaz
47471db40f Add import statements for unvendored dependencies in the unit tests 2015-06-02 10:28:02 -04:00
Vladimir Diaz
fbb10a36c9 Refactor repository_tool.py and improve test coverage.
Created repository_lib.py.
2014-06-03 14:32:44 -04:00
Vladimir Diaz
ab95a4b3aa [WIP] Python 2+3 support.
Python 2+3 unicode.
libraries.
The following modules (and their tests) work in PY2.7+3.3:
keydb, hash, formats, mirrors
2014-04-29 14:27:34 -04:00
Vladimir Diaz
a7f28b9af4 [WIP] Python 2+3 support.
Add six, convert PY <=2.5 exception handling, dictionary iteration, libraries, 1/2 the tests.
2014-04-22 15:03:42 -04:00
vladdd
5f94d5be0d Support ISO 8601, vendor iso8601, clean codebase. 2014-04-19 14:27:53 -04:00
Renamed from tests/integration/simple_server.py (Browse further)