Skip to content

Commit

Permalink
chore(lifecycle-operator): remove direct dependency on jsonpatch (#2187)
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
  • Loading branch information
odubajDT committed Sep 27, 2023
1 parent 366ee1f commit d7fce2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lifecycle-operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ require (
go.opentelemetry.io/otel/sdk/metric v0.41.0
go.opentelemetry.io/otel/trace v1.18.0
golang.org/x/net v0.15.0
gomodules.xyz/jsonpatch/v2 v2.4.0
google.golang.org/grpc v1.58.2
k8s.io/api v0.28.2
k8s.io/apiextensions-apiserver v0.28.2
Expand Down Expand Up @@ -84,6 +83,7 @@ require (
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
fakeclient "github.com/keptn/lifecycle-toolkit/lifecycle-operator/controllers/common/fake"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/otel/trace"
"gomodules.xyz/jsonpatch/v2"
admissionv1 "k8s.io/api/admission/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -1361,17 +1360,12 @@ func TestPodMutatingWebhook_Handle_SchedulingGates(t *testing.T) {
require.NotNil(t, resp)
require.True(t, resp.Allowed)

op := jsonpatch.Operation{
Operation: "add",
Path: "/spec/schedulingGates",
Value: []interface{}{map[string]interface{}{"name": apicommon.KeptnGate}},
}

expectedValue := []interface{}{map[string]interface{}{"name": apicommon.KeptnGate}}
require.Len(t, resp.Patches, 2)
if resp.Patches[0].Path == "/spec/schedulingGates" {
require.Equal(t, op, resp.Patches[0])
require.Equal(t, expectedValue, resp.Patches[0].Value)
} else {
require.Equal(t, op, resp.Patches[1])
require.Equal(t, expectedValue, resp.Patches[1].Value)
}

kacr := &klcv1alpha3.KeptnAppCreationRequest{}
Expand Down

0 comments on commit d7fce2a

Please sign in to comment.