diff --git a/README.rst b/README.rst index f78c171..5ae0d09 100644 --- a/README.rst +++ b/README.rst @@ -83,3 +83,14 @@ must *exactly* match the image name used in your testenv's ``docker`` setting. tox-docker will print a message for each container that it is waiting on a health check from, whether via the container's built-in ``HEALTHCHECK`` or a custom health check. + +Port Scanning +------------- + +Since version 1.0, tox-docker has scanned published ports of created containers +to determine when the image is active. However, not all published ports may be +active at a given time which can result in errors. As of version 1.5, tox-docker +allows you to disable this behavior if necessary, in a new section like:: + + [docker:mysql:5.6] + skip_port_validation = True diff --git a/docs/source/conf.py b/docs/source/conf.py index 505216b..da259bb 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,6 +26,7 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ + 'reno.sphinxext', ] # -- Options for HTML output ------------------------------------------------- diff --git a/docs/source/index.rst b/docs/source/index.rst index a6210d3..25afb15 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1 +1,6 @@ .. include:: ../../README.rst + +Release notes +------------- + +.. release-notes:: diff --git a/releasenotes/config.yaml b/releasenotes/config.yaml new file mode 100644 index 0000000..a79ee85 --- /dev/null +++ b/releasenotes/config.yaml @@ -0,0 +1,11 @@ +--- +earliest_version: v1.4.0 +release_tag_re: 'v\d\.\d\.\d(rc\d+)?' +sections: + # The prelude section is implicitly included. + - [features, New Features] + - [issues, Known Issues] + - [upgrade, Upgrade Notes] + - [deprecations, Deprecation Notes] + - [fixes, Bug Fixes] + - [other, Other Notes] diff --git a/releasenotes/notes/add-skip_port_validation-flag-40921e653b8feb05.yaml b/releasenotes/notes/add-skip_port_validation-flag-40921e653b8feb05.yaml new file mode 100644 index 0000000..76a5fc1 --- /dev/null +++ b/releasenotes/notes/add-skip_port_validation-flag-40921e653b8feb05.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + A new ``skip_port_validation`` flag is added. This can be used to disable + port scanning for created instances and is useful for images that provide + optional port. It can be configured for each image in a ``[docker:IMAGE]`` + section. For example:: + + [docker:mysql:8.0] + skip_port_validation = True diff --git a/tox.ini b/tox.ini index da12773..7a17c40 100644 --- a/tox.ini +++ b/tox.ini @@ -12,6 +12,7 @@ deps = sphinx sphinx_rtd_theme vcversioner + reno commands = sphinx-build -W -b html docs/source docs/build/html commands_pre = commands_post = diff --git a/tox_docker.py b/tox_docker.py index 09e6c93..f480110 100644 --- a/tox_docker.py +++ b/tox_docker.py @@ -100,6 +100,7 @@ def getint(reader, key): "healthcheck_timeout": gettime(reader, "healthcheck_timeout"), "healthcheck_retries": getint(reader, "healthcheck_retries"), "healthcheck_start_period": gettime(reader, "healthcheck_start_period"), + "skip_port_validation": reader.getbool("skip_port_validation", default=False), } config._docker_image_configs = image_configs @@ -225,6 +226,10 @@ def tox_runtest_pre(venv): if proto == "udp": continue + # skip port validation if user requests it + if image_configs[image]["skip_port_validation"]: + continue + # mostly-busy-loop until we can connect to that port; that # will be our signal that the container is ready (meh) start = time.time()