docker(install): opt to expose local tcp address

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-12-11 18:49:32 +01:00
parent e908dafd1d
commit cd8a555683
3 changed files with 83 additions and 24 deletions

View File

@@ -69,6 +69,36 @@ describe('rootless', () => {
);
});
describe('tcp', () => {
// prettier-ignore
test.each(getSources(false))(
'install %s', async (source) => {
await ensureNoSystemContainerd();
const install = new Install({
source: source,
runDir: tmpDir(),
contextName: 'foo',
daemonConfig: `{"debug":true}`,
localTCPPort: 2378
});
await expect(
tryInstall(install, async () => {
const out = await Docker.getExecOutput(['info'], {
env: Object.assign({}, process.env, {
DOCKER_HOST: 'tcp://localhost:2378',
DOCKER_CONTENT_TRUST: 'false'
}) as {
[key: string]: string;
}
});
expect(out.exitCode).toBe(0);
})
).resolves.not.toThrow();
},
30 * 60 * 1000
);
});
async function tryInstall(install: Install, extraCheck?: () => Promise<void>): Promise<void> {
try {
await install.download();