From 9b393b96a16d54220bf04884ae36c308ecf75100 Mon Sep 17 00:00:00 2001 From: Pierangelo Di Pilato Date: Wed, 12 Jan 2022 09:39:38 +0100 Subject: [PATCH] Change json tag name to match struct field name Signed-off-by: Pierangelo Di Pilato --- testing/resource.go | 4 ++-- .../defaulting/defaulting_test.go | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/testing/resource.go b/testing/resource.go index 00cb427d96..59c5878cb7 100644 --- a/testing/resource.go +++ b/testing/resource.go @@ -50,9 +50,9 @@ type ResourceSpec struct { FieldThatsImmutable string `json:"fieldThatsImmutable,omitempty"` FieldThatsImmutableWithDefault string `json:"fieldThatsImmutableWithDefault,omitempty"` FieldForCallbackValidation string `json:"fieldThatCallbackRejects,omitempty"` - FieldForCallbackDefaulting string `json:"fieldDefaultingCallback,omitempty"` + FieldForCallbackDefaulting string `json:"fieldForCallbackDefaulting,omitempty"` FieldForCallbackDefaultingIsWithinUpdate bool `json:"fieldForIsWithinUpdate,omitempty"` - FieldForCallbackDefaultingUsername string `json:"FieldForCallbackDefaultingUsername,omitempty"` + FieldForCallbackDefaultingUsername string `json:"fieldForCallbackDefaultingUsername,omitempty"` } // GetGroupVersionKind returns the GroupVersionKind. diff --git a/webhook/resourcesemantics/defaulting/defaulting_test.go b/webhook/resourcesemantics/defaulting/defaulting_test.go index 949f9fbafe..28cd38e3e8 100644 --- a/webhook/resourcesemantics/defaulting/defaulting_test.go +++ b/webhook/resourcesemantics/defaulting/defaulting_test.go @@ -371,7 +371,7 @@ func TestAdmitCreates(t *testing.T) { }, patches: []jsonpatch.JsonPatchOperation{{ Operation: "replace", - Path: "/spec/fieldDefaultingCallback", + Path: "/spec/fieldForCallbackDefaulting", Value: "I'm a default", }, { Operation: "replace", @@ -383,7 +383,7 @@ func TestAdmitCreates(t *testing.T) { Value: user1, }, { Operation: "add", - Path: "/spec/FieldForCallbackDefaultingUsername", + Path: "/spec/fieldForCallbackDefaultingUsername", Value: user1, }}, }, { @@ -404,11 +404,11 @@ func TestAdmitCreates(t *testing.T) { }, patches: []jsonpatch.JsonPatchOperation{{ Operation: "replace", - Path: "/spec/fieldDefaultingCallback", + Path: "/spec/fieldForCallbackDefaulting", Value: "I'm a default", }, { Operation: "add", - Path: "/spec/FieldForCallbackDefaultingUsername", + Path: "/spec/fieldForCallbackDefaultingUsername", Value: user1, }, { Operation: "replace", @@ -604,7 +604,7 @@ func TestAdmitUpdatesCallback(t *testing.T) { }, patches: []jsonpatch.JsonPatchOperation{{ Operation: "replace", - Path: "/spec/fieldDefaultingCallback", + Path: "/spec/fieldForCallbackDefaulting", Value: "I'm a default", }, { @@ -617,7 +617,7 @@ func TestAdmitUpdatesCallback(t *testing.T) { Value: true, }, { Operation: "add", - Path: "/spec/FieldForCallbackDefaultingUsername", + Path: "/spec/fieldForCallbackDefaultingUsername", Value: user2, }}, createUpdateResourceFunc: createUpdateResource, @@ -643,7 +643,7 @@ func TestAdmitUpdatesCallback(t *testing.T) { Value: user2, }, { Operation: "replace", - Path: "/spec/fieldDefaultingCallback", + Path: "/spec/fieldForCallbackDefaulting", Value: "I'm a default", }, { Operation: "add", @@ -651,7 +651,7 @@ func TestAdmitUpdatesCallback(t *testing.T) { Value: true, }, { Operation: "add", - Path: "/spec/FieldForCallbackDefaultingUsername", + Path: "/spec/fieldForCallbackDefaultingUsername", Value: user2, }}, }, { @@ -681,7 +681,7 @@ func TestAdmitUpdatesCallback(t *testing.T) { }, patches: []jsonpatch.JsonPatchOperation{{ Operation: "replace", - Path: "/spec/fieldDefaultingCallback", + Path: "/spec/fieldForCallbackDefaulting", Value: "I'm a default", }, { @@ -694,7 +694,7 @@ func TestAdmitUpdatesCallback(t *testing.T) { Value: true, }, { Operation: "add", - Path: "/spec/FieldForCallbackDefaultingUsername", + Path: "/spec/fieldForCallbackDefaultingUsername", Value: user2, }}, createUpdateResourceFunc: createUpdateResource,