Skip to content

Commit

Permalink
test: add raw mutation 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 0b1397b commit 13b4d17
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 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 @@ -97,3 +97,19 @@ testcases:
- result.bodyjson.response.status.code ShouldNotEqual 500
- result.bodyjson.response ShouldNotContainKey patch
- result.bodyjson.response ShouldNotContainKey patchType

- name: Raw WASI mutation policy mutates the request
steps:
- name: Accept
type: http
method: POST
url: http://localhost:3000/validate_raw/raw-mutation-wasi
headers:
Content-Type: application/json
body: "{{ .fixtures.raw_mutation }}"
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.response.allowed ShouldEqual true
- result.bodyjson.response.status.code ShouldNotEqual 500
- result.bodyjson.response ShouldContainKey patch
- result.bodyjson.response ShouldContainKey patchType
12 changes: 8 additions & 4 deletions e2e-tests/test_data/policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ raw-validation-wasi:
validResources:
- "banana"
- "hay"
# raw-mutation-wasi:
# url: ghcr.io/fabriziosestito/tests/raw-mutation-wasi-policy:latest
# allowedToMutate: true
# settings: {}

raw-mutation-wasi:
url: ghcr.io/fabriziosestito/tests/raw-mutation-wasi-policy:latest
allowedToMutate: true
settings:
forbiddenResources:
- "banana"
- "carrot"

0 comments on commit 13b4d17

Please sign in to comment.