Skip to content

Commit

Permalink
fix(config): allow memdb in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Nov 5, 2024
1 parent a441b9a commit 8661170
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"strings"
"testing"
"time"

"github.com/dashpay/dashd-go/btcjson"
Expand Down Expand Up @@ -343,7 +344,12 @@ func (cfg BaseConfig) ValidateBasic() error {
return errors.New("deadlock-detection can't be negative")
}

if cfg.DBBackend != "goleveldb" {
backends := map[string]bool{"goleveldb": true}
if testing.Testing() {
backends["memdb"] = true
}
// check if db_backends contains the db backend
if !backends[cfg.DBBackend] {
return fmt.Errorf("unsupported db backend: %s, only goleveldb is supported", cfg.DBBackend)
}

Expand Down

0 comments on commit 8661170

Please sign in to comment.