kaspad/domain/consensus/factory_test.go
Ori Newman 4207c82f5a
Add database prefix (#1750)
* Add prefix to stores

* Add prefix to forgotten stores

* Add a special type for prefix

* Rename transaction->dbTx

* Change error message

* Use countKeyName

* Rename Temporary Consesnsus to Staging

* Add DeleteStagingConsensus to Domain interface

* Add lock to staging consensus

* Make prefix type-safer

* Use ioutil.TempDir instead of t.TempDir
2021-06-15 17:47:17 +03:00

32 lines
642 B
Go

package consensus
import (
"github.com/kaspanet/kaspad/domain/prefixmanager/prefix"
"io/ioutil"
"testing"
"github.com/kaspanet/kaspad/domain/dagconfig"
"github.com/kaspanet/kaspad/infrastructure/db/database/ldb"
)
func TestNewConsensus(t *testing.T) {
f := NewFactory()
config := &Config{Params: dagconfig.DevnetParams}
tmpDir, err := ioutil.TempDir("", "TestNewConsensus")
if err != nil {
return
}
db, err := ldb.NewLevelDB(tmpDir, 8)
if err != nil {
t.Fatalf("error in NewLevelDB: %s", err)
}
_, err = f.NewConsensus(config, db, &prefix.Prefix{})
if err != nil {
t.Fatalf("error in NewConsensus: %+v", err)
}
}