Close DV-01–04,07,09,13,14: unify operator-deck UX in server/web.
Standardize neon cyan on #00e8f5, wire SacredPageHeader across Builds/Path Tracer/LOTL, dedupe Pages.css, align Path Tracer chrome, drop dead wealth-deck CSS, add prefers-color-scheme shell + HelpTip, sidebar version from package.json build inject, and Vitest CSS regression guards.
This commit is contained in:
48
server/internal/api/pathtracer_persist_test.go
Normal file
48
server/internal/api/pathtracer_persist_test.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"crypto-miner-server/internal/db"
|
||||
)
|
||||
|
||||
func TestPathTracerSessionSurvivesHandlerRestart(t *testing.T) {
|
||||
database, err := db.New(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = database.Close() })
|
||||
hub := NewWSHub(database)
|
||||
|
||||
sess := &TraceSession{
|
||||
ID: "sess-restart-abcdef12",
|
||||
AgentIDs: []string{"agent-1"},
|
||||
CreatedAt: time.Now().Add(-10 * time.Minute),
|
||||
Ready: true,
|
||||
clientPrivKey: "PRIV",
|
||||
clientPubKey: "PUB",
|
||||
Hops: []*HopInfo{{
|
||||
AgentID: "agent-1",
|
||||
AgentName: "Hop One",
|
||||
ExternalIP: "203.0.113.10",
|
||||
Port: 51820,
|
||||
Status: HopReady,
|
||||
}},
|
||||
}
|
||||
|
||||
h1 := NewPathTracerHandler(hub)
|
||||
h1.mu.Lock()
|
||||
h1.sessions[sess.ID] = sess
|
||||
h1.mu.Unlock()
|
||||
h1.persistSession(sess)
|
||||
|
||||
h2 := NewPathTracerHandler(hub)
|
||||
restored := h2.getSession(sess.ID)
|
||||
if restored == nil {
|
||||
t.Fatal("session missing after handler restart")
|
||||
}
|
||||
if !restored.Ready || restored.clientPubKey != "PUB" {
|
||||
t.Fatalf("restored session incomplete: ready=%v pub=%q", restored.Ready, restored.clientPubKey)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user