mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
These changes can be summarized with the following bullets: - Delegate generation of ports used for the tests to the OS - Use thread-safe Queue for processes communication instead of temporary files - Remove all instances of port generation or hardcoded ports - Make test_slow_retrieval.py fully conform with TestServerProcess Delegate generation of ports used for the tests to the OS is much better than if we manually generate them, because there is always a chance that the port we have randomly pick turns out to be taken. By giving 0 to the port argument we ask the OS to give us an arbitrary unused port. Use thread-safe Queue for processes communication instead of temporary files became a necessity because of findings made by Jussi Kukkonen. With the latest changes made in pr 1192 we were rapidly reading from the temporary files and Jussi found that it happened rarely the successful message "bind succeded..." to be corrupted. It seems, this is a thread issue related to the thread redirecting the subprocess stdout to the temp file and our thread rapidly reading from the file. By using a thread-safe Queue we eliminate this possibility. For reference read: https://github.com/theupdateframework/tuf/issues/1196 Lastly, test_slow_retrieval.py and slow_retrieval.py were refactored. Until now, slow_retrieval.py couldn't use the TestServerProcess class from utils.py for a port generation because of a bug related to httpd.handle_request(). Now, when we use httpd.serve_forever() we can refactor both of those files and fully conform with TestServerProcess. Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
29 lines
387 B
JSON
29 lines
387 B
JSON
{
|
|
"mapping": [
|
|
{
|
|
"paths": [
|
|
"*1.txt"
|
|
],
|
|
"repositories": [
|
|
"test_repository1",
|
|
"test_repository2"
|
|
],
|
|
"terminating": false,
|
|
"threshold": 1
|
|
},
|
|
{
|
|
"paths": [
|
|
"*3.txt"
|
|
],
|
|
"repositories": [
|
|
"test_repository2"
|
|
],
|
|
"terminating": true,
|
|
"threshold": 1
|
|
}
|
|
],
|
|
"repositories": {
|
|
"test_repository1": [],
|
|
"test_repository2": []
|
|
}
|
|
}
|