From dc87f398896ce62d5a44bec332b1b94db3962470 Mon Sep 17 00:00:00 2001 From: Ian Norden Date: Wed, 23 Jan 2019 00:55:26 -0600 Subject: [PATCH] change omniwatcher database test helpers so that it doesn't interfere with downstream maker tests --- README.md | 6 ++-- cmd/lightSync.go | 8 ----- cmd/root.go | 3 +- integration_test/contract_test.go | 2 +- pkg/fakes/mock_rpc_client.go | 1 - pkg/geth/blockchain_test.go | 4 +-- .../shared/helpers/test_helpers/database.go | 31 +++++++++++++++++++ test_config/test_config.go | 1 - 8 files changed, 38 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 87b4d2f3..c46f9294 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Join the chat at https://gitter.im/vulcanizeio/VulcanizeDB](https://badges.gitter.im/vulcanizeio/VulcanizeDB.svg)](https://gitter.im/vulcanizeio/VulcanizeDB?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://travis-ci.com/8thlight/maker-vulcanizedb.svg?token=Wi4xzpyShmtvqatRBWkU&branch=staging)](https://travis-ci.com/8thlight/maker-vulcanizedb) +[![Build Status](https://travis-ci.com/vulcanize/maker-vulcanizedb.svg?token=MKcE2K7CRvKtdxSSnbap&branch=staging)](https://travis-ci.com/vulcanize/maker-vulcanizedb) ## About @@ -12,7 +12,7 @@ Vulcanize DB is a set of tools that make it easier for developers to write appli - Go 1.11+ - Postgres 10 - Ethereum Node - - [Go Ethereum](https://ethereum.github.io/go-ethereum/downloads/) (1.8.18+) + - [Go Ethereum](https://ethereum.github.io/go-ethereum/downloads/) (1.8.21+) - [Parity 1.8.11+](https://github.com/paritytech/parity/releases) ## Project Setup @@ -167,7 +167,7 @@ If you have full rinkeby chaindata you can move it to `rinkeby_vulcanizedb_geth_ 1. `go get -u github.com/pressly/sup/cmd/sup` 1. `sup staging deploy` -## omniWatcher and lightOmniWatcher +## omniWatcher These commands require a pre-synced (full or light) vulcanizeDB (see above sections) To watch all events of a contract using a light synced vDB: diff --git a/cmd/lightSync.go b/cmd/lightSync.go index f464144a..ff337640 100644 --- a/cmd/lightSync.go +++ b/cmd/lightSync.go @@ -37,24 +37,16 @@ var lightSyncCmd = &cobra.Command{ Short: "Syncs VulcanizeDB with local ethereum node's block headers", Long: `Syncs VulcanizeDB with local ethereum node. Populates Postgres with block headers. -<<<<<<< HEAD ./vulcanizedb lightSync --starting-block-number 0 --config public.toml Expects ethereum node to be running and requires a .toml config: -======= -./vulcanizedb lightSync --starting-block-number 0 --config public.toml -Expects ethereum node to be running and requires a .toml config: ->>>>>>> origin/master [database] name = "vulcanize_public" hostname = "localhost" port = 5432 -<<<<<<< HEAD -======= ->>>>>>> origin/master [client] ipcPath = "/Users/user/Library/Ethereum/geth.ipc" `, diff --git a/cmd/root.go b/cmd/root.go index 5eac5b39..17e7bac2 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -20,12 +20,12 @@ import ( "os" "time" + "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" "github.com/mitchellh/go-homedir" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/ethereum/go-ethereum/ethclient" "github.com/vulcanize/vulcanizedb/pkg/config" "github.com/vulcanize/vulcanizedb/pkg/geth" @@ -131,4 +131,3 @@ func getBlockChain() *geth.BlockChain { transactionConverter := vRpc.NewRpcTransactionConverter(ethClient) return geth.NewBlockChain(vdbEthClient, rpcClient, vdbNode, transactionConverter) } - diff --git a/integration_test/contract_test.go b/integration_test/contract_test.go index 5357859c..139d46d8 100644 --- a/integration_test/contract_test.go +++ b/integration_test/contract_test.go @@ -97,7 +97,7 @@ var _ = Describe("Reading contracts", func() { contract := testing.SampleContract() var balance = new(big.Int) - args := make([]interface{}, 1) + args := make([]interface{}, 1) args[0] = common.HexToHash("0xd26114cd6ee289accf82350c8d8487fedb8a0c07") err = blockChain.FetchContractData(contract.Abi, "0xd26114cd6ee289accf82350c8d8487fedb8a0c07", "balanceOf", args, &balance, 5167471) diff --git a/pkg/fakes/mock_rpc_client.go b/pkg/fakes/mock_rpc_client.go index 01e2cf8e..fe615555 100644 --- a/pkg/fakes/mock_rpc_client.go +++ b/pkg/fakes/mock_rpc_client.go @@ -158,4 +158,3 @@ func (client *MockRpcClient) AssertBatchCalledWith(method string, lengthOfBatch } Expect(client.passedMethod).To(Equal(method)) } - diff --git a/pkg/geth/blockchain_test.go b/pkg/geth/blockchain_test.go index a1ea45e6..217e5326 100644 --- a/pkg/geth/blockchain_test.go +++ b/pkg/geth/blockchain_test.go @@ -21,11 +21,11 @@ import ( "math/big" "github.com/ethereum/go-ethereum" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" vulcCore "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/fakes" diff --git a/pkg/omni/shared/helpers/test_helpers/database.go b/pkg/omni/shared/helpers/test_helpers/database.go index 3bea427b..c2f094d1 100644 --- a/pkg/omni/shared/helpers/test_helpers/database.go +++ b/pkg/omni/shared/helpers/test_helpers/database.go @@ -263,6 +263,37 @@ func TearDown(db *postgres.DB) { _, err = tx.Exec(`CREATE TABLE checked_headers (id SERIAL PRIMARY KEY, header_id INTEGER UNIQUE NOT NULL REFERENCES headers (id) ON DELETE CASCADE);`) Expect(err).NotTo(HaveOccurred()) + _, err = tx.Exec(`ALTER TABLE checked_headers +ADD COLUMN IF NOT EXISTS price_feeds_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS flip_kick_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS frob_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS tend_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS bite_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS dent_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS pit_file_debt_ceiling_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS pit_file_ilk_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_init_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS drip_file_ilk_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS drip_file_repo_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS drip_file_vow_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS deal_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS drip_drip_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS cat_file_chop_lump_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS cat_file_flip_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS cat_file_pit_vow_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS flop_kick_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_move_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_fold_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_heal_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_toll_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_tune_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_grab_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_flux_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vat_slip_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS vow_flog_checked BOOLEAN NOT NULL DEFAULT FALSE, +ADD COLUMN IF NOT EXISTS flap_kick_checked BOOLEAN NOT NULL DEFAULT FALSE`) + Expect(err).NotTo(HaveOccurred()) + _, err = tx.Exec(`DROP SCHEMA IF EXISTS full_0x8dd5fbce2f6a956c3022ba3663759011dd51e73e CASCADE`) Expect(err).NotTo(HaveOccurred()) diff --git a/test_config/test_config.go b/test_config/test_config.go index a775a164..5fd911d7 100644 --- a/test_config/test_config.go +++ b/test_config/test_config.go @@ -23,7 +23,6 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/viper" - "github.com/vulcanize/vulcanizedb/pkg/config" "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"