MCPcopy Create free account
hub / github.com/cel-expr/cel-go / awaitEval

Function awaitEval

cel/program_async_test.go:1076–1085  ·  view source on GitHub ↗

awaitEval runs ConcurrentEval and returns the result or fails on timeout.

(ctx context.Context, t *testing.T, prg cel.Program, in any)

Source from the content-addressed store, hash-verified

1074
1075// awaitEval runs ConcurrentEval and returns the result or fails on timeout.
1076func 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.
1088func mustProgram(t *testing.T, expr string, opts ...any) cel.Program {

Calls 1

ConcurrentEvalMethod · 0.65

Tested by

no test coverage detected