Fixed lint issues with files (#3234)

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
Alex
2024-02-12 23:55:17 -06:00
committed by GitHub
parent f394cb69ce
commit 80c03839a4
65 changed files with 438 additions and 449 deletions

View File

@@ -61,7 +61,7 @@ func TestGenerateLoginURL(t *testing.T) {
oauth2Config: Oauth2configMock{},
}
// Test-1 : GenerateLoginURL() generates URL correctly with provided state
oauth2ConfigAuthCodeURLMock = func(state string, opts ...oauth2.AuthCodeOption) string {
oauth2ConfigAuthCodeURLMock = func(state string, _ ...oauth2.AuthCodeOption) string {
// Internally we are testing the private method getRandomStateWithHMAC, this function should always returns
// a non-empty string
return state

View File

@@ -174,7 +174,7 @@ func TestInitializeLogger(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if tt.setEnvVars != nil {
tt.setEnvVars()
}
@@ -197,7 +197,7 @@ func TestEnableJSON(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
EnableJSON()
if !IsJSON() {
t.Errorf("EnableJSON() = %v, want %v", IsJSON(), true)
@@ -215,7 +215,7 @@ func TestEnableQuiet(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
EnableQuiet()
if !IsQuiet() {
t.Errorf("EnableQuiet() = %v, want %v", IsQuiet(), true)
@@ -233,7 +233,7 @@ func TestEnableAnonymous(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
EnableAnonymous()
if !IsAnonymous() {
t.Errorf("EnableAnonymous() = %v, want %v", IsAnonymous(), true)

View File

@@ -43,7 +43,7 @@ func TestNewEntry(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := NewEntry(tt.args.deploymentID); got.DeploymentID != tt.want.DeploymentID {
t.Errorf("NewEntry() = %v, want %v", got, tt.want)
}
@@ -106,7 +106,7 @@ func TestNewEntry(t *testing.T) {
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// t.Run(tt.name, func(_ *testing.T) {
// if tt.preFunc != nil {
// tt.preFunc()
// }

View File

@@ -52,7 +52,7 @@ func Test_subnetBaseURL(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if tt.args.env != nil {
for k, v := range tt.args.env {
os.Setenv(k, v)
@@ -102,7 +102,7 @@ func Test_subnetRegisterURL(t *testing.T) {
os.Setenv(k, v)
}
}
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := subnetRegisterURL(); got != tt.want {
t.Errorf("subnetRegisterURL() = %v, want %v", got, tt.want)
}
@@ -147,7 +147,7 @@ func Test_subnetLoginURL(t *testing.T) {
os.Setenv(k, v)
}
}
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := subnetLoginURL(); got != tt.want {
t.Errorf("subnetLoginURL() = %v, want %v", got, tt.want)
}
@@ -192,7 +192,7 @@ func Test_subnetOrgsURL(t *testing.T) {
os.Setenv(k, v)
}
}
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := subnetOrgsURL(); got != tt.want {
t.Errorf("subnetOrgsURL() = %v, want %v", got, tt.want)
}
@@ -237,7 +237,7 @@ func Test_subnetMFAURL(t *testing.T) {
os.Setenv(k, v)
}
}
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := subnetMFAURL(); got != tt.want {
t.Errorf("subnetMFAURL() = %v, want %v", got, tt.want)
}
@@ -282,7 +282,7 @@ func Test_subnetAPIKeyURL(t *testing.T) {
os.Setenv(k, v)
}
}
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := subnetAPIKeyURL(); got != tt.want {
t.Errorf("subnetAPIKeyURL() = %v, want %v", got, tt.want)
}
@@ -327,7 +327,7 @@ func TestLogWebhookURL(t *testing.T) {
os.Setenv(k, v)
}
}
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := LogWebhookURL(); got != tt.want {
t.Errorf("LogWebhookURL() = %v, want %v", got, tt.want)
}
@@ -378,7 +378,7 @@ func TestUploadURL(t *testing.T) {
os.Setenv(k, v)
}
}
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := UploadURL(tt.args.uploadType, tt.args.filename); got != tt.want {
t.Errorf("UploadURL() = %v, want %v", got, tt.want)
}
@@ -409,7 +409,7 @@ func TestUploadAuthHeaders(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := UploadAuthHeaders(tt.args.apiKey); !reflect.DeepEqual(got, tt.want) {
t.Errorf("UploadAuthHeaders() = %v, want %v", got, tt.want)
}
@@ -442,7 +442,7 @@ func TestGenerateRegToken(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
got, err := GenerateRegToken(tt.args.clusterRegInfo)
if (err != nil) != tt.wantErr {
t.Errorf("GenerateRegToken() error = %v, wantErr %v", err, tt.wantErr)
@@ -473,7 +473,7 @@ func Test_subnetAuthHeaders(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := subnetAuthHeaders(tt.args.authToken); !reflect.DeepEqual(got, tt.want) {
t.Errorf("subnetAuthHeaders() = %v, want %v", got, tt.want)
}
@@ -594,7 +594,7 @@ func Test_getDriveSpaceInfo(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
got, got1 := getDriveSpaceInfo(tt.args.admInfo)
if got != tt.want {
t.Errorf("getDriveSpaceInfo() got = %v, want %v", got, tt.want)

View File

@@ -36,7 +36,7 @@ func TestGetDivisibleSize(t *testing.T) {
for _, testCase := range testCases {
testCase := testCase
t.Run("", func(t *testing.T) {
t.Run("", func(_ *testing.T) {
gotGCD := getDivisibleSize(testCase.totalSizes)
if testCase.result != gotGCD {
t.Errorf("Expected %v, got %v", testCase.result, gotGCD)
@@ -143,7 +143,7 @@ func TestGetSetIndexes(t *testing.T) {
for _, testCase := range testCases {
testCase := testCase
t.Run("", func(t *testing.T) {
t.Run("", func(_ *testing.T) {
argPatterns := make([]ellipses.ArgPattern, len(testCase.args))
for i, arg := range testCase.args {
patterns, err := ellipses.FindEllipsesPatterns(arg)
@@ -277,7 +277,7 @@ func TestPossibleParities(t *testing.T) {
for _, testCase := range testCases {
testCase := testCase
t.Run("", func(t *testing.T) {
t.Run("", func(_ *testing.T) {
gotPs, err := PossibleParityValues(testCase.arg)
if err != nil && testCase.success {
t.Errorf("Expected success but failed instead %s", err)

View File

@@ -81,7 +81,7 @@ func TestDecodeInput(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
got, err := DecodeBase64(tt.args.s)
if (err != nil) != tt.wantErr {
t.Errorf("DecodeBase64() error = %v, wantErr %v", err, tt.wantErr)
@@ -119,7 +119,7 @@ func TestClientIPFromContext(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
if got := ClientIPFromContext(tt.args.ctx); got != tt.want {
t.Errorf("ClientIPFromContext() = %v, want %v", got, tt.want)
}