Skip to content

Commit

Permalink
test: Fix BenchmarkModifySetMutator_Mutate was broken (#1897)
Browse files Browse the repository at this point in the history
Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
  • Loading branch information
mozillazg and sozercan committed Mar 9, 2022
1 parent 4b9432d commit 9501be5
Showing 1 changed file with 2 additions and 14 deletions.
@@ -1,7 +1,6 @@
package modifyset

import (
"encoding/json"
"fmt"
"strings"
"testing"
Expand All @@ -10,20 +9,8 @@ import (
"github.com/open-policy-agent/gatekeeper/pkg/mutation/match"
"github.com/open-policy-agent/gatekeeper/pkg/mutation/path/tester"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
)

func makeValue(v interface{}) runtime.RawExtension {
v2 := map[string]interface{}{
"value": v,
}
j, err := json.Marshal(v2)
if err != nil {
panic(err)
}
return runtime.RawExtension{Raw: j}
}

func modifyset(value interface{}, location string) *unversioned.ModifySet {
result := &unversioned.ModifySet{
Spec: unversioned.ModifySetSpec{
Expand All @@ -34,8 +21,9 @@ func modifyset(value interface{}, location string) *unversioned.ModifySet {
}},
Location: location,
Parameters: unversioned.ModifySetParameters{
Operation: unversioned.MergeOp,
Values: unversioned.Values{
FromList: []interface{}{makeValue(value)},
FromList: []interface{}{value},
},
},
},
Expand Down

0 comments on commit 9501be5

Please sign in to comment.