diff --git a/staging/src/k8s.io/apiserver/pkg/cel/lazy/lazy_test.go b/staging/src/k8s.io/apiserver/pkg/cel/lazy/lazy_test.go index 54f288d8a51..19de8e99144 100644 --- a/staging/src/k8s.io/apiserver/pkg/cel/lazy/lazy_test.go +++ b/staging/src/k8s.io/apiserver/pkg/cel/lazy/lazy_test.go @@ -93,6 +93,17 @@ func TestLazyMapType(t *testing.T) { if evalCounter != 1 { t.Errorf("expected eval %d times but got %d", 1, evalCounter) } + + // unused due to boolean short-circuiting + // if `variables.unused` is evaluated, the whole test will have a fatal error and exit. + exp = "variables.dict.a == 'wrong' && variables.unused == 'unused'" + v, err = compileAndRun(env, activation, exp) + if err != nil { + t.Fatalf("%q: %v", exp, err) + } + if v.Value().(bool) != false { + t.Errorf("%q: wrong result: %v", exp, v.Value()) + } } type testActivation struct {