Add simple Deploy and Mine path for operators without spread complexity.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Skips triple-onion deploy lanes for simple_deploy forges, restarts mining after auth with server policy, and surfaces connected-but-not-hashing fixes on Dashboard and Crucible.
This commit is contained in:
65
server/web/src/help/simpleDeploy.test.ts
Normal file
65
server/web/src/help/simpleDeploy.test.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { Agent } from '../types';
|
||||
import {
|
||||
agentsConnectedNotHashing,
|
||||
simpleDeployStatus,
|
||||
simpleMinePreset,
|
||||
} from './simpleDeploy';
|
||||
|
||||
function agent(partial: Partial<Agent>): Agent {
|
||||
return {
|
||||
id: 'a1',
|
||||
name: 'host-1',
|
||||
status: 'online',
|
||||
hashrate_15s: 0,
|
||||
hashrate_1m: 0,
|
||||
hashrate_15m: 0,
|
||||
...partial,
|
||||
} as Agent;
|
||||
}
|
||||
|
||||
describe('simpleDeployStatus', () => {
|
||||
it('reports mining when hashrate > 0', () => {
|
||||
const s = simpleDeployStatus(agent({ hashrate_15m: 420, lotl_tier: 'cpu_inprocess' }));
|
||||
expect(s.phase).toBe('mining');
|
||||
expect(s.message).toMatch(/420/);
|
||||
expect(s.message).toMatch(/cpu inprocess/i);
|
||||
});
|
||||
|
||||
it('reports testing when online without hashrate', () => {
|
||||
const s = simpleDeployStatus(agent({ lotl_tier: 'container' }));
|
||||
expect(s.phase).toBe('testing');
|
||||
expect(s.message).toMatch(/container/i);
|
||||
});
|
||||
|
||||
it('reports failed when chain exhausted', () => {
|
||||
const s = simpleDeployStatus(agent({ chain_exhausted: true, last_error: 'pool unreachable' }));
|
||||
expect(s.phase).toBe('failed');
|
||||
expect(s.message).toMatch(/pool unreachable/);
|
||||
});
|
||||
|
||||
it('reports offline when not online', () => {
|
||||
expect(simpleDeployStatus(agent({ status: 'offline' })).phase).toBe('offline');
|
||||
});
|
||||
});
|
||||
|
||||
describe('agentsConnectedNotHashing', () => {
|
||||
it('filters online zero-hash agents', () => {
|
||||
const list = agentsConnectedNotHashing([
|
||||
agent({ id: '1', hashrate_15m: 0 }),
|
||||
agent({ id: '2', hashrate_15m: 100 }),
|
||||
agent({ id: '3', status: 'offline', hashrate_15m: 0 }),
|
||||
]);
|
||||
expect(list.map((a) => a.id)).toEqual(['1']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('simpleMinePreset', () => {
|
||||
it('disables spread and enables simple_deploy', () => {
|
||||
const p = simpleMinePreset();
|
||||
expect(p.simple_deploy).toBe(true);
|
||||
expect(p.miner_execution).toBe('inprocess');
|
||||
expect(p.lotl_onion_enabled).toBe(false);
|
||||
expect(p.auto_spread).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user