mirror of
https://github.com/tale/headplane.git
synced 2026-08-27 15:37:04 +00:00
feat: add e2e integration tests and canonical versioning
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user