status-go/geth/node_manager_test.go

46 lines
810 B
Go
Raw Normal View History

package geth_test
import (
2016-09-15 03:08:06 +00:00
"os"
"testing"
2016-09-15 03:08:06 +00:00
"time"
"github.com/status-im/status-go/geth"
)
2017-03-14 22:57:07 +00:00
var testConfig *geth.TestConfig
2016-09-15 03:08:06 +00:00
func TestMain(m *testing.M) {
2017-03-14 22:57:07 +00:00
// load shared test configuration
var err error
testConfig, err = geth.LoadTestConfig()
if err != nil {
2016-09-15 03:08:06 +00:00
panic(err)
}
2016-09-15 03:08:06 +00:00
2017-03-14 22:57:07 +00:00
// run tests
retCode := m.Run()
2016-09-15 03:08:06 +00:00
2017-03-14 22:57:07 +00:00
//time.Sleep(25 * time.Second) // to give some time to propagate txs to the rest of the network
os.Exit(retCode)
}
2017-01-23 06:25:24 +00:00
func TestResetChainData(t *testing.T) {
err := geth.PrepareTestNode()
if err != nil {
t.Error(err)
return
}
if err := geth.NodeManagerInstance().ResetChainData(); err != nil {
t.Error(err)
return
}
// allow some time to re-sync
2017-03-14 22:57:07 +00:00
time.Sleep(testConfig.Node.SyncSeconds * time.Second)
2017-01-23 06:25:24 +00:00
// now make sure that everything is intact
TestQueuedTransactions(t)
}