Skip to content

Commit 8c574d4

Browse files
committed
change var to const in create backup test
1 parent 9dd1418 commit 8c574d4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

internal/cmd/volume/snapshot/create/create_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,27 @@ import (
44
"context"
55
"testing"
66

7-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
8-
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
9-
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
10-
117
"github.com/google/go-cmp/cmp"
128
"github.com/google/go-cmp/cmp/cmpopts"
139
"github.com/google/uuid"
10+
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
11+
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
12+
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
13+
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1414
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1515
)
1616

1717
type testCtxKey struct{}
1818

19+
const (
20+
testName = "test-snapshot"
21+
)
22+
1923
var (
2024
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
2125
testClient = &iaas.APIClient{}
2226
testProjectId = uuid.NewString()
2327
testVolumeId = uuid.NewString()
24-
testName = "test-snapshot"
2528
testLabels = map[string]string{"key1": "value1"}
2629
)
2730

@@ -45,7 +48,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4548
Verbosity: globalflags.VerbosityDefault,
4649
},
4750
VolumeID: testVolumeId,
48-
Name: &testName,
51+
Name: utils.Ptr(testName),
4952
Labels: testLabels,
5053
}
5154
for _, mod := range mods {
@@ -58,7 +61,7 @@ func fixtureRequest(mods ...func(request *iaas.ApiCreateSnapshotRequest)) iaas.A
5861
request := testClient.CreateSnapshot(testCtx, testProjectId)
5962
payload := iaas.NewCreateSnapshotPayloadWithDefaults()
6063
payload.VolumeId = &testVolumeId
61-
payload.Name = &testName
64+
payload.Name = utils.Ptr(testName)
6265

6366
// Convert test labels to map[string]interface{}
6467
labelsMap := map[string]interface{}{}

0 commit comments

Comments
 (0)