Split out the passthrough tests into separate suites. The MongoDB deployment is started up by resmoke.py so that we can record the success/failure of each individual test in MCI. Added support for parallel execution of tests by dispatching to multiple MongoDB deployments. Added support for grouping different kinds of tests (e.g. C++ unit tests, dbtests, and jstests) so that they can be run together. This allows for customizability in specifying what tests to execute when changes are made to a particular part of the code.
30 lines
598 B
Python
30 lines
598 B
Python
"""
|
|
Helper to reserve a network port.
|
|
"""
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import socket
|
|
|
|
|
|
class UnusedPort(object):
|
|
"""
|
|
Acquires a unused port.
|
|
"""
|
|
|
|
def __init__(self):
|
|
self.num = None
|
|
|
|
def __enter__(self):
|
|
self.__socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
self.__socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
self.__socket.bind(("0.0.0.0", 0))
|
|
|
|
addr, port = self.__socket.getsockname()
|
|
self.num = port
|
|
|
|
return self
|
|
|
|
def __exit__(self, *exc_info):
|
|
self.__socket.close()
|