Skip to content

Commit a491218

Browse files
Yuriy TeodorovychYuriy Teodorovych
authored andcommitted
address golint ci errors
1 parent b55f988 commit a491218

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

maas-api/internal/config/config_test.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"testing"
99
)
1010

11+
const testGatewayName = "my-gateway"
12+
1113
// resetGlobalFlags replaces flag.CommandLine with a fresh FlagSet so that
1214
// Load() can register its flags again without panicking.
1315
func resetGlobalFlags() {
@@ -22,26 +24,28 @@ func TestLoad_EnvironmentVariables(t *testing.T) {
2224
}{
2325
{
2426
name: "GATEWAY_NAME overrides GatewayName and Name defaults to it",
25-
envVars: map[string]string{"GATEWAY_NAME": "my-gateway"},
27+
envVars: map[string]string{"GATEWAY_NAME": testGatewayName},
2628
check: func(t *testing.T, cfg *Config) {
27-
if cfg.GatewayName != "my-gateway" {
28-
t.Errorf("expected GatewayName 'my-gateway', got %q", cfg.GatewayName)
29+
t.Helper()
30+
if cfg.GatewayName != testGatewayName {
31+
t.Errorf("expected GatewayName %q, got %q", testGatewayName, cfg.GatewayName)
2932
}
3033
// Name defaults to GatewayName when INSTANCE_NAME is not set
31-
if cfg.Name != "my-gateway" {
32-
t.Errorf("expected Name to default to GatewayName 'my-gateway', got %q", cfg.Name)
34+
if cfg.Name != testGatewayName {
35+
t.Errorf("expected Name to default to GatewayName %q, got %q", testGatewayName, cfg.Name)
3336
}
3437
},
3538
},
3639
{
3740
name: "INSTANCE_NAME and GATEWAY_NAME set independently",
38-
envVars: map[string]string{"INSTANCE_NAME": "my-instance", "GATEWAY_NAME": "my-gateway"},
41+
envVars: map[string]string{"INSTANCE_NAME": "my-instance", "GATEWAY_NAME": testGatewayName},
3942
check: func(t *testing.T, cfg *Config) {
43+
t.Helper()
4044
if cfg.Name != "my-instance" {
4145
t.Errorf("expected Name 'my-instance', got %q", cfg.Name)
4246
}
43-
if cfg.GatewayName != "my-gateway" {
44-
t.Errorf("expected GatewayName 'my-gateway', got %q", cfg.GatewayName)
47+
if cfg.GatewayName != testGatewayName {
48+
t.Errorf("expected GatewayName %q, got %q", testGatewayName, cfg.GatewayName)
4549
}
4650
},
4751
},

0 commit comments

Comments
 (0)