@@ -16,8 +16,8 @@ func TestIsSuccessState(t *testing.T) {
1616 result * Result
1717 want bool
1818 }{
19- {& Result {ID : "1" , Value : []string {}}, true },
20- {& Result {ID : "2" , Value : []string {"violation" }}, false },
19+ {& Result {ID : "1" , Violations : []string {}}, true },
20+ {& Result {ID : "2" , Violations : []string {"violation" }}, false },
2121 }
2222
2323 for idx , tc := range testCases {
@@ -34,9 +34,9 @@ func TestIsFailureState(t *testing.T) {
3434 result * Result
3535 want bool
3636 }{
37- {& Result {ID : "1" , Value : []string {}}, false },
38- {& Result {ID : "2" , Value : []string {"violation" }}, true },
39- {& Result {ID : "3" , Value : []string {"violation" , "more violation" }}, true },
37+ {& Result {ID : "1" , Violations : []string {}}, false },
38+ {& Result {ID : "2" , Violations : []string {"violation" }}, true },
39+ {& Result {ID : "3" , Violations : []string {"violation" , "more violation" }}, true },
4040 }
4141
4242 for idx , tc := range testCases {
@@ -104,12 +104,12 @@ func TestNewResultCollectionFromRegoResultSet(t *testing.T) {
104104 }
105105
106106 expectedResults := []* Result {
107- & Result {ID : "_1_4_3" , Value : []string {}, Package : "package.name" },
108- & Result {ID : "_1_4_4" , Value : []string {"violation" }, Package : "package.name" },
109- & Result {ID : "_1_4_5" , Value : []string {}, Package : "package.name" },
110- & Result {ID : "_1_4_6" , Value : []string {}, Package : "package.name" },
111- & Result {ID : "node_pools_with_legacy_endpoints_enabled" , Value : []string {}, Package : "package.name" },
112- & Result {ID : "node_pools_without_cloud_platform_scope" , Value : []string {"violation" }, Package : "package.name" },
107+ & Result {ID : "_1_4_3" , Violations : []string {}, Package : "package.name" },
108+ & Result {ID : "_1_4_4" , Violations : []string {"violation" }, Package : "package.name" },
109+ & Result {ID : "_1_4_5" , Violations : []string {}, Package : "package.name" },
110+ & Result {ID : "_1_4_6" , Violations : []string {}, Package : "package.name" },
111+ & Result {ID : "node_pools_with_legacy_endpoints_enabled" , Violations : []string {}, Package : "package.name" },
112+ & Result {ID : "node_pools_without_cloud_platform_scope" , Violations : []string {"violation" }, Package : "package.name" },
113113 }
114114
115115 rc , err := NewResultCollectionFromRegoResultSet (regoResultSet )
@@ -203,8 +203,8 @@ func errorsEqual(err1 error, err2 error) bool {
203203}
204204
205205func TestListPassing (t * testing.T ) {
206- a := & Result {ID : "a" , Value : []string {}}
207- b := & Result {ID : "b" , Value : []string {"violation" }}
206+ a := & Result {ID : "a" , Violations : []string {}}
207+ b := & Result {ID : "b" , Violations : []string {"violation" }}
208208
209209 rc := & ResultCollection {a , b }
210210
@@ -228,8 +228,8 @@ func TestListPassing(t *testing.T) {
228228}
229229
230230func TestListFailing (t * testing.T ) {
231- a := & Result {ID : "a" , Value : []string {}}
232- b := & Result {ID : "b" , Value : []string {"violation" }}
231+ a := & Result {ID : "a" , Violations : []string {}}
232+ b := & Result {ID : "b" , Violations : []string {"violation" }}
233233
234234 rc := & ResultCollection {a , b }
235235
@@ -253,9 +253,9 @@ func TestListFailing(t *testing.T) {
253253}
254254
255255func TestAdd (t * testing.T ) {
256- a := & Result {ID : "a" , Value : []string {}}
257- b := & Result {ID : "b" , Value : []string {"violation" }}
258- c := & Result {ID : "c" , Value : []string {"violation" }}
256+ a := & Result {ID : "a" , Violations : []string {}}
257+ b := & Result {ID : "b" , Violations : []string {"violation" }}
258+ c := & Result {ID : "c" , Violations : []string {"violation" }}
259259
260260 rc := NewResultCollection ()
261261 rc .Add ([]* Result {a })
@@ -269,8 +269,8 @@ func TestAdd(t *testing.T) {
269269}
270270
271271func TestByID (t * testing.T ) {
272- a := & Result {ID : "a" , Value : [] string {} }
273- b := & Result {ID : "b" , Value : [] string { "violation" } }
272+ a := & Result {ID : "a" }
273+ b := & Result {ID : "b" }
274274
275275 rc := & ResultCollection {a , b }
276276
@@ -286,7 +286,7 @@ func TestByID(t *testing.T) {
286286func TestSerialize (t * testing.T ) {
287287 t .Run ("returns error if Package if empty" , func (t * testing.T ) {
288288 rc := & ResultCollection {
289- & Result {ID : "a" , Value : []string {}, Package : "" },
289+ & Result {ID : "a" , Violations : []string {}, Package : "" },
290290 }
291291
292292 var buf bytes.Buffer
@@ -301,10 +301,10 @@ func TestSerialize(t *testing.T) {
301301
302302 t .Run ("writes desired JSON serialization of ResultCollection" , func (t * testing.T ) {
303303 rc := & ResultCollection {
304- & Result {ID : "a" , Package : "p1" , Value : []string {}},
305- & Result {ID : "b" , Package : "p1" , Value : []string {"violation" }},
306- & Result {ID : "c" , Package : "p1" , Value : []string {}},
307- & Result {ID : "d" , Package : "p2" , Value : []string {"violation" }},
304+ & Result {ID : "a" , Package : "p1" , Violations : []string {}},
305+ & Result {ID : "b" , Package : "p1" , Violations : []string {"violation" }},
306+ & Result {ID : "c" , Package : "p1" , Violations : []string {}},
307+ & Result {ID : "d" , Package : "p2" , Violations : []string {"violation" }},
308308 }
309309
310310 expectedSerialization := `{"p1/a":[],"p1/b":["violation"],"p1/c":[],"p2/d":["violation"]}`
0 commit comments