mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
portallocator.PortAllocator holds persistent state on port allocations in the network namespace. It normal operation it is used as a singleton, which is a problem in unit tests as every test runs in a clean network namespace. The singleton "default" PortAllocator remembers all the port allocations made in other tests---in other network namespaces---and can result in spurious test failures. Refactor the bridge driver so that tests can construct driver instances with unique PortAllocators. Signed-off-by: Cory Snider <csnider@mirantis.com>