awaitEval runs ConcurrentEval and returns the result or fails on timeout.
(ctx context.Context, t *testing.T, prg cel.Program, in any)
| 1074 | |
| 1075 | // awaitEval runs ConcurrentEval and returns the result or fails on timeout. |
| 1076 | func awaitEval(ctx context.Context, t *testing.T, prg cel.Program, in any) cel.EvalResult { |
| 1077 | t.Helper() |
| 1078 | select { |
| 1079 | case res := <-prg.ConcurrentEval(ctx, in): |
| 1080 | return res |
| 1081 | case <-time.After(5 * time.Second): |
| 1082 | t.Fatal("ConcurrentEval() timed out") |
| 1083 | return cel.EvalResult{} |
| 1084 | } |
| 1085 | } |
| 1086 | |
| 1087 | // mustProgram compiles an expression and constructs a Program, separating EnvOptions and ProgramOptions. |
| 1088 | func mustProgram(t *testing.T, expr string, opts ...any) cel.Program { |
no test coverage detected