Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(e2e): add OPA remote module e2e test #850

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pkg/common/network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestParseUrl(t *testing.T) {
},
{
name: "With Checksum",
input: "file://../../../test/e2e/scenarios/remote-validations/validation.opa.yaml@394f5efa7aa5c3163a631d0f2640efe836af07c77fa7b27749f00819dd869058",
input: "file://../../../test/e2e/scenarios/remote-validations/validation.opa.yaml@e54ef0acc10d2cdf9617ea288eb0ffac45366a8217845026bd03a2768a7deeb1",
wantErr: false,
wantChecksum: true,
},
Expand Down Expand Up @@ -99,7 +99,7 @@ func TestFetch(t *testing.T) {
},
{
name: "File with checksum SHA-256",
url: "file://../../../test/e2e/scenarios/remote-validations/validation.opa.yaml@394f5efa7aa5c3163a631d0f2640efe836af07c77fa7b27749f00819dd869058",
url: "file://../../../test/e2e/scenarios/remote-validations/validation.opa.yaml@e54ef0acc10d2cdf9617ea288eb0ffac45366a8217845026bd03a2768a7deeb1",
wantErr: false,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ component-definition:
- control-id: ID-1
description: This control validates that the demo-pod pod in the validation-test namespace contains the required pod label foo=bar in order to establish compliance.
links:
# # remote opa validation
# - href: https://raw.githubusercontent.com/defenseunicorns/lula/main/src/test/e2e/scenarios/dev-validate/validation.yaml
# rel: lula
# # remote kyverno validation
# - href: https://raw.githubusercontent.com/defenseunicorns/lula/main/src/test/e2e/scenarios/dev-validate/validation.kyverno.yaml
# rel: lula
# remote opa validation
- href: https://raw.githubusercontent.com/defenseunicorns/lula/main/src/test/e2e/scenarios/remote-validations/validation.opa.yaml
rel: lula
# remote kyverno validation
- href: https://raw.githubusercontent.com/defenseunicorns/lula/main/src/test/e2e/scenarios/remote-validations/validation.kyverno.yaml
rel: lula
mildwonkey marked this conversation as resolved.
Show resolved Hide resolved
# single validation w/ checksum
- href: file://./validation.opa.yaml@394f5efa7aa5c3163a631d0f2640efe836af07c77fa7b27749f00819dd869058
- href: file://./validation.opa.yaml@e54ef0acc10d2cdf9617ea288eb0ffac45366a8217845026bd03a2768a7deeb1
rel: lula
# Single validation from multi-validations.yaml
- href: file://./multi-validations.yaml
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/scenarios/remote-validations/pod.pass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
namespace: validation-test
labels:
foo: bar
lula: "true"
spec:
containers:
- image: nginx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ domain:
provider:
type: opa
opa-spec:
modules:
lula.labels: https://raw.githubusercontent.com/defenseunicorns/lula/main/src/test/e2e/scenarios/pod-label/labels.rego
rego: |
package validate

import future.keywords.every
import data.lula.labels as lula_labels

validate {
every pod in input.podsvt {
podLabel := pod.metadata.labels.foo
podLabel == "bar"
lula_labels.has_lula_label(pod)
}
}
Loading