From 5e514f5fcb844538b81278660994fe013e4f60da Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 17 Oct 2024 17:47:42 +0200 Subject: [PATCH] DRA CEL: fix error checking in unit test Not getting an expected error wasn't checked. --- .../k8s.io/dynamic-resource-allocation/cel/compile_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/staging/src/k8s.io/dynamic-resource-allocation/cel/compile_test.go b/staging/src/k8s.io/dynamic-resource-allocation/cel/compile_test.go index 33ed7724e98..ee697a0495b 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/cel/compile_test.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/cel/compile_test.go @@ -248,6 +248,9 @@ device.attributes["dra.example.com"]["version"].isGreaterThan(semver("0.0.1")) } return } + if scenario.expectCompileError != "" { + t.Fatalf("expected compile error %q, got none", scenario.expectCompileError) + } if expect, actual := scenario.expectCost, result.MaxCost; expect != actual { t.Errorf("expected CEL cost %d, got %d instead", expect, actual) } @@ -262,6 +265,9 @@ device.attributes["dra.example.com"]["version"].isGreaterThan(semver("0.0.1")) } return } + if scenario.expectMatchError != "" { + t.Fatalf("expected match error %q, got none", scenario.expectMatchError) + } if match != scenario.expectMatch { t.Fatalf("expected result %v, got %v", scenario.expectMatch, match) }