Skip to content

Commit

Permalink
PR: Fix a err != nil => Returning nil
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzadlone committed Jan 21, 2025
1 parent 486f9da commit fca1262
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/integration/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func NewBadgerFileDB(ctx context.Context, t testing.TB) (client.DB, error) {
return node.DB, err
}

func getDefaultNodeOpts() []node.Option {
func getDefaultNodeOpts() ([]node.Option, error) {
opts := []node.Option{
node.WithLensPoolSize(lensPoolSize),
// The test framework sets this up elsewhere when required so that it may be wrapped
Expand All @@ -126,7 +126,7 @@ func getDefaultNodeOpts() []node.Option {
if badgerEncryption && encryptionKey == nil {
key, err := crypto.GenerateAES256()
if err != nil {
return nil
return []node.Option{}, err
}
encryptionKey = key
}
Expand All @@ -135,22 +135,26 @@ func getDefaultNodeOpts() []node.Option {
opts = append(opts, node.WithBadgerEncryptionKey(encryptionKey))
}

return opts
return opts, nil
}

// setupNode returns the database implementation for the current
// testing state. The database type on the test state is used to
// select the datastore implementation to use.
func setupNode(s *state, opts ...node.Option) (*nodeState, error) {
opts = append(getDefaultNodeOpts(), opts...)
defaultOpts, err := getDefaultNodeOpts()
if err != nil {
return nil, err
}

opts = append(defaultOpts, opts...)

switch acpType {
case LocalACPType:
opts = append(opts, node.WithACPType(node.LocalACPType))

case SourceHubACPType:
if len(s.acpOptions) == 0 {
var err error
s.acpOptions, err = setupSourceHub(s)
require.NoError(s.t, err)
}
Expand Down

0 comments on commit fca1262

Please sign in to comment.