[lbry] test: don't remove old regression DB
This commit is contained in:
parent
a07bb527df
commit
1b823c055f
1 changed files with 0 additions and 33 deletions
33
lbcd.go
33
lbcd.go
|
@ -183,34 +183,6 @@ func btcdMain(serverChan chan<- *server) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeRegressionDB removes the existing regression test database if running
|
|
||||||
// in regression test mode and it already exists.
|
|
||||||
func removeRegressionDB(dbPath string) error {
|
|
||||||
// Don't do anything if not in regression test mode.
|
|
||||||
if !cfg.RegressionTest {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the old regression test database if it already exists.
|
|
||||||
fi, err := os.Stat(dbPath)
|
|
||||||
if err == nil {
|
|
||||||
btcdLog.Infof("Removing regression test database from '%s'", dbPath)
|
|
||||||
if fi.IsDir() {
|
|
||||||
err := os.RemoveAll(dbPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err := os.Remove(dbPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// dbPath returns the path to the block database given a database type.
|
// dbPath returns the path to the block database given a database type.
|
||||||
func blockDbPath(dbType string) string {
|
func blockDbPath(dbType string) string {
|
||||||
// The database name is based on the database type.
|
// The database name is based on the database type.
|
||||||
|
@ -277,11 +249,6 @@ func loadBlockDB() (database.DB, error) {
|
||||||
|
|
||||||
// The database name is based on the database type.
|
// The database name is based on the database type.
|
||||||
dbPath := blockDbPath(cfg.DbType)
|
dbPath := blockDbPath(cfg.DbType)
|
||||||
|
|
||||||
// The regression test is special in that it needs a clean database for
|
|
||||||
// each run, so remove it now if it already exists.
|
|
||||||
removeRegressionDB(dbPath)
|
|
||||||
|
|
||||||
btcdLog.Infof("Loading block database from '%s'", dbPath)
|
btcdLog.Infof("Loading block database from '%s'", dbPath)
|
||||||
db, err := database.Open(cfg.DbType, dbPath, activeNetParams.Net)
|
db, err := database.Open(cfg.DbType, dbPath, activeNetParams.Net)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue