newExpressionMatcher provisions a MatchExpression for use in tests
(t *testing.T, expr string)
| 261 | |
| 262 | // newExpressionMatcher provisions a MatchExpression for use in tests |
| 263 | func newExpressionMatcher(t *testing.T, expr string) *caddyhttp.MatchExpression { |
| 264 | t.Helper() |
| 265 | ctx, cancel := caddy.NewContext(caddy.Context{Context: context.Background()}) |
| 266 | t.Cleanup(cancel) |
| 267 | m := &caddyhttp.MatchExpression{Expr: expr} |
| 268 | if err := m.Provision(ctx); err != nil { |
| 269 | t.Fatalf("failed to provision expression %q: %v", expr, err) |
| 270 | } |
| 271 | return m |
| 272 | } |
| 273 | |
| 274 | // minimalHandlerWithRetryMatch is like minimalHandler but also configures |
| 275 | // RetryMatch so that response-based retry can be tested |
no test coverage detected