Skip to content

Commit

Permalink
Merge pull request kubewarden#415 from flavio/extend-e2e-tests
Browse files Browse the repository at this point in the history
fix: make e2e tests more scrupulous
  • Loading branch information
flavio authored Feb 10, 2023
2 parents 3e8b5c1 + f342c92 commit 82e1325
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "policy-server"
version = "1.5.2"
version = "1.5.3"
authors = [
"Kubewarden Developers <[email protected]>",
"Flavio Castelli <[email protected]>",
Expand All @@ -20,7 +20,7 @@ lazy_static = "1.4.0"
num_cpus = "1.15.0"
opentelemetry-otlp = { version = "0.10.0", features = ["metrics", "tonic"] }
opentelemetry = { version = "0.17", default-features = false, features = ["metrics", "trace", "rt-tokio", "serialize"] }
policy-evaluator = { git = "https://github.com/kubewarden/policy-evaluator", tag = "v0.6.2" }
policy-evaluator = { git = "https://github.com/kubewarden/policy-evaluator", tag = "v0.6.3" }
rayon = "1.6"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/02-monitor-and-protect-modes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ testcases:
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.response.allowed ShouldEqual false
- result.bodyjson.response.status.code ShouldNotEqual 500

- name: The `/validate` endpoint accepts the request because it's in `monitor` mode
steps:
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/03-audit-endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ testcases:
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.response.allowed ShouldEqual false
- result.bodyjson.response.status.code ShouldNotEqual 500
2 changes: 2 additions & 0 deletions e2e-tests/04-timeout-protection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ testcases:
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.response.allowed ShouldEqual false
- result.bodyjson.response.status.code ShouldEqual 500
- result.bodyjson.response.status.message ShouldContainSubstring "execution deadline exceeded"
- result.timeseconds ShouldBeLessThan 3

- name: Accept AGAIN a request that has a short evaluation time
Expand Down
7 changes: 5 additions & 2 deletions e2e-tests/05-rego-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ testcases:

- name: Rego-based policies work as expected
steps:
- type: http
- name: Send violating request
type: http
method: POST
url: http://localhost:3000/validate/disallow-service-loadbalancer
headers:
Expand All @@ -30,7 +31,9 @@ testcases:
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.response.allowed ShouldEqual false
- type: http
- result.bodyjson.response.status.code ShouldNotEqual 500
- name: Send non violating request
type: http
method: POST
url: http://localhost:3000/validate/disallow-service-loadbalancer
headers:
Expand Down

0 comments on commit 82e1325

Please sign in to comment.