Some checks failed
CI / test (push) Failing after 13s
- slog.go: SlogLogger adapts *slog.Logger to dbx.Logger interface - scan.go: Collect[T] and CollectOne[T] generic helpers using pgx.RowToStructByName - cluster.go: slow query logging via Config.SlowQueryThreshold (Warn level in queryEnd) - stats.go: PoolStats with Cluster.Stats() aggregating pool stats across all nodes - config.go/node.go: NodeConfig.Tracer passthrough for pgx.QueryTracer (OpenTelemetry) - options.go: WithSlowQueryThreshold and WithTracer functional options - dbxtest/tx.go: RunInTx runs callback in always-rolled-back transaction for test isolation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
23 lines
387 B
Go
23 lines
387 B
Go
package dbx_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.codelab.vc/pkg/dbx/dbxtest"
|
|
)
|
|
|
|
func TestStats(t *testing.T) {
|
|
c := dbxtest.NewTestCluster(t)
|
|
|
|
ps := c.Stats()
|
|
if ps.Nodes == nil {
|
|
t.Fatal("Nodes map is nil")
|
|
}
|
|
if _, ok := ps.Nodes["test-master"]; !ok {
|
|
t.Error("expected test-master in Nodes")
|
|
}
|
|
if ps.MaxConns <= 0 {
|
|
t.Errorf("expected MaxConns > 0, got %d", ps.MaxConns)
|
|
}
|
|
}
|