MCPcopy Create free account
hub / github.com/erpc/erpc / newTestStrategyWith

Function newTestStrategyWith

auth/strategy_database_test.go:76–92  ·  view source on GitHub ↗

newTestStrategyWith builds a DatabaseStrategy wired to a fakeConnector and the provided fail-open + retry config. Cache is left nil to keep the tests focused on the connector → fail-open code path.

(t *testing.T, fc *fakeConnector, failOpenEnabled bool)

Source from the content-addressed store, hash-verified

74// and the provided fail-open + retry config. Cache is left nil to keep the
75// tests focused on the connector → fail-open code path.
76func newTestStrategyWith(t *testing.T, fc *fakeConnector, failOpenEnabled bool) *DatabaseStrategy {
77 t.Helper()
78 logger := zerolog.Nop()
79 cfg := &common.DatabaseStrategyConfig{
80 Connector: &common.ConnectorConfig{Id: "test-db", Driver: "postgresql"},
81 FailOpen: &common.DatabaseFailOpenConfig{
82 Enabled: failOpenEnabled,
83 UserId: "emergency-failopen",
84 RateLimitBudget: "emergency",
85 },
86 }
87 return &DatabaseStrategy{
88 logger: &logger,
89 cfg: cfg,
90 connector: fc,
91 }
92}
93
94// TestClassifyDbError pins down the bounded set of telemetry labels.
95//

Calls

no outgoing calls

Tested by

no test coverage detected