DRA CEL: fix error checking in unit test

Not getting an expected error wasn't checked.
This commit is contained in:
Patrick Ohly 2024-10-17 17:47:42 +02:00
parent 7995b6f182
commit 5e514f5fcb

View File

@ -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)
}