diff --git a/testing/src/test/resources/policy/custom_variable_bindings/config.yaml b/testing/src/test/resources/policy/custom_variable_bindings/config.yaml new file mode 100644 index 000000000..83b3685c3 --- /dev/null +++ b/testing/src/test/resources/policy/custom_variable_bindings/config.yaml @@ -0,0 +1,22 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "custom_variable_bindings" +container: "cel.expr.conformance.proto2" +variables: + - name: "spec" + type: + type_name: "cel.expr.conformance.proto2.TestAllTypes" +extensions: +- name: "protos" \ No newline at end of file diff --git a/testing/src/test/resources/policy/custom_variable_bindings/policy.yaml b/testing/src/test/resources/policy/custom_variable_bindings/policy.yaml new file mode 100644 index 000000000..7a94eebd2 --- /dev/null +++ b/testing/src/test/resources/policy/custom_variable_bindings/policy.yaml @@ -0,0 +1,20 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "custom_variable_bindings" +rule: + match: + - condition: proto.getExt(spec, cel.expr.conformance.proto2.int32_ext) > 0 + output: "true" + - output: "false" \ No newline at end of file diff --git a/testing/src/test/resources/policy/custom_variable_bindings/tests.yaml b/testing/src/test/resources/policy/custom_variable_bindings/tests.yaml new file mode 100644 index 000000000..dac470503 --- /dev/null +++ b/testing/src/test/resources/policy/custom_variable_bindings/tests.yaml @@ -0,0 +1,22 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +description: "Tests for custom variable bindings." +section: + - name: "custom_variable_bindings" + tests: + - name: "true_by_default" + # The input for this test is configured programmatically in the test + # class with a value of 1 (see CustomVariableBindingsUserTest.java). + output: "true" \ No newline at end of file