From abf372a8715e1d25f60450c33adabcb6eea0b087 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 10 Jun 2024 20:53:13 +0200 Subject: [PATCH] cli/command: TestGetDefaultAuthConfig: remove unused expectedErr Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 7db922cf9f8545cb895807007e9786991235e543) Signed-off-by: Cory Snider --- cli/command/registry_test.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cli/command/registry_test.go b/cli/command/registry_test.go index 35e8020089..78117941c3 100644 --- a/cli/command/registry_test.go +++ b/cli/command/registry_test.go @@ -45,13 +45,11 @@ func TestGetDefaultAuthConfig(t *testing.T) { testCases := []struct { checkCredStore bool inputServerAddress string - expectedErr string expectedAuthConfig types.AuthConfig }{ { checkCredStore: false, inputServerAddress: "", - expectedErr: "", expectedAuthConfig: types.AuthConfig{ ServerAddress: "", Username: "", @@ -61,19 +59,16 @@ func TestGetDefaultAuthConfig(t *testing.T) { { checkCredStore: true, inputServerAddress: testAuthConfigs[0].ServerAddress, - expectedErr: "", expectedAuthConfig: testAuthConfigs[0], }, { checkCredStore: true, inputServerAddress: testAuthConfigs[1].ServerAddress, - expectedErr: "", expectedAuthConfig: testAuthConfigs[1], }, { checkCredStore: true, inputServerAddress: fmt.Sprintf("https://%s", testAuthConfigs[1].ServerAddress), - expectedErr: "", expectedAuthConfig: testAuthConfigs[1], }, } @@ -87,13 +82,8 @@ func TestGetDefaultAuthConfig(t *testing.T) { for _, tc := range testCases { serverAddress := tc.inputServerAddress authconfig, err := command.GetDefaultAuthConfig(cli, tc.checkCredStore, serverAddress, serverAddress == "https://index.docker.io/v1/") - if tc.expectedErr != "" { - assert.Check(t, err != nil) - assert.Check(t, is.Equal(tc.expectedErr, err.Error())) - } else { - assert.NilError(t, err) - assert.Check(t, is.DeepEqual(tc.expectedAuthConfig, authconfig)) - } + assert.NilError(t, err) + assert.Check(t, is.DeepEqual(tc.expectedAuthConfig, authconfig)) } }