Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Shen <[email protected]>
  • Loading branch information
mjlshen authored and Matthew Barnes committed Mar 21, 2024
1 parent 1e89a14 commit 77b96bb
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}()
}

Expand Down
2 changes: 1 addition & 1 deletion internal/api/arm/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 += ", "
}
Expand Down
60 changes: 60 additions & 0 deletions internal/api/arm/error_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
})
}
}
4 changes: 2 additions & 2 deletions internal/api/hcpopenshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion internal/api/hcpopenshiftclusternodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
4 changes: 2 additions & 2 deletions internal/api/v20240610preview/nodepoolprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 77b96bb

Please sign in to comment.