Skip to content

Commit cafa158

Browse files
author
Juan Jesús Padrón Hernández
committed
fix linter
1 parent ca2af82 commit cafa158

5 files changed

Lines changed: 9 additions & 58 deletions

File tree

‎internal/cmd/alpha/sca/application/create/create_test.go‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ func TestParseInput(t *testing.T) {
271271
{
272272
desc: "invalid max instances",
273273
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
274-
// scalingTypeFlag.Set()
275274
flagValues[scalingTypeFlag.Name()] = scalingTypeAuto
276275
delete(flagValues, instancesFlag)
277276
flagValues[minInstancesFlag] = "2"
@@ -283,7 +282,6 @@ func TestParseInput(t *testing.T) {
283282
{
284283
desc: "missing rps and concurrency if autoscaling is enabled",
285284
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
286-
// scalingTypeFlag.Set()
287285
flagValues[scalingTypeFlag.Name()] = scalingTypeAuto
288286
delete(flagValues, instancesFlag)
289287
flagValues[minInstancesFlag] = "2"

‎internal/cmd/alpha/sca/application/delete/delete.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6868

6969
environmentLabel, err := utils.GetEnvironmentName(ctx, apiClient.DefaultAPI, model.ProjectId, model.EnvironmentID)
7070
if err != nil {
71-
params.Printer.Debug(print.ErrorLevel, "get environemnt name: %v", err)
71+
params.Printer.Debug(print.ErrorLevel, "get environment name: %v", err)
7272
environmentLabel = model.EnvironmentID
7373
}
7474

‎internal/cmd/alpha/sca/application/describe/describe.go‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func outputResult(p *print.Printer, outputFormat string, application *sca.Applic
9898
table.AddRow("STATE", scautils.ApplicationStateToStr(application.GetStopped()))
9999
table.AddSeparator()
100100
if application.RuntimeStatus != nil {
101-
table.AddRow("AVAILABE INSTANCES", len(application.GetRuntimeStatus().Instances))
101+
table.AddRow("AVAILABLE INSTANCES", len(application.GetRuntimeStatus().Instances))
102102
table.AddSeparator()
103103
}
104104
table.AddRow("PUBLIC INGRESS", application.GetNetwork().PublicIngress)
@@ -132,17 +132,17 @@ func outputResult(p *print.Printer, outputFormat string, application *sca.Applic
132132

133133
environmentVarTables := []tables.Table{}
134134
for _, c := range application.Containers {
135-
envVarTable := buildEnvVarsTable(c)
135+
envVarTable := buildEnvVarsTable(&c)
136136
if envVarTable != nil {
137137
environmentVarTables = append(environmentVarTables, *envVarTable)
138138
}
139139
commands := "-"
140140
if len(c.Command) > 0 {
141141
commands = strings.Join(c.Command, " ")
142142
}
143-
args := "-"
143+
cArgs := "-"
144144
if len(c.Command) > 0 {
145-
args = strings.Join(c.Args, " ")
145+
cArgs = strings.Join(c.Args, " ")
146146
}
147147

148148
cpu := "-"
@@ -161,7 +161,7 @@ func outputResult(p *print.Printer, outputFormat string, application *sca.Applic
161161
cpu,
162162
memory,
163163
commands,
164-
args,
164+
cArgs,
165165
)
166166
}
167167
tablesToDisplay = append(tablesToDisplay, containersTable)
@@ -233,7 +233,6 @@ func buildScalingRulesTable(rules []sca.ScaleRule) tables.Table {
233233
}
234234
for _, p := range rule.GetCustomRule().Parameters {
235235
params = append(params, fmt.Sprintf("%s: %s", p.Name, p.Value))
236-
237236
}
238237
parameters = strings.Join(params, "\n")
239238
sm := make([]string, 0, len(rule.GetCustomRule().SecretsMapping))
@@ -257,7 +256,7 @@ func buildScalingRulesTable(rules []sca.ScaleRule) tables.Table {
257256
return table
258257
}
259258

260-
func buildEnvVarsTable(container sca.Container) *tables.Table {
259+
func buildEnvVarsTable(container *sca.Container) *tables.Table {
261260
if len(container.EnvironmentVariables) == 0 {
262261
return nil
263262
}

‎internal/cmd/alpha/sca/application/generate-payload/generate_payload_test.go‎

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package generatepayload
22

33
import (
4-
"context"
54
"testing"
65

7-
"github.com/google/go-cmp/cmp"
8-
"github.com/google/go-cmp/cmp/cmpopts"
96
"github.com/google/uuid"
10-
sca "github.com/stackitcloud/stackit-sdk-go/services/sca/v1alphaapi"
117

128
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
139
"github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
@@ -17,9 +13,6 @@ const (
1713
testRegion = "eu01"
1814
)
1915

20-
var testClient = &sca.APIClient{DefaultAPI: &sca.DefaultAPIService{}}
21-
var testCtx = context.Background()
22-
2316
var (
2417
testProjectID = uuid.NewString()
2518
testEnvironmentID = uuid.NewString()
@@ -59,14 +52,6 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5952
return model
6053
}
6154

62-
func fixtureRequest(mods ...func(request *sca.ApiGetApplicationRequest)) sca.ApiGetApplicationRequest {
63-
request := testClient.DefaultAPI.GetApplication(testCtx, testProjectID, testEnvironmentID, testApplicationID)
64-
for _, mod := range mods {
65-
mod(&request)
66-
}
67-
return request
68-
}
69-
7055
func TestParseInput(t *testing.T) {
7156
tests := []struct {
7257
desc string
@@ -140,31 +125,3 @@ func TestParseInput(t *testing.T) {
140125
})
141126
}
142127
}
143-
144-
func TestBuildRequest(t *testing.T) {
145-
tests := []struct {
146-
description string
147-
model *inputModel
148-
expectedRequest sca.ApiGetApplicationRequest
149-
}{
150-
{
151-
description: "base",
152-
model: fixtureInputModel(),
153-
expectedRequest: fixtureRequest(),
154-
},
155-
}
156-
157-
for _, tt := range tests {
158-
t.Run(tt.description, func(t *testing.T) {
159-
request := buildRequest(testCtx, tt.model, testClient)
160-
161-
diff := cmp.Diff(request, tt.expectedRequest,
162-
cmp.AllowUnexported(tt.expectedRequest),
163-
cmpopts.EquateComparable(testCtx, sca.DefaultAPIService{}),
164-
)
165-
if diff != "" {
166-
t.Fatalf("Data does not match: %s", diff)
167-
}
168-
})
169-
}
170-
}

‎internal/cmd/alpha/sca/application/update/update.go‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8989
`Update the container image of a SCA application with ID "xxx" from an environment with ID "yyy"`,
9090
"$ stackit alpha sca application update xxx --image new-image --environment-id yyy"),
9191
),
92-
PreRunE: func(cmd *cobra.Command, args []string) error {
92+
PreRunE: func(cmd *cobra.Command, _ []string) error {
9393
updateFlags := []string{
9494
imageFlag,
9595
publicFlag,
@@ -153,9 +153,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
153153
}
154154
}
155155

156-
outputResult(params.Printer, model, resp)
157-
158-
return nil
156+
return outputResult(params.Printer, model, resp)
159157
},
160158
}
161159

@@ -213,7 +211,6 @@ func containersFromInput(containers []sca.Container, model *inputModel) []sca.Co
213211
Value: val,
214212
})
215213
}
216-
217214
}
218215

219216
if updateContainer {

0 commit comments

Comments
 (0)