Backend - Per-VM CPU affinity (vmstart/affinity.go, affinity_flow.go): modes auto / all / P-cores / non-LP-E / custom, saved in the VM folder, applied to the QEMU process on start (GUI and CLI) and live via SetVMAffinity; copied on clone. Start summary logs the resolved mapping. Host report gains CPU topology helpers (mask <-> CPU list). - Offline qcow2 restore points via qemu-img (driver/reims/snapshot.go, snapshot_flow.go): list / create / restore / delete. - SSH helpers (ssh_flow.go): remembered user, open a terminal, write an ~/.ssh/config entry, open VS Code Remote-SSH. - FocusVMWindow brings the QEMU window forward (restoring it if minimized); CopyVMScreenshot copies a full-resolution frame to the clipboard. - DeliverPathsToGuest copies dropped host files into the shared folder; main.go enables Wails file drop on elements marked --wails-drop-target. - VM note (.reims-go-note) and a storage breakdown (extras_flow.go). Frontend - VM page: running state's "Show Window" and the screen preview use FocusVMWindow; camera button and More-menu item copy a screenshot; editable note under the name; SSH row shows the saved user with Terminal / config / VS Code actions; restore-point list; install guide steps can be ticked off; drop files onto the page to send them. - Sidebar right-click menu per VM (start, show window, screenshot, stop, restart, settings, folders, clone, delete); double-click and Ctrl+Enter still run the main action. - AffinityDialog opened from the VM menu and VM settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.5 KiB
Go
51 lines
1.5 KiB
Go
package app
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestSSHHostAlias(t *testing.T) {
|
|
if got := sshHostAlias("macos-tahoe"); got != "reims-macos-tahoe" {
|
|
t.Fatalf("alias = %q", got)
|
|
}
|
|
if got := sshHostAlias("My Mac 26"); got != "reims-my-mac-26" {
|
|
t.Fatalf("alias = %q", got)
|
|
}
|
|
}
|
|
|
|
func TestUpsertSSHConfigBlockIdempotent(t *testing.T) {
|
|
cfg := filepath.Join(t.TempDir(), "config")
|
|
initial := "Host prod\n HostName 10.0.0.5\n"
|
|
if err := os.WriteFile(cfg, []byte(initial), 0o600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if err := upsertSSHConfigBlock(cfg, "macos-tahoe", "reims-macos-tahoe", 2222, "alice"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
b1, _ := os.ReadFile(cfg)
|
|
s1 := string(b1)
|
|
if !strings.Contains(s1, "Host prod") || !strings.Contains(s1, "Host reims-macos-tahoe") || !strings.Contains(s1, "Port 2222") || !strings.Contains(s1, "User alice") {
|
|
t.Fatalf("unexpected first config:\n%s", s1)
|
|
}
|
|
|
|
// Updating port and user must replace the block in place without duplicating it.
|
|
if err := upsertSSHConfigBlock(cfg, "macos-tahoe", "reims-macos-tahoe", 2223, "bob"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
b2, _ := os.ReadFile(cfg)
|
|
s2 := string(b2)
|
|
if strings.Count(s2, "Host reims-macos-tahoe") != 1 {
|
|
t.Fatalf("expected single block, got:\n%s", s2)
|
|
}
|
|
if !strings.Contains(s2, "Port 2223") || !strings.Contains(s2, "User bob") || strings.Contains(s2, "User alice") {
|
|
t.Fatalf("block not updated:\n%s", s2)
|
|
}
|
|
if !strings.Contains(s2, "Host prod") {
|
|
t.Fatalf("existing user config lost:\n%s", s2)
|
|
}
|
|
}
|