(t *testing.T)
| 548 | } |
| 549 | |
| 550 | func TestConcurrentEvalAllowsPartialUnknown(t *testing.T) { |
| 551 | prg := mustProgram(t, `async_func(42) + x`, |
| 552 | cel.Variable("x", cel.IntType), |
| 553 | cel.Function("async_func", |
| 554 | cel.Overload("async_func_int", []*cel.Type{cel.IntType}, cel.IntType, |
| 555 | cel.AsyncBinding(func(ctx context.Context, args ...ref.Val) ref.Val { |
| 556 | time.Sleep(5 * time.Millisecond) |
| 557 | return args[0] |
| 558 | }), |
| 559 | ), |
| 560 | ), |
| 561 | cel.EvalOptions(cel.OptPartialEval), |
| 562 | ) |
| 563 | pvars, err := cel.PartialVars(map[string]any{}, cel.AttributePattern("x")) |
| 564 | if err != nil { |
| 565 | t.Fatalf("PartialVars() failed: %v", err) |
| 566 | } |
| 567 | res := awaitEval(context.Background(), t, prg, pvars) |
| 568 | if res.Err != nil { |
| 569 | t.Fatalf("ConcurrentEval() with partial unknown returned error: %v", res.Err) |
| 570 | } |
| 571 | if !types.IsUnknown(res.Val) { |
| 572 | t.Errorf("ConcurrentEval() = %v, want Unknown", res.Val) |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | func TestConcurrentEvalAsyncObserver(t *testing.T) { |
| 577 | obs := &countingObserver{} |
nothing calls this directly
no test coverage detected