mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 13:21:25 -07:00
Overhaul httptester support in ansible-test. (#39892)
- Works with the --remote option. - Can be disabled with the --disable-httptester option. - Change image with the --httptester option. - Only load and run httptester for targets that require it.
This commit is contained in:
parent
3c32b483bc
commit
c1f9efabf4
10 changed files with 313 additions and 47 deletions
|
@ -3,6 +3,7 @@
|
|||
from __future__ import absolute_import, print_function
|
||||
|
||||
import atexit
|
||||
import contextlib
|
||||
import errno
|
||||
import filecmp
|
||||
import fcntl
|
||||
|
@ -14,6 +15,7 @@ import pkgutil
|
|||
import random
|
||||
import re
|
||||
import shutil
|
||||
import socket
|
||||
import stat
|
||||
import string
|
||||
import subprocess
|
||||
|
@ -720,6 +722,18 @@ def parse_to_dict(pattern, value):
|
|||
return match.groupdict()
|
||||
|
||||
|
||||
def get_available_port():
|
||||
"""
|
||||
:rtype: int
|
||||
"""
|
||||
# this relies on the kernel not reusing previously assigned ports immediately
|
||||
socket_fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
with contextlib.closing(socket_fd):
|
||||
socket_fd.bind(('', 0))
|
||||
return socket_fd.getsockname()[1]
|
||||
|
||||
|
||||
def get_subclasses(class_type):
|
||||
"""
|
||||
:type class_type: type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue