Skip to content

Commit 6117268

Browse files
committed
fix: use existing test policies for v0 and v1 testing
1 parent 6676730 commit 6117268

File tree

8 files changed

+7
-77
lines changed

8 files changed

+7
-77
lines changed

.github/workflows/pull_request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
run: opa check --v0-compatible --strict --ignore "*.yaml" examples
135135

136136
- name: opa check strict (v1)
137-
run: opa check --strict --ignore "*.yaml" test/policies-v1
137+
run: opa check --strict --ignore "*.yaml" examples
138138

139139
- name: setup regal
140140
uses: styrainc/[email protected]

internal/commands/create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func GetViolations() ([]rego.Rego, error) {
137137
}
138138

139139
func GetViolationsV1() ([]rego.Rego, error) {
140-
violations, err := rego.GetViolations("../../test/policies-v1/", rego.V1)
140+
violations, err := rego.GetViolations("../../test/policies/", rego.V1)
141141
if err != nil {
142142
return nil, err
143143
}

internal/rego/rego_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,17 @@ violation if { true }`,
291291
}
292292

293293
func TestGetViolationsV1(t *testing.T) {
294-
violations, err := GetViolations("../../test/policies-v1/full-metadata-v1", V1)
294+
violations, err := GetViolations("../../test/policies", V1)
295295
if err != nil {
296296
t.Fatalf("Error getting v1 violations: %v", err)
297297
}
298298

299-
if len(violations) != 1 {
300-
t.Fatalf("Expected 1 violation, got %d", len(violations))
299+
if len(violations) != 3 {
300+
t.Fatalf("Expected 3 violations, got %d", len(violations))
301301
}
302302

303-
if violations[0].Title() != "The title v1" {
304-
t.Errorf("unexpected Title. expected %q, actual %q", "The title v1", violations[0].Title())
303+
if violations[0].Title() != "The title" {
304+
t.Errorf("unexpected Title. expected %q, actual %q", "The title", violations[0].Title())
305305
}
306306

307307
if violations[0].Version() != V1 {

test/policies-v1/full-metadata-v1/src.rego

Lines changed: 0 additions & 45 deletions
This file was deleted.

test/policies-v1/lib/libraryA.rego

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/policies-v1/lib/libraryB.rego

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/policies-v1/no-metadata-v1/src.rego

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/policies-v1/partial-metadata-v1/src.rego

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)