Skip to content

Commit

Permalink
test: add raw validation policy (wasi) e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
  • Loading branch information
fabriziosestito committed Oct 24, 2023
1 parent 2ca58ea commit 0b1397b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions e2e-tests/07-raw-policies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,19 @@ testcases:
- result.bodyjson.response.status.code ShouldNotEqual 500
- result.bodyjson.response ShouldNotContainKey patch
- result.bodyjson.response ShouldNotContainKey patchType

- name: Raw WASI validation policy works as expected
steps:
- name: Accept
type: http
method: POST
url: http://localhost:3000/validate_raw/raw-validation-wasi
headers:
Content-Type: application/json
body: "{{ .fixtures.raw_validation }}"
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.response.allowed ShouldEqual true
- result.bodyjson.response.status.code ShouldNotEqual 500
- result.bodyjson.response ShouldNotContainKey patch
- result.bodyjson.response ShouldNotContainKey patchType
17 changes: 17 additions & 0 deletions e2e-tests/test_data/policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,20 @@ raw-mutation:
raw-validation-opa:
url: ghcr.io/fabriziosestito/tests/raw-validation-opa-policy:latest
settings: {}

raw-validation-wasi:
url: ghcr.io/fabriziosestito/tests/raw-validation-wasi-policy:latest
settings:
validUsers:
- "tonio"
- "wanda"
validActions:
- "eats"
- "likes"
validResources:
- "banana"
- "hay"
# raw-mutation-wasi:
# url: ghcr.io/fabriziosestito/tests/raw-mutation-wasi-policy:latest
# allowedToMutate: true
# settings: {}

0 comments on commit 0b1397b

Please sign in to comment.