Merge #16918: test: Make PORT_MIN in test runner configurable

fa69588537bc91c0aedbc89ef1760d89cbffad75 test: Make PORT_MIN in test runner configurable (MarcoFalke)

Pull request description:

  This is needed when some ports in the port range are used by other processes. Note that simply assigning the ports dynamically does not work:

  * We spin up several nodes per test (each node gets its own port)
  * We run several tests in parallel

  So to avoid nodes from different tests colliding on ports, the port assignment must be deterministic (can not be dynamic).

  Fixes: #10869

ACKs for top commit:
  practicalswift:
    ACK fa69588537bc91c0aedbc89ef1760d89cbffad75 -- diff looks correct
  promag:
    ACK fa69588537bc91c0aedbc89ef1760d89cbffad75.

Tree-SHA512: e79adb015e7de79064e2d14336c38bc9672bd779ad6c52917721897e73f617c39d32c068a369c26670002a6c4ab95a71ef3a6878ebdd9710e02f410e2f7bcd14
This commit is contained in:
MarcoFalke 2019-09-22 10:14:45 -04:00 committed by Vijay Das Manikpuri
parent a7d94ed55f
commit a03af87cf7
No known key found for this signature in database
GPG Key ID: DB1D81B01DB7C46E
2 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@ task:
MAKEJOBS: "-j9" MAKEJOBS: "-j9"
CONFIGURE_OPTS: "--disable-dependency-tracking" CONFIGURE_OPTS: "--disable-dependency-tracking"
GOAL: "install" GOAL: "install"
TEST_RUNNER_PORT_MIN: "14000" # Must be larger than 12321, which is used for the http cache. See https://cirrus-ci.org/guide/writing-tasks/#http-cache
CCACHE_SIZE: "200M" CCACHE_SIZE: "200M"
CCACHE_COMPRESS: 1 CCACHE_COMPRESS: 1
CCACHE_DIR: "/tmp/ccache_dir" CCACHE_DIR: "/tmp/ccache_dir"

View File

@ -9,6 +9,7 @@ from base64 import b64encode
from binascii import unhexlify from binascii import unhexlify
from decimal import Decimal, ROUND_DOWN from decimal import Decimal, ROUND_DOWN
import hashlib import hashlib
from subprocess import CalledProcessError
import inspect import inspect
import json import json
import logging import logging
@ -16,7 +17,6 @@ import os
import random import random
import shutil import shutil
import re import re
from subprocess import CalledProcessError
import time import time
from . import coverage from . import coverage
@ -261,10 +261,11 @@ def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf'), sleep=
# The maximum number of nodes a single test can spawn # The maximum number of nodes a single test can spawn
MAX_NODES = 15 MAX_NODES = 15
# Don't assign rpc or p2p ports lower than this # Don't assign rpc or p2p ports lower than this
PORT_MIN = 11000 PORT_MIN = int(os.getenv('TEST_RUNNER_PORT_MIN', default=11000))
# The number of ports to "reserve" for p2p and rpc, each # The number of ports to "reserve" for p2p and rpc, each
PORT_RANGE = 5000 PORT_RANGE = 5000
class PortSeed: class PortSeed:
# Must be initialized with a unique integer for each process # Must be initialized with a unique integer for each process
n = None n = None