mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-08 07:11:53 +00:00
Clean up some lint errors that we missed before.
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
@@ -124,7 +124,7 @@ func ExchangeToken(ctx context.Context, token, caBundle, apiEndpoint string) (*C
|
||||
}
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
if resp.StatusCode != http.StatusCreated {
|
||||
return nil, fmt.Errorf("could not login: server returned status %d", resp.StatusCode)
|
||||
return nil, fmt.Errorf("%w: server returned status %d", ErrLoginFailed, resp.StatusCode)
|
||||
}
|
||||
|
||||
var respBody struct {
|
||||
|
||||
@@ -72,6 +72,7 @@ func TestExchangeToken(t *testing.T) {
|
||||
// Start a test server that doesn't do anything.
|
||||
caBundle, endpoint := startTestServer(t, func(w http.ResponseWriter, r *http.Request) {})
|
||||
|
||||
//nolint:staticcheck // ignore "do not pass a nil Context" linter error since that's what we're testing here.
|
||||
got, err := ExchangeToken(nil, "", caBundle, endpoint)
|
||||
require.EqualError(t, err, `could not build request: net/http: nil Context`)
|
||||
require.Nil(t, got)
|
||||
@@ -86,7 +87,7 @@ func TestExchangeToken(t *testing.T) {
|
||||
})
|
||||
|
||||
got, err := ExchangeToken(ctx, "", caBundle, endpoint)
|
||||
require.EqualError(t, err, `could not login: server returned status 500`)
|
||||
require.EqualError(t, err, `login failed: server returned status 500`)
|
||||
require.Nil(t, got)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user