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)
| 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. |
| 76 | func 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 | // |
no outgoing calls
no test coverage detected