From 4b602ebe20a26da5fcfa933f852d142d2d3c465d Mon Sep 17 00:00:00 2001 From: Francisc Munteanu Date: Fri, 13 Oct 2023 14:49:22 +0200 Subject: [PATCH] fix: binding request field should not be returned when empty (#818) * convert binding request to pointer --- go.mod | 2 +- go.sum | 4 ++-- test/e2e/proxy_test.go | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 5f3f35de2..4908d8d6e 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/codeready-toolchain/toolchain-e2e require ( - github.com/codeready-toolchain/api v0.0.0-20231010090546-098b27b43b3a + github.com/codeready-toolchain/api v0.0.0-20231013094356-24443ff2aa9a github.com/codeready-toolchain/toolchain-common v0.0.0-20231012065805-a23f3cfa676d github.com/davecgh/go-spew v1.1.1 github.com/fatih/color v1.12.0 diff --git a/go.sum b/go.sum index 23a5c9938..9fdf89011 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/codeready-toolchain/api v0.0.0-20231010090546-098b27b43b3a h1:UucbKqQ0bz9xe/Hr6kbrJkPK0YzCn2bdFwGme5rCfuU= -github.com/codeready-toolchain/api v0.0.0-20231010090546-098b27b43b3a/go.mod h1:nn3W6eKb9PFIVwSwZW7wDeLACMBOwAV+4kddGuN+ARM= +github.com/codeready-toolchain/api v0.0.0-20231013094356-24443ff2aa9a h1:lbMkf/E687UY6Dbj8yjADmorNdC3a25eDgmhkzdnzc0= +github.com/codeready-toolchain/api v0.0.0-20231013094356-24443ff2aa9a/go.mod h1:bImSKnxrpNmCmW/YEGiiZnZqJm3kAmfP5hW4YndK0hE= github.com/codeready-toolchain/toolchain-common v0.0.0-20231012065805-a23f3cfa676d h1:gQy0fpfCjl4XQhoXEQ3NUrvpRp4qKzov5TBKyePuwOM= github.com/codeready-toolchain/toolchain-common v0.0.0-20231012065805-a23f3cfa676d/go.mod h1:SnZewh0DLwAELKLsW+R6NKaKmiRBuMI1iMYSkfyZG6A= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= diff --git a/test/e2e/proxy_test.go b/test/e2e/proxy_test.go index 523ee836b..fbb3ff619 100644 --- a/test/e2e/proxy_test.go +++ b/test/e2e/proxy_test.go @@ -705,12 +705,12 @@ func TestSpaceLister(t *testing.T) { verifyHasExpectedWorkspace(t, expectedWorkspaceFor(t, awaitilities.Host(), "car", commonproxy.WithType("home"), appStudioTierRolesWSOption, commonproxy.WithBindings([]toolchainv1alpha1.Binding{ {MasterUserRecord: "bus", Role: "admin", - AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: busSBROnCarSpace.GetName(), Namespace: busSBROnCarSpace.GetNamespace(), }}, {MasterUserRecord: "car", Role: "admin", AvailableActions: []string(nil)}, // no actions since this is system generated binding - {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: bicycleSBROnCarSpace.GetName(), Namespace: bicycleSBROnCarSpace.GetNamespace(), }}}, @@ -797,7 +797,7 @@ func TestSpaceLister(t *testing.T) { verifyHasExpectedWorkspace(t, expectedWorkspaceFor(t, awaitilities.Host(), "bus", commonproxy.WithType("home"), appStudioTierRolesWSOption, commonproxy.WithBindings([]toolchainv1alpha1.Binding{ {MasterUserRecord: "bus", Role: "admin", AvailableActions: []string(nil)}, // this is system generated so no actions for the user - {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: bicycleSBROnBusSpace.GetName(), Namespace: bicycleSBROnBusSpace.GetNamespace(), }}})), @@ -812,12 +812,12 @@ func TestSpaceLister(t *testing.T) { require.NoError(t, err) verifyHasExpectedWorkspace(t, expectedWorkspaceFor(t, awaitilities.Host(), "car", appStudioTierRolesWSOption, commonproxy.WithBindings([]toolchainv1alpha1.Binding{ - {MasterUserRecord: "bus", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + {MasterUserRecord: "bus", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: busSBROnCarSpace.GetName(), Namespace: busSBROnCarSpace.GetNamespace(), }}, {MasterUserRecord: "car", Role: "admin", AvailableActions: []string(nil)}, // this is system generated so no actions for the user - {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: bicycleSBROnCarSpace.GetName(), Namespace: bicycleSBROnCarSpace.GetNamespace(), }}}, @@ -848,7 +848,7 @@ func TestSpaceLister(t *testing.T) { verifyHasExpectedWorkspace(t, expectedWorkspaceFor(t, awaitilities.Host(), "bus", appStudioTierRolesWSOption, commonproxy.WithBindings([]toolchainv1alpha1.Binding{ {MasterUserRecord: "bus", Role: "admin", AvailableActions: []string(nil)}, // this is system generated so no actions for the user - {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: bicycleSBROnBusSpace.GetName(), Namespace: bicycleSBROnBusSpace.GetNamespace(), }}}, @@ -864,12 +864,12 @@ func TestSpaceLister(t *testing.T) { require.NoError(t, err) verifyHasExpectedWorkspace(t, expectedWorkspaceFor(t, awaitilities.Host(), "car", appStudioTierRolesWSOption, commonproxy.WithBindings([]toolchainv1alpha1.Binding{ - {MasterUserRecord: "bus", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + {MasterUserRecord: "bus", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: busSBROnCarSpace.GetName(), Namespace: busSBROnCarSpace.GetNamespace(), }}, {MasterUserRecord: "car", Role: "admin", AvailableActions: []string(nil)}, // this is system generated so no actions for the user - {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: toolchainv1alpha1.BindingRequest{ + {MasterUserRecord: "road-bicycle", Role: "admin", AvailableActions: []string{"update", "delete"}, BindingRequest: &toolchainv1alpha1.BindingRequest{ Name: bicycleSBROnCarSpace.GetName(), Namespace: bicycleSBROnCarSpace.GetNamespace(), }}}, // this is system generated so no actions for the user