Skip to content

Commit 9d29b7f

Browse files
authored
Refactoring changes to create a test runner option from passed flags, correct indentation and add package level comment for test (#1165)
* corrected indentation and added package comment for /test * fix indentation for required_labels test file * added test runner options from flags as a public method
1 parent 5f44021 commit 9d29b7f

File tree

10 files changed

+256
-233
lines changed

10 files changed

+256
-233
lines changed

‎policy/testdata/context_pb/tests.yaml‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ description: "Protobuf input tests"
1616
section:
1717
- name: "valid"
1818
tests:
19-
- name: "good spec"
20-
context_expr: "test.TestAllTypes{single_int32: 10}"
21-
output:
22-
expr: "optional.none()"
19+
- name: "good spec"
20+
context_expr: "test.TestAllTypes{single_int32: 10}"
21+
output:
22+
expr: "optional.none()"
2323
- name: "invalid"
2424
tests:
25-
- name: "bad spec"
26-
context_expr: "test.TestAllTypes{single_int32: 11}"
27-
output:
28-
value: "invalid spec, got single_int32=11, wanted <= 10"
25+
- name: "bad spec"
26+
context_expr: "test.TestAllTypes{single_int32: 11}"
27+
output:
28+
value: "invalid spec, got single_int32=11, wanted <= 10"

‎policy/testdata/nested_rule7/tests.yaml‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ description: "Nested rule tests which explore optional vs non-optional returns"
1616
section:
1717
- name: "valid"
1818
tests:
19-
- name: "x=1"
20-
input:
19+
- name: "x=1"
20+
input:
2121
x:
2222
value: 1
23-
output:
24-
expr: "optional.none()"
25-
- name: "x=2"
26-
input:
23+
output:
24+
expr: "optional.none()"
25+
- name: "x=2"
26+
input:
2727
x:
2828
value: 2
29-
output:
30-
value: false
31-
- name: "x=3"
32-
input:
29+
output:
30+
value: false
31+
- name: "x=3"
32+
input:
3333
x:
3434
value: 3
35-
output:
36-
value: true
37-
- name: "x=4"
38-
input:
35+
output:
36+
value: true
37+
- name: "x=4"
38+
input:
3939
x:
4040
value: 4
41-
output:
42-
value: true
41+
output:
42+
value: true

‎policy/testdata/pb/tests.yaml‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ description: "Protobuf input tests"
1616
section:
1717
- name: "valid"
1818
tests:
19-
- name: "good spec"
20-
input:
21-
spec:
22-
expr: >
23-
test.TestAllTypes{single_int32: 10}
24-
output:
25-
expr: "optional.none()"
19+
- name: "good spec"
20+
input:
21+
spec:
22+
expr: >
23+
test.TestAllTypes{single_int32: 10}
24+
output:
25+
expr: "optional.none()"
2626
- name: "invalid"
2727
tests:
28-
- name: "bad spec"
29-
input:
30-
spec:
31-
expr: >
32-
test.TestAllTypes{single_int32: 11}
33-
output:
34-
value: "invalid spec, got single_int32=11, wanted <= 10"
28+
- name: "bad spec"
29+
input:
30+
spec:
31+
expr: >
32+
test.TestAllTypes{single_int32: 11}
33+
output:
34+
value: "invalid spec, got single_int32=11, wanted <= 10"

‎policy/testdata/required_labels/tests.yaml‎

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,65 +16,65 @@ description: "Required labels conformance tests"
1616
section:
1717
- name: "valid"
1818
tests:
19-
- name: "matching"
20-
input:
21-
spec:
22-
value:
23-
labels:
24-
env: prod
25-
experiment: "group b"
26-
resource:
27-
value:
28-
labels:
29-
env: prod
30-
experiment: "group b"
31-
release: "v0.1.0"
32-
output:
33-
expr: "optional.none()"
19+
- name: "matching"
20+
input:
21+
spec:
22+
value:
23+
labels:
24+
env: prod
25+
experiment: "group b"
26+
resource:
27+
value:
28+
labels:
29+
env: prod
30+
experiment: "group b"
31+
release: "v0.1.0"
32+
output:
33+
expr: "optional.none()"
3434
- name: "missing"
3535
tests:
36-
- name: "env"
37-
input:
38-
spec:
39-
value:
40-
labels:
41-
env: prod
42-
experiment: "group b"
43-
resource:
44-
value:
45-
labels:
46-
experiment: "group b"
47-
release: "v0.1.0"
48-
output:
49-
value: "missing one or more required labels: [\"env\"]"
50-
- name: "experiment"
51-
input:
52-
spec:
53-
value:
54-
labels:
55-
env: prod
56-
experiment: "group b"
57-
resource:
58-
value:
59-
labels:
60-
env: staging
61-
release: "v0.1.0"
62-
output:
63-
value: "missing one or more required labels: [\"experiment\"]"
36+
- name: "env"
37+
input:
38+
spec:
39+
value:
40+
labels:
41+
env: prod
42+
experiment: "group b"
43+
resource:
44+
value:
45+
labels:
46+
experiment: "group b"
47+
release: "v0.1.0"
48+
output:
49+
value: "missing one or more required labels: [\"env\"]"
50+
- name: "experiment"
51+
input:
52+
spec:
53+
value:
54+
labels:
55+
env: prod
56+
experiment: "group b"
57+
resource:
58+
value:
59+
labels:
60+
env: staging
61+
release: "v0.1.0"
62+
output:
63+
value: "missing one or more required labels: [\"experiment\"]"
6464
- name: "invalid"
6565
tests:
66-
- name: "env"
67-
input:
68-
spec:
69-
value:
70-
labels:
71-
env: prod
72-
experiment: "group b"
73-
resource:
74-
value:
75-
labels:
76-
env: staging
77-
experiment: "group b"
78-
release: "v0.1.0"
79-
output:
80-
value: "invalid values provided on one or more labels: [\"env\"]"
66+
- name: "env"
67+
input:
68+
spec:
69+
value:
70+
labels:
71+
env: prod
72+
experiment: "group b"
73+
resource:
74+
value:
75+
labels:
76+
env: staging
77+
experiment: "group b"
78+
release: "v0.1.0"
79+
output:
80+
value: "invalid values provided on one or more labels: [\"env\"]"

‎policy/testdata/restricted_destinations/base_config.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ variables:
3030
- name: "request"
3131
type_name: "map"
3232
params:
33-
- type_name: "string"
34-
- type_name: "dyn"
33+
- type_name: "string"
34+
- type_name: "dyn"
3535
- name: "resource"
3636
type_name: "map"
3737
params:

0 commit comments

Comments
 (0)