(t testing.TB)
| 311 | } |
| 312 | |
| 313 | func (r *runner) compileRule(t testing.TB) (*cel.Env, *CompiledRule, *cel.Issues) { |
| 314 | t.Helper() |
| 315 | config := readPolicyConfig(t, fmt.Sprintf("testdata/%s/config.yaml", r.name)) |
| 316 | policy := parsePolicy(t, r.name, r.parseOpts) |
| 317 | env, err := cel.NewCustomEnv( |
| 318 | cel.OptionalTypes(), |
| 319 | cel.EnableMacroCallTracking(), |
| 320 | cel.ExtendedValidations(), |
| 321 | ext.Bindings()) |
| 322 | if err != nil { |
| 323 | t.Fatalf("cel.NewEnv() failed: %v", err) |
| 324 | } |
| 325 | // Configure declarations |
| 326 | env, err = env.Extend(FromConfig(config)) |
| 327 | if err != nil { |
| 328 | t.Fatalf("env.Extend() with config options %v, failed: %v", config, err) |
| 329 | } |
| 330 | rule, iss := CompileRule(env, policy) |
| 331 | return env, rule, iss |
| 332 | } |
| 333 | |
| 334 | func (r *runner) setup(t testing.TB, env *cel.Env, ast *cel.Ast) { |
| 335 | t.Helper() |
no test coverage detected