feat(probe): sonde enrichie CPU/RAM/disques + recommandations de profils (tâche 4)
- template machine-probe : lscpu Model name + nproc, MemTotal, lsblk disques - parseProbe étendu (cpuModel/cpuCores/memoryBytes/disks) + buildRecommendations (KVM/QEMU → vm_guest_tools) ; tests TDD - runProbe persiste cpu/mem/disks dans machine_hardware ; /probe renvoie recommendations - popup Sonde affiche cpu/ram/disks + profils conseillés tsc 0 · 110 tests · build OK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { parseProbe, proposeCorrections } from "./machineProbe.js";
|
||||
import { parseProbe, proposeCorrections, buildRecommendations } from "./machineProbe.js";
|
||||
|
||||
const PROXMOX = [
|
||||
"===SU:PROBE_OS===",
|
||||
@@ -101,3 +101,46 @@ describe("proposeCorrections", () => {
|
||||
expect(c.virtualization).toBe("kvm");
|
||||
});
|
||||
});
|
||||
|
||||
describe("sonde enrichie (cpu/mem/disk + recommandations)", () => {
|
||||
const ENRICHED = [
|
||||
"===SU:PROBE_OS===",
|
||||
"ID=debian",
|
||||
"===SU:PROBE_ARCH===",
|
||||
"x86_64",
|
||||
"amd64",
|
||||
"===SU:PROBE_VIRT===",
|
||||
"kvm",
|
||||
"===SU:PROBE_PROXMOX===",
|
||||
"PROXMOX=0",
|
||||
"===SU:PROBE_RPI===",
|
||||
"RPI=0",
|
||||
"===SU:PROBE_GPU===",
|
||||
"no-lspci",
|
||||
"===SU:PROBE_NET===",
|
||||
"ens18 10.0.0.8/22",
|
||||
"===SU:PROBE_CPU===",
|
||||
"MODEL=Intel(R) Xeon(R) CPU E5-2670",
|
||||
"4",
|
||||
"===SU:PROBE_MEM===",
|
||||
"MemTotal: 4194304 kB",
|
||||
"===SU:PROBE_DISK===",
|
||||
"DISK\tsda\t34359738368",
|
||||
"DISK\tsdb\t1073741824000",
|
||||
"===SU:EXIT=0===",
|
||||
].join("\n");
|
||||
|
||||
it("extrait cpuModel/cores, mémoire et disques", () => {
|
||||
const p = parseProbe(ENRICHED);
|
||||
expect(p.cpuModel).toBe("Intel(R) Xeon(R) CPU E5-2670");
|
||||
expect(p.cpuCores).toBe(4);
|
||||
expect(p.memoryBytes).toBe(4194304 * 1024);
|
||||
expect(p.disks).toHaveLength(2);
|
||||
expect(p.disks[0]).toEqual({ name: "sda", sizeBytes: 34359738368 });
|
||||
});
|
||||
|
||||
it("recommande vm_guest_tools sur KVM", () => {
|
||||
const recs = buildRecommendations(parseProbe(ENRICHED));
|
||||
expect(recs.some((r) => r.profileId === "vm_guest_tools")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user