feat: clamp docker daemon version and support v1.24

Fixes HP-563.
This commit is contained in:
Aarnav Tale
2026-08-25 14:13:51 -07:00
parent cbc81bb5cd
commit 5515b4bc02
3 changed files with 52 additions and 37 deletions
+17 -3
View File
@@ -8,6 +8,15 @@ import { type HeadscaleEnv, startHeadscale } from "../setup/start-headscale";
const TEST_LABEL_KEY = "me.tale.headplane.integration-test";
const TEST_LABEL_VALUE = `docker-${Date.now()}`;
function connect(socket: string) {
const url = new URL(socket);
if (url.protocol === "unix:") {
return new Client("http://localhost", { socketPath: url.pathname });
}
return new Client(url.href.replace(url.protocol, "http:"));
}
describe("DockerIntegration", () => {
let env: HeadscaleEnv;
let dockerSocket: string;
@@ -77,16 +86,21 @@ describe("DockerIntegration", () => {
// Health check goes through the Docker socket to avoid stale port
// mappings after container restart.
const containerId = env.container.getId();
const dockerClient = new Client("http://localhost", {
socketPath: "/var/run/docker.sock",
const dockerClient = connect(dockerSocket);
const versionRes = await dockerClient.request({
method: "GET",
path: "/version",
});
const versionInfo = (await versionRes.body.json()) as { ApiVersion?: string };
const apiVersion = versionInfo.ApiVersion ?? "1.24";
const mockHeadscale = {
health: async () => {
try {
const res = await dockerClient.request({
method: "GET",
path: `/v1.44/containers/${containerId}/json`,
path: `/v${apiVersion}/containers/${containerId}/json`,
});
const info = (await res.body.json()) as any;
return info.State?.Running === true;