forked from cerc-io/ipld-eth-server
major refactor part 2: remove cold import, full sync, generalize node table
This commit is contained in:
@@ -19,13 +19,11 @@ package test_config
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/config"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/eth/core"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/eth/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/eth/datastore/postgres/repositories"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/postgres"
|
||||
"os"
|
||||
)
|
||||
|
||||
@@ -88,22 +86,15 @@ func NewTestDB(node core.Node) *postgres.DB {
|
||||
func CleanTestDB(db *postgres.DB) {
|
||||
db.MustExec("DELETE FROM addresses")
|
||||
db.MustExec("DELETE FROM blocks")
|
||||
db.MustExec("DELETE FROM eth_blocks")
|
||||
db.MustExec("DELETE FROM checked_headers")
|
||||
// can't delete from eth_nodes since this function is called after the required eth_node is persisted
|
||||
db.MustExec("DELETE FROM full_sync_logs")
|
||||
db.MustExec("DELETE FROM full_sync_receipts")
|
||||
db.MustExec("DELETE FROM full_sync_transactions")
|
||||
// can't delete from nodes since this function is called after the required node is persisted
|
||||
db.MustExec("DELETE FROM goose_db_version")
|
||||
db.MustExec("DELETE FROM header_sync_logs")
|
||||
db.MustExec("DELETE FROM header_sync_receipts")
|
||||
db.MustExec("DELETE FROM header_sync_transactions")
|
||||
db.MustExec("DELETE FROM headers")
|
||||
db.MustExec("DELETE FROM log_filters")
|
||||
db.MustExec("DELETE FROM queued_storage")
|
||||
db.MustExec("DELETE FROM storage_diff")
|
||||
db.MustExec("DELETE FROM watched_contracts")
|
||||
db.MustExec("DELETE FROM watched_logs")
|
||||
}
|
||||
|
||||
func CleanCheckedHeadersTable(db *postgres.DB, columnNames []string) {
|
||||
@@ -116,15 +107,8 @@ func CleanCheckedHeadersTable(db *postgres.DB, columnNames []string) {
|
||||
func NewTestNode() core.Node {
|
||||
return core.Node{
|
||||
GenesisBlock: "GENESIS",
|
||||
NetworkID: 1,
|
||||
NetworkID: "1",
|
||||
ID: "b6f90c0fdd8ec9607aed8ee45c69322e47b7063f0bfb7a29c8ecafab24d0a22d24dd2329b5ee6ed4125a03cb14e57fd584e67f9e53e6c631055cbbd82f080845",
|
||||
ClientName: "Geth/v1.7.2-stable-1db4ecdc/darwin-amd64/go1.9",
|
||||
}
|
||||
}
|
||||
|
||||
func NewTestBlock(blockNumber int64, repository repositories.BlockRepository) int64 {
|
||||
blockID, err := repository.CreateOrUpdateBlock(core.Block{Number: blockNumber})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
return blockID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user