portlock

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

portlock provides a mechanism for containers to acquire and release ports they plan to expose, and a wait mechanism This allows tests dependent on running containers to always parallelize without having to worry about port collision with any other test Note that this does NOT protect against trying to use a port that is already used by an unrelated third-party service or container Also note that *generally* finding a free port is not easy: - to just "listen" and see if it works won't work for containerized services that are DNAT-ed (plus, that would be racy) - inspecting iptables instead (or in addition to) may work for containers, but this depends on how networking has been set (and yes, it is also racy) Our approach here is optimistic: tests are responsible for calling Acquire and Release

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Acquire

func Acquire(port int) (int, error)

func Release

func Release(port int) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL