2016-09-11 11:44:14 +00:00
|
|
|
package geth_test
|
|
|
|
|
|
|
|
import (
|
2016-09-15 03:08:06 +00:00
|
|
|
"os"
|
2016-09-11 11:44:14 +00:00
|
|
|
"testing"
|
2016-09-15 03:08:06 +00:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/status-im/status-go/geth"
|
2016-09-11 11:44:14 +00:00
|
|
|
)
|
|
|
|
|
2017-03-14 22:57:07 +00:00
|
|
|
var testConfig *geth.TestConfig
|
2016-09-11 11:44:14 +00:00
|
|
|
|
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()
|
2016-09-11 11:44:14 +00:00
|
|
|
if err != nil {
|
2016-09-15 03:08:06 +00:00
|
|
|
panic(err)
|
2016-09-11 11:44:14 +00:00
|
|
|
}
|
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)
|
2016-09-11 11:44:14 +00:00
|
|
|
}
|
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)
|
|
|
|
}
|