Remove Komodo backend in favor of native hosts
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { newFixture, type Fixture } from '../helpers/fixture.js';
|
||||
|
||||
vi.mock('../../src/lib/server/integrations/komodo.js', () => ({ komodoInspectHealthy: vi.fn() }));
|
||||
let fixture: Fixture;
|
||||
let at: number;
|
||||
beforeEach(async () => {
|
||||
@@ -15,8 +14,9 @@ afterEach(async () => { vi.useRealTimers(); await fixture.cleanup(); });
|
||||
async function setup(count = 5, hostCount = 1) {
|
||||
const hosts = await import('../../src/lib/server/hosts/index.js');
|
||||
const { db } = await import('../../src/lib/server/db/index.js');
|
||||
const { komodoInspectHealthy } = await import('../../src/lib/server/integrations/komodo.js');
|
||||
vi.mocked(komodoInspectHealthy).mockResolvedValue({ ok: true, state: 'running' });
|
||||
vi.spyOn(await import('../../src/lib/server/backends/native.js'), 'nativeHealth');
|
||||
const { nativeHealth } = await import('../../src/lib/server/backends/native.js');
|
||||
vi.mocked(nativeHealth).mockResolvedValue({ ok: true, state: 'running' });
|
||||
const hostIds: string[] = [];
|
||||
for (let h = 0; h < hostCount; h++) {
|
||||
const host = hosts.createHost({ name: `Host ${h}` }); hostIds.push(host.id);
|
||||
@@ -26,7 +26,7 @@ async function setup(count = 5, hostCount = 1) {
|
||||
hosts.enrollHost(hosts.createEnrollment(host.id).token, inventory);
|
||||
for (let i = 0; i < count; i++) {
|
||||
const name = `server-${h}-${i}`;
|
||||
db().prepare('INSERT INTO servers(name,komodo_name,created_at) VALUES(?,?,?)').run(name, '', new Date(at - 1000).toISOString());
|
||||
db().prepare('INSERT INTO servers(name,created_at) VALUES(?,?)').run(name, new Date(at - 1000).toISOString());
|
||||
db().prepare(`INSERT INTO native_instances(id,server,host_id,library_id,image,port,created_at)
|
||||
VALUES(?,?,?,'library','image',?,?)`).run(`instance-${h}-${i}`, name, host.id, 28960 + i, new Date(at - 1000).toISOString());
|
||||
}
|
||||
@@ -41,7 +41,7 @@ async function setup(count = 5, hostCount = 1) {
|
||||
? { ok: true, results: targets.map(target => ({ ...target, reply: { ok: true, text: 'map: mp_kino\nnum score ping guid name\n--- ----- ---- ---- ----\n' } })) }
|
||||
: { ok: true, text: 'map: mp_kino\nnum score ping guid name\n--- ----- ---- ---- ----\n' } });
|
||||
});
|
||||
return { ...hosts, ...health, ...worker, getServer, db: db(), inspect: vi.mocked(komodoInspectHealthy), hostIds, operations, complete };
|
||||
return { ...hosts, ...health, ...worker, getServer, db: db(), inspect: vi.mocked(nativeHealth), hostIds, operations, complete };
|
||||
}
|
||||
|
||||
describe('host status observations', () => {
|
||||
|
||||
Reference in New Issue
Block a user