Andrea Cosentino created CAMEL-24742:
----------------------------------------

             Summary: camel-opa - compile Rego fixtures to WASM in test-infra 
for the in-process mode
                 Key: CAMEL-24742
                 URL: https://issues.apache.org/jira/browse/CAMEL-24742
             Project: Camel
          Issue Type: Test
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


h2. Problem

The in-process WASM mode (CAMEL-24733's sibling, the {{evaluationMode=wasm}} 
work) needs a compiled {{.wasm}} bundle to evaluate, which changes what 
{{camel-test-infra-opa}} is for.

Today the service runs an OPA server and the ITs talk to it over HTTP. With 
WASM there is nothing to serve - but the Rego still has to be compiled, and 
{{opa build -t wasm -e <entrypoint>}} needs the OPA binary. So the module does 
not disappear; its role inverts from *serving* policies to *producing* a bundle.

h2. Why not just commit a .wasm

Committing a pre-built binary would drift silently against {{authz.rego}} next 
to it: someone edits the Rego, the tests keep passing against a stale bundle, 
and the test proves nothing. A committed binary is also a poor fit for an ASF 
source release.

h2. Proposal

Extend {{camel-test-infra-opa}} so a test can obtain a compiled bundle for a 
given {{.rego}} and entrypoint - a one-shot container run of {{opa build -t 
wasm -e <entrypoint> <policy>}} against the image already configured in 
{{container.properties}}, with the resulting {{policy.wasm}} extracted from the 
bundle tarball for the test to load.

Then add ITs that evaluate the *same* {{authz.rego}} already used by {{OpaIT}} 
through the WASM engine, asserting the decisions match the REST path. Reusing 
one policy across both engines is the point: it is what demonstrates a route 
behaves identically whichever engine evaluated it.

The existing server-based service must keep working unchanged - the REST ITs 
still need it.

h2. Scope

{{main}} only. Test-infra and tests.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to