From 5f17f972299ef390b85d3e6c1cc066643dad0bf9 Mon Sep 17 00:00:00 2001 From: mrjoelkamp Date: Wed, 14 Aug 2024 16:13:36 -0500 Subject: [PATCH] test: change test to use yaml file instead --- pkg/policy/policy_test.go | 2 +- pkg/policy/testdata/mock-tuf-no-rego/doi/policy.not-rego | 1 - pkg/policy/testdata/mock-tuf-no-rego/doi/policy.yaml | 1 + pkg/policy/testdata/mock-tuf-no-rego/mapping.yaml | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 pkg/policy/testdata/mock-tuf-no-rego/doi/policy.not-rego create mode 100644 pkg/policy/testdata/mock-tuf-no-rego/doi/policy.yaml diff --git a/pkg/policy/policy_test.go b/pkg/policy/policy_test.go index d5d4b09..55d0d11 100644 --- a/pkg/policy/policy_test.go +++ b/pkg/policy/policy_test.go @@ -33,7 +33,7 @@ func loadAttestation(t *testing.T, path string) *attestation.Envelope { func TestRegoEvaluator_Evaluate(t *testing.T) { ctx, _ := test.Setup(t) resolveErrorStr := "failed to resolve policy by id: policy with id non-existent-policy-id not found" - evalErrorStr := "rego_parse_error:" + evalErrorStr := "no policy evaluation result" TestDataPath := filepath.Join("..", "..", "test", "testdata") ExampleAttestation := filepath.Join(TestDataPath, "example_attestation.json") diff --git a/pkg/policy/testdata/mock-tuf-no-rego/doi/policy.not-rego b/pkg/policy/testdata/mock-tuf-no-rego/doi/policy.not-rego deleted file mode 100644 index aa3513e..0000000 --- a/pkg/policy/testdata/mock-tuf-no-rego/doi/policy.not-rego +++ /dev/null @@ -1 +0,0 @@ -this isn't a rego policy \ No newline at end of file diff --git a/pkg/policy/testdata/mock-tuf-no-rego/doi/policy.yaml b/pkg/policy/testdata/mock-tuf-no-rego/doi/policy.yaml new file mode 100644 index 0000000..148070a --- /dev/null +++ b/pkg/policy/testdata/mock-tuf-no-rego/doi/policy.yaml @@ -0,0 +1 @@ +policy: "this is not rego" diff --git a/pkg/policy/testdata/mock-tuf-no-rego/mapping.yaml b/pkg/policy/testdata/mock-tuf-no-rego/mapping.yaml index 2f0c252..e71ba54 100644 --- a/pkg/policy/testdata/mock-tuf-no-rego/mapping.yaml +++ b/pkg/policy/testdata/mock-tuf-no-rego/mapping.yaml @@ -5,7 +5,7 @@ policies: - id: docker-official-images description: Docker Official Images files: - - path: doi/policy.not-rego + - path: doi/policy.yaml rules: - pattern: "^docker[.]io/library/(.*)$" policy-id: docker-official-images