diff --git a/frontend/frontend.go b/frontend/frontend.go index 596fce05a..011fc02c8 100644 --- a/frontend/frontend.go +++ b/frontend/frontend.go @@ -91,7 +91,7 @@ func (f *Frontend) Run(ctx context.Context, stop <-chan struct{}) { go func() { <-stop f.ready.Store(false) - f.server.Shutdown(ctx) + _ = f.server.Shutdown(ctx) }() } diff --git a/internal/api/arm/error.go b/internal/api/arm/error.go index f85c40f46..4426484b0 100644 --- a/internal/api/arm/error.go +++ b/internal/api/arm/error.go @@ -60,7 +60,7 @@ func (body *CloudErrorBody) String() string { if len(body.Details) > 0 { details = " Details: " for i, innerErr := range body.Details { - details := innerErr.String() + details += innerErr.String() if i < len(body.Details)-1 { details += ", " } diff --git a/internal/api/arm/error_test.go b/internal/api/arm/error_test.go new file mode 100644 index 000000000..f456102f2 --- /dev/null +++ b/internal/api/arm/error_test.go @@ -0,0 +1,60 @@ +package arm + +import "testing" + +func TestCloudErrorBody_String(t *testing.T) { + tests := []struct { + name string + body *CloudErrorBody + expected string + }{ + { + name: "One detail", + body: &CloudErrorBody{ + Code: "code", + Message: "message", + Target: "target", + Details: []CloudErrorBody{ + { + Code: "innercode", + Message: "innermessage", + Target: "innertarget", + Details: []CloudErrorBody{}, + }, + }, + }, + expected: "code: target: message Details: innercode: innertarget: innermessage", + }, + { + name: "Two details", + body: &CloudErrorBody{ + Code: "code", + Message: "message", + Target: "target", + Details: []CloudErrorBody{ + { + Code: "innercode", + Message: "innermessage", + Target: "innertarget", + Details: []CloudErrorBody{}, + }, + { + Code: "innercode2", + Message: "innermessage2", + Target: "innertarget2", + Details: []CloudErrorBody{}, + }, + }, + }, + expected: "code: target: message Details: innercode: innertarget: innermessage, innercode2: innertarget2: innermessage2", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + actual := test.body.String() + if test.expected != actual { + t.Errorf("expected: %v\ngot: %v", test.expected, actual) + } + }) + } +} diff --git a/internal/api/hcpopenshiftcluster.go b/internal/api/hcpopenshiftcluster.go index 66726afff..ec268c598 100644 --- a/internal/api/hcpopenshiftcluster.go +++ b/internal/api/hcpopenshiftcluster.go @@ -81,8 +81,8 @@ type NetworkProfile struct { // NodePoolAutoscaling represents a node pool autoscaling configuration. // Visibility for the entire struct is "read". type NodePoolAutoscaling struct { - MinReplicas int32 `json:minReplicas,omitempty"` - MaxReplicas int32 `json:maxReplicas,omitempty"` + MinReplicas int32 `json:"minReplicas,omitempty"` + MaxReplicas int32 `json:"maxReplicas,omitempty"` } // NodePoolProfile represents a worker node pool configuration. diff --git a/internal/api/hcpopenshiftclusternodepool.go b/internal/api/hcpopenshiftclusternodepool.go index ea2a0afc5..b502b34ed 100644 --- a/internal/api/hcpopenshiftclusternodepool.go +++ b/internal/api/hcpopenshiftclusternodepool.go @@ -18,5 +18,5 @@ type HCPOpenShiftClusterNodePool struct { // HCPOpenShiftClusterNodePool resource. type HCPOpenShiftClusterNodePoolProperties struct { ProvisioningState arm.ProvisioningState `json:"provisioningState,omitempty" visibility:"read"` - Profile NodePoolProfile `json:profile,omitempty" visibility:"read,create,update"` + Profile NodePoolProfile `json:"profile,omitempty" visibility:"read,create,update"` } diff --git a/internal/api/v20240610preview/hcpopenshiftclusternodepool.go b/internal/api/v20240610preview/hcpopenshiftclusternodepool.go index 5bdd8f8d4..bdb4c3ab8 100644 --- a/internal/api/v20240610preview/hcpopenshiftclusternodepool.go +++ b/internal/api/v20240610preview/hcpopenshiftclusternodepool.go @@ -19,5 +19,5 @@ type HCPOpenShiftClusterNodePool struct { // HCPOpenShiftClusterNodePool resource. type HCPOpenShiftClusterNodePoolProperties struct { ProvisioningState arm.ProvisioningState `json:"provisioningState,omitempty" visibility:"read"` - Profile api.VersionedNodePoolProfile `json:profile,omitempty" visibility:"read,create,update"` + Profile api.VersionedNodePoolProfile `json:"profile,omitempty" visibility:"read,create,update"` } diff --git a/internal/api/v20240610preview/nodepoolprofile.go b/internal/api/v20240610preview/nodepoolprofile.go index 0e6ca24bf..aa52a0031 100644 --- a/internal/api/v20240610preview/nodepoolprofile.go +++ b/internal/api/v20240610preview/nodepoolprofile.go @@ -6,8 +6,8 @@ package v20240610preview // NodePoolAutoscaling represents a node pool autoscaling configuration. // Visibility for the entire struct is "read". type NodePoolAutoscaling struct { - MinReplicas int32 `json:minReplicas,omitempty"` - MaxReplicas int32 `json:maxReplicas,omitempty"` + MinReplicas int32 `json:"minReplicas,omitempty"` + MaxReplicas int32 `json:"maxReplicas,omitempty"` } // NodePoolProfile represents a worker node pool configuration.