ensure errors are checked (#12989)

This commit is contained in:
John-Michael Faircloth 2021-11-01 13:34:51 -05:00 committed by GitHub
parent c83289f238
commit 792400a24c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -972,6 +972,7 @@ func TestLeaseCache_PersistAndRestore_WithManyDependencies(t *testing.T) {
var processed int
leases, err := boltStorage.GetByType(context.Background(), cacheboltdb.LeaseType)
require.NoError(t, err)
for _, lease := range leases {
index, err := cachememdb.Deserialize(lease)
require.NoError(t, err)

View File

@ -99,7 +99,6 @@ func (c *Client) DialLDAP(cfg *ConfigEntry) (Connection, error) {
* user's attributes (if found)
*/
func (c *Client) makeLdapSearchRequest(cfg *ConfigEntry, conn Connection, username string) (*ldap.SearchResult, error) {
// Note: The logic below drives the logic in ConfigEntry.Validate().
// If updated, please update there as well.
var err error
@ -113,6 +112,9 @@ func (c *Client) makeLdapSearchRequest(cfg *ConfigEntry, conn Connection, userna
}
renderedFilter, err := c.RenderUserSearchFilter(cfg, username)
if err != nil {
return nil, err
}
if c.Logger.IsDebug() {
c.Logger.Debug("discovering user", "userdn", cfg.UserDN, "filter", renderedFilter)
@ -121,14 +123,13 @@ func (c *Client) makeLdapSearchRequest(cfg *ConfigEntry, conn Connection, userna
BaseDN: cfg.UserDN,
Scope: ldap.ScopeWholeSubtree,
Filter: renderedFilter,
SizeLimit: 2, //Should be only 1 result. Any number larger (2 or more) means access denied.
SizeLimit: 2, // Should be only 1 result. Any number larger (2 or more) means access denied.
Attributes: []string{
cfg.UserAttr, //Return only needed attributes
cfg.UserAttr, // Return only needed attributes
},
}
result, err := conn.Search(ldapRequest)
if err != nil {
return nil, err
}

View File

@ -290,6 +290,7 @@ func TestOIDC_Auth_Code_Flow_CAP_Client(t *testing.T) {
_, err = client.Logical().Write("identity/oidc/provider/test-provider", map[string]interface{}{
"allowed_client_ids": []string{clientID},
})
require.NoError(t, err)
// Create the client-side OIDC request state
oidcRequest, err := oidc.NewRequest(10*time.Minute, testRedirectURI, tt.args.options...)