feat: add e2e integration tests and canonical versioning

This commit is contained in:
Aarnav Tale
2025-11-16 18:31:09 -05:00
parent 63d1e84ebe
commit 08a251cc8c
16 changed files with 536 additions and 17 deletions
+39
View File
@@ -0,0 +1,39 @@
import { describe, expect, test } from 'vitest';
import canonicals from '~/openapi-canonical-families.json';
import {
getBootstrapClient,
getRuntimeClient,
HS_VERSIONS,
Version,
} from './setup/env';
function getCanonicalVersion(version: Version) {
const canonical = Object.entries(canonicals).find(([_, family]) =>
family.includes(version),
)?.[0] as Version | undefined;
if (!canonical) {
return version;
}
return canonical;
}
describe.for(HS_VERSIONS)('Headscale %s: Runtime Client', (version) => {
test('the runtime client is usable', async () => {
const bootstrapper = await getBootstrapClient(version);
const runtimeClient = bootstrapper.getRuntimeClient('test-api-key');
expect(runtimeClient).toBeDefined();
});
test('the runtime client has the correct canonical API version', async () => {
const bootstrapper = await getBootstrapClient(version);
expect(bootstrapper.apiVersion).toBe(getCanonicalVersion(version));
});
test('the health check endpoint works', async () => {
const client = await getRuntimeClient(version);
const health = await client.isHealthy();
expect(health).toBe(true);
});
});