feat: publish durable queue and spool gauges

This commit is contained in:
2026-09-11 09:28:54 +00:00
parent ea8a4d8846
commit 0e18af02bb
7 changed files with 178 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
package store
import (
"context"
"crypto/sha256"
"path/filepath"
"testing"
"time"
"github.com/rvbox/rvbox/internal/domain"
)
func TestTelemetryReportsQueuedDurableState_HP_OPS_06(t *testing.T) {
t.Parallel()
ctx := context.Background()
persistence, err := Open(ctx, Options{DataDir: filepath.Join(t.TempDir(), "state"), BusyTimeout: time.Second})
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = persistence.Close() })
if _, err := persistence.RegisterClientSession(ctx, ClientRegistration{ClientID: "telemetry-client", Platform: 2, Architecture: "amd64", DaemonVersion: "test", DaemonCWD: `C:\`, SupportedShells: []byte{1}, ClientInstanceID: [16]byte{1}, SessionID: [16]byte{2}, ConnectedAt: time.Now().UTC()}); err != nil {
t.Fatal(err)
}
issue, err := domain.ParseUUIDv7("019c46f1-1d02-7000-8000-0000000000d1")
if err != nil {
t.Fatal(err)
}
if _, err := persistence.QueueCommand(ctx, QueueCommandInput{IssueUUID: issue, ClientID: "telemetry-client", IssueTime: time.Now().UTC(), ReceiptTime: time.Now().UTC(), ImmutableSHA256: sha256.Sum256([]byte("telemetry")), ExecutionSpec: []byte("spec")}); err != nil {
t.Fatal(err)
}
telemetry, err := persistence.Telemetry(ctx)
if err != nil || telemetry.QueuedCommands != 1 || telemetry.ChargedBytes == 0 {
t.Fatalf("telemetry = %#v, %v", telemetry, err)
}
}