From c04e8277572a66b12574d8ec25ab1ee495ac261c Mon Sep 17 00:00:00 2001 From: "Chris. Webster" Date: Fri, 3 Mar 2023 15:09:19 -0800 Subject: [PATCH] test: update docker config for windows support (#2721 There is legacy support for PortBindings and Binds at the root level of the config. Currently (including Windows) these reside under the HostConfig. ExposedPorts is now used to identify the externally available ports. Signed-off-by: Chris. Webster --- test/helpers/gitbox.js | 5 ++++- test/helpers/mockserver.js | 5 ++++- test/helpers/npm-registry.js | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/helpers/gitbox.js b/test/helpers/gitbox.js index 3fa310a9..0e9b04a6 100644 --- a/test/helpers/gitbox.js +++ b/test/helpers/gitbox.js @@ -23,7 +23,10 @@ export async function start() { container = await docker.createContainer({ Tty: true, Image: IMAGE, - PortBindings: {[`${SERVER_PORT}/tcp`]: [{HostPort: `${HOST_PORT}`}]}, + HostConfig: { + PortBindings: {[`${SERVER_PORT}/tcp`]: [{HostPort: `${HOST_PORT}`}]} + }, + ExposedPorts: {[`${SERVER_PORT}/tcp`]: {}} }); await container.start(); diff --git a/test/helpers/mockserver.js b/test/helpers/mockserver.js index 243fc407..103cee1a 100644 --- a/test/helpers/mockserver.js +++ b/test/helpers/mockserver.js @@ -19,7 +19,10 @@ export async function start() { container = await docker.createContainer({ Tty: true, Image: IMAGE, - PortBindings: {[`${MOCK_SERVER_PORT}/tcp`]: [{HostPort: `${MOCK_SERVER_PORT}`}]}, + HostConfig: { + PortBindings: {[`${MOCK_SERVER_PORT}/tcp`]: [{HostPort: `${MOCK_SERVER_PORT}`}]} + }, + ExposedPorts: {[`${MOCK_SERVER_PORT}/tcp`]: {}} }); await container.start(); diff --git a/test/helpers/npm-registry.js b/test/helpers/npm-registry.js index 9714a9d3..a71cedf4 100644 --- a/test/helpers/npm-registry.js +++ b/test/helpers/npm-registry.js @@ -25,8 +25,11 @@ export async function start() { container = await docker.createContainer({ Tty: true, Image: IMAGE, - PortBindings: {[`${REGISTRY_PORT}/tcp`]: [{HostPort: `${REGISTRY_PORT}`}]}, - Binds: [`${path.join(__dirname, 'config.yaml')}:/verdaccio/conf/config.yaml`], + HostConfig: { + PortBindings: {[`${REGISTRY_PORT}/tcp`]: [{HostPort: `${REGISTRY_PORT}`}]}, + Binds: [`${path.join(__dirname, 'config.yaml')}:/verdaccio/conf/config.yaml`], + }, + ExposedPorts: {[`${REGISTRY_PORT}/tcp`]: {}} }); await container.start();