Skip to content

Commit

Permalink
Randomize ports in test_https_connection test
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Vrachev <[email protected]>
  • Loading branch information
MVrachev committed Sep 3, 2020
1 parent efca4ae commit e7f56d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/simple_https_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _generate_random_port():
if len(sys.argv) > 1:
try:
PORT = int(sys.argv[1])
if PORT < 30000 or PORT > 45000:
if PORT < 30000 or PORT > 50000:
raise ValueError

except ValueError:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ def test_https_connection(self):
# 4: run with an HTTPS certificate that is expired
# Be sure to offset from the port used in setUp to avoid collision.

port1 = self.server_process_handler.port + 1
port2 = self.server_process_handler.port + 2
port3 = self.server_process_handler.port + 3
port4 = self.server_process_handler.port + 4
port1 = random.randint(30000, 35000)
port2 = random.randint(35001, 40000)
port3 = random.randint(40001, 45000)
port4 = random.randint(45001, 50000)

good_https_server_handler = utils.TestServerProcess(log=logger,
server='simple_https_server.py', port=port1,
Expand Down

0 comments on commit e7f56d0

Please sign in to comment.