Skip to content

Commit 0928e27

Browse files
author
Yago Carlos Fernandez Gou
committed
Address review: move some vars into constants in tests
1 parent a8c658c commit 0928e27

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

internal/cmd/intake/runner/create/create_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,23 @@ import (
1717
// Define a unique key for the context to avoid collisions
1818
type testCtxKey struct{}
1919

20+
const (
21+
testRegion = "eu01"
22+
testDisplayName = "testrunner"
23+
testMaxMessageSizeKiB = int64(1024)
24+
testMaxMessagesPerHour = int64(10000)
25+
testDescription = "This is a test runner"
26+
testLabelsString = "env=test,team=dev"
27+
)
28+
2029
var (
2130
// testCtx dummy context for testing purposes
2231
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
2332
// testClient mock API client
2433
testClient = &intake.APIClient{}
2534
testProjectId = uuid.NewString()
26-
testRegion = "eu01"
2735

28-
// Define test values for flags
29-
testDisplayName = "testrunner"
30-
testMaxMessageSizeKiB = int64(1024)
31-
testMaxMessagesPerHour = int64(10000)
32-
testDescription = "This is a test runner"
33-
testLabels = map[string]string{"env": "test", "team": "dev"}
34-
testLabelsString = "env=test,team=dev"
36+
testLabels = map[string]string{"env": "test", "team": "dev"}
3537
)
3638

3739
// fixtureFlagValues generates a map of flag values for tests

internal/cmd/intake/runner/delete/delete_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ import (
1616
// Define a unique key for the context to avoid collisions
1717
type testCtxKey struct{}
1818

19+
const (
20+
testRegion = "eu01"
21+
)
22+
1923
var (
2024
// testCtx is a dummy context for testing purposes
2125
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
2226
// testClient is a mock API client
2327
testClient = &intake.APIClient{}
2428
testProjectId = uuid.NewString()
2529
testRunnerId = uuid.NewString()
26-
testRegion = "eu01"
2730
)
2831

2932
// fixtureArgValues generates a slice of arguments for tests

internal/cmd/intake/runner/describe/describe_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ import (
1515

1616
type testCtxKey struct{}
1717

18+
const (
19+
testRegion = "eu01"
20+
)
21+
1822
var (
1923
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
2024
testClient = &intake.APIClient{}
2125
testProjectId = uuid.NewString()
2226
testRunnerId = uuid.NewString()
23-
testRegion = "eu01"
2427
)
2528

2629
func fixtureArgValues(mods ...func(argValues []string)) []string {

internal/cmd/intake/runner/list/list_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ import (
1717

1818
type testCtxKey struct{}
1919

20+
const (
21+
testRegion = "eu01"
22+
testLimit = int64(5)
23+
)
24+
2025
var (
2126
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
2227
testClient = &intake.APIClient{}
2328
testProjectId = uuid.NewString()
24-
testRegion = "eu01"
25-
testLimit = int64(5)
2629
)
2730

2831
func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]string {

internal/cmd/intake/runner/update/update_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ import (
1616

1717
type testCtxKey struct{}
1818

19+
const (
20+
testRegion = "eu01"
21+
)
22+
1923
var (
2024
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
2125
testClient = &intake.APIClient{}
2226
testProjectId = uuid.NewString()
2327
testRunnerId = uuid.NewString()
24-
testRegion = "eu01"
2528
)
2629

2730
func fixtureArgValues(mods ...func(argValues []string)) []string {

0 commit comments

Comments
 (0)