Skip to content

Commit 5e514f5

Browse files
committed
DRA CEL: fix error checking in unit test
Not getting an expected error wasn't checked.
1 parent 7995b6f commit 5e514f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

staging/src/k8s.io/dynamic-resource-allocation/cel/compile_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ device.attributes["dra.example.com"]["version"].isGreaterThan(semver("0.0.1"))
248248
}
249249
return
250250
}
251+
if scenario.expectCompileError != "" {
252+
t.Fatalf("expected compile error %q, got none", scenario.expectCompileError)
253+
}
251254
if expect, actual := scenario.expectCost, result.MaxCost; expect != actual {
252255
t.Errorf("expected CEL cost %d, got %d instead", expect, actual)
253256
}
@@ -262,6 +265,9 @@ device.attributes["dra.example.com"]["version"].isGreaterThan(semver("0.0.1"))
262265
}
263266
return
264267
}
268+
if scenario.expectMatchError != "" {
269+
t.Fatalf("expected match error %q, got none", scenario.expectMatchError)
270+
}
265271
if match != scenario.expectMatch {
266272
t.Fatalf("expected result %v, got %v", scenario.expectMatch, match)
267273
}

0 commit comments

Comments
 (0)