mirror of
https://github.com/tale/headplane.git
synced 2026-07-26 07:48:14 +00:00
feat: make api calls more resilient and stuff
This commit is contained in:
@@ -2,7 +2,7 @@ import { describe, expect, test } from "vitest";
|
||||
|
||||
import { gte } from "~/server/headscale/api/server-version";
|
||||
|
||||
import { getBootstrapClient, getRuntimeClient, HS_VERSIONS, Version } from "../setup/env";
|
||||
import { getBootstrapClient, HS_VERSIONS, Version } from "../setup/env";
|
||||
|
||||
describe.for(HS_VERSIONS)("Headscale %s: Runtime Client", (version) => {
|
||||
test("the runtime client is usable", async () => {
|
||||
@@ -34,8 +34,8 @@ describe.for(HS_VERSIONS)("Headscale %s: Runtime Client", (version) => {
|
||||
});
|
||||
|
||||
test("the health check endpoint works", async () => {
|
||||
const client = await getRuntimeClient(version);
|
||||
const health = await client.isHealthy();
|
||||
const bootstrapper = await getBootstrapClient(version);
|
||||
const health = await bootstrapper.health();
|
||||
expect(health).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,8 +81,8 @@ describe("DockerIntegration", () => {
|
||||
socketPath: "/var/run/docker.sock",
|
||||
});
|
||||
|
||||
const mockClient = {
|
||||
isHealthy: async () => {
|
||||
const mockHeadscale = {
|
||||
health: async () => {
|
||||
try {
|
||||
const res = await dockerClient.request({
|
||||
method: "GET",
|
||||
@@ -96,9 +96,9 @@ describe("DockerIntegration", () => {
|
||||
},
|
||||
} as any;
|
||||
|
||||
await integration.onConfigChange(mockClient);
|
||||
await integration.onConfigChange(mockHeadscale);
|
||||
|
||||
const healthy = await mockClient.isHealthy();
|
||||
const healthy = await mockHeadscale.health();
|
||||
expect(healthy).toBe(true);
|
||||
}, 60_000);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user