Add fleet ops dashboard, Calibrate enforcement, and dead-code cleanup.
Ship live alerts, pool status, AI monitor, remote agent commands, build manager, and uninstall flow; wire Calibrate settings (WS ping, pool traffic log, retention limits) at runtime and exclude server/data from git.
This commit is contained in:
33
server/internal/db/retention_test.go
Normal file
33
server/internal/db/retention_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestPurgeHashrateSamplesBefore(t *testing.T) {
|
||||
d, err := New(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer d.Close()
|
||||
|
||||
_, err = d.Exec("INSERT INTO hashrate_samples (agent_id, hashrate, timestamp) VALUES ('a1', 100, ?)",
|
||||
time.Now().Add(-48*time.Hour))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = d.Exec("INSERT INTO hashrate_samples (agent_id, hashrate, timestamp) VALUES ('a1', 200, ?)",
|
||||
time.Now())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
n, err := d.PurgeHashrateSamplesBefore(time.Now().Add(-24 * time.Hour))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if n != 1 {
|
||||
t.Fatalf("expected 1 purged, got %d", n)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user