Every VM action had two bindings: one by name and one by driver and name. The window used only the second, so the first is gone and the WithDriver suffix with it. Unused bindings and frontend exports are removed too. Tests now reject bindings the window never calls, stale generated bindings and unused frontend exports. TypeScript rejects unused locals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package app
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/Nwflower/reims-go/internal/config"
|
|
"github.com/Nwflower/reims-go/internal/host"
|
|
)
|
|
|
|
func TestSameNamedVMMemoryStatesUseDriverQualifiedKeys(t *testing.T) {
|
|
a := &App{
|
|
transitions: map[string]string{}, pendingChanges: map[string][]PendingChange{},
|
|
diskPaths: map[string]cachedDiskPath{}, procSamples: map[string]host.ProcessSample{},
|
|
}
|
|
aKey := vmKeyForDriver("test.driver.a", "shared")
|
|
bKey := vmKeyForDriver("test.driver.b", "shared")
|
|
if aKey == bKey {
|
|
t.Fatal("same-named VMs share a key")
|
|
}
|
|
a.transitions[aKey] = "starting"
|
|
a.pendingChanges[bKey] = []PendingChange{{Field: "memory"}}
|
|
a.diskPaths[aKey] = cachedDiskPath{path: "a", at: time.Now()}
|
|
a.procSamples[bKey] = host.ProcessSample{}
|
|
if len(a.transitions) != 1 || a.transitions[bKey] != "" {
|
|
t.Fatalf("transitions = %+v", a.transitions)
|
|
}
|
|
if len(a.pendingChanges[aKey]) != 0 || len(a.pendingChanges[bKey]) != 1 {
|
|
t.Fatalf("pending = %+v", a.pendingChanges)
|
|
}
|
|
if len(a.diskPaths) != 1 || len(a.procSamples) != 1 {
|
|
t.Fatal("driver-qualified cache keys collided")
|
|
}
|
|
a.cfg = &config.Config{DataRoot: t.TempDir()}
|
|
if a.thumbPath("test.driver.a", "shared") == a.thumbPath("test.driver.b", "shared") {
|
|
t.Fatal("same-named VMs share a thumbnail path")
|
|
}
|
|
}
|