From 3ec5b4afab880400e7594326abb7642503b2efb8 Mon Sep 17 00:00:00 2001 From: Rob Mulholand Date: Wed, 24 Oct 2018 21:26:54 -0500 Subject: [PATCH] Remove unused param in integration test helper --- pkg/transformers/integration_tests/bite.go | 2 +- .../integration_tests/cat_file.go | 6 ++--- pkg/transformers/integration_tests/deal.go | 2 +- .../integration_tests/drip_drip.go | 2 +- .../integration_tests/drip_file_vow.go | 2 +- .../integration_tests/flop_kick.go | 4 +-- pkg/transformers/integration_tests/frob.go | 2 +- pkg/transformers/integration_tests/helpers.go | 2 +- .../pit_file_debt_ceiling.go | 2 +- .../integration_tests/pit_file_ilk.go | 2 +- .../pit_file_stability_fee.go | 2 +- .../integration_tests/price_feeds.go | 8 +++--- pkg/transformers/integration_tests/tend.go | 4 +-- .../integration_tests/vat_flux.go | 2 +- .../integration_tests/vat_fold.go | 2 +- .../integration_tests/vat_grab.go | 2 +- .../integration_tests/vat_heal.go | 2 +- .../integration_tests/vat_init.go | 2 +- .../integration_tests/vat_move.go | 2 +- .../integration_tests/vat_slip.go | 25 ++++++++----------- .../integration_tests/vat_tune.go | 2 +- 21 files changed, 37 insertions(+), 42 deletions(-) diff --git a/pkg/transformers/integration_tests/bite.go b/pkg/transformers/integration_tests/bite.go index 247b9e56..5b98b58b 100644 --- a/pkg/transformers/integration_tests/bite.go +++ b/pkg/transformers/integration_tests/bite.go @@ -37,7 +37,7 @@ var _ = Describe("Bite Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := bite.BiteTransformerInitializer{Config: config} diff --git a/pkg/transformers/integration_tests/cat_file.go b/pkg/transformers/integration_tests/cat_file.go index a2a6f30f..abf32cb8 100644 --- a/pkg/transformers/integration_tests/cat_file.go +++ b/pkg/transformers/integration_tests/cat_file.go @@ -53,7 +53,7 @@ var _ = Describe("Cat File transformer", func() { It("persists a chop lump event", func() { // transaction: 0x98574bfba4d05c3875be10d2376e678d005dbebe9a4520363407508fd21f4014 chopLumpBlockNumber := int64(8762253) - err = persistHeader(rpcClient, db, chopLumpBlockNumber) + err = persistHeader(db, chopLumpBlockNumber) Expect(err).NotTo(HaveOccurred()) config := cat_file.CatFileConfig @@ -86,7 +86,7 @@ var _ = Describe("Cat File transformer", func() { It("persists a flip event", func() { // transaction: 0x44bc18fdb1a5a263db114e7879653304db3e19ceb4e4496f21bc0a76c5faccbe flipBlockNumber := int64(8751794) - err = persistHeader(rpcClient, db, flipBlockNumber) + err = persistHeader(db, flipBlockNumber) Expect(err).NotTo(HaveOccurred()) config := cat_file.CatFileConfig @@ -111,7 +111,7 @@ var _ = Describe("Cat File transformer", func() { It("persists a pit vow event", func() { // transaction: 0x44bc18fdb1a5a263db114e7879653304db3e19ceb4e4496f21bc0a76c5faccbe pitVowBlockNumber := int64(8751794) - err = persistHeader(rpcClient, db, pitVowBlockNumber) + err = persistHeader(db, pitVowBlockNumber) Expect(err).NotTo(HaveOccurred()) config := cat_file.CatFileConfig diff --git a/pkg/transformers/integration_tests/deal.go b/pkg/transformers/integration_tests/deal.go index c8ab9ea4..e72be1b4 100644 --- a/pkg/transformers/integration_tests/deal.go +++ b/pkg/transformers/integration_tests/deal.go @@ -48,7 +48,7 @@ var _ = Describe("Deal transformer", func() { It("persists a flip deal log event", func() { // transaction: 0x05b5eabac2ace136f0f7e0efc61d7d42abe8e8938cc0f04fbf1a6ba545d59e58 flipBlockNumber := int64(8958007) - err = persistHeader(rpcClient, db, flipBlockNumber) + err = persistHeader(db, flipBlockNumber) Expect(err).NotTo(HaveOccurred()) config := deal.Config diff --git a/pkg/transformers/integration_tests/drip_drip.go b/pkg/transformers/integration_tests/drip_drip.go index c1e2511a..3047e966 100644 --- a/pkg/transformers/integration_tests/drip_drip.go +++ b/pkg/transformers/integration_tests/drip_drip.go @@ -37,7 +37,7 @@ var _ = Describe("DripDrip Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := drip_drip.DripDripTransformerInitializer{Config: config} diff --git a/pkg/transformers/integration_tests/drip_file_vow.go b/pkg/transformers/integration_tests/drip_file_vow.go index eacf35a8..c2b15d6f 100644 --- a/pkg/transformers/integration_tests/drip_file_vow.go +++ b/pkg/transformers/integration_tests/drip_file_vow.go @@ -39,7 +39,7 @@ var _ = Describe("Drip File Vow Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/flop_kick.go b/pkg/transformers/integration_tests/flop_kick.go index b3640a55..2d7fe007 100644 --- a/pkg/transformers/integration_tests/flop_kick.go +++ b/pkg/transformers/integration_tests/flop_kick.go @@ -39,7 +39,7 @@ var _ = Describe("FlopKick Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := flop_kick.FlopKickTransformerInitializer{Config: config} @@ -74,7 +74,7 @@ var _ = Describe("FlopKick Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := flop_kick.FlopKickTransformerInitializer{Config: config} diff --git a/pkg/transformers/integration_tests/frob.go b/pkg/transformers/integration_tests/frob.go index efa40c95..9f07ac98 100644 --- a/pkg/transformers/integration_tests/frob.go +++ b/pkg/transformers/integration_tests/frob.go @@ -42,7 +42,7 @@ var _ = Describe("Frob Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := frob.FrobTransformerInitializer{Config: config} diff --git a/pkg/transformers/integration_tests/helpers.go b/pkg/transformers/integration_tests/helpers.go index 29959b88..2cd56375 100644 --- a/pkg/transformers/integration_tests/helpers.go +++ b/pkg/transformers/integration_tests/helpers.go @@ -42,7 +42,7 @@ func getBlockChain(rpcClient client.RpcClient, ethClient *ethclient.Client) (cor return blockChain, nil } -func persistHeader(rpcClient client.RpcClient, db *postgres.DB, blockNumber int64) error { +func persistHeader(db *postgres.DB, blockNumber int64) error { headerRepository := repositories.NewHeaderRepository(db) _, err := headerRepository.CreateOrUpdateHeader(fakes.GetFakeHeader(blockNumber)) return err diff --git a/pkg/transformers/integration_tests/pit_file_debt_ceiling.go b/pkg/transformers/integration_tests/pit_file_debt_ceiling.go index 711e8857..ffe2a98f 100644 --- a/pkg/transformers/integration_tests/pit_file_debt_ceiling.go +++ b/pkg/transformers/integration_tests/pit_file_debt_ceiling.go @@ -39,7 +39,7 @@ var _ = Describe("PitFileDebtCeiling Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/pit_file_ilk.go b/pkg/transformers/integration_tests/pit_file_ilk.go index c9726b35..dc64b6ac 100644 --- a/pkg/transformers/integration_tests/pit_file_ilk.go +++ b/pkg/transformers/integration_tests/pit_file_ilk.go @@ -39,7 +39,7 @@ var _ = Describe("PitFileIlk Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/pit_file_stability_fee.go b/pkg/transformers/integration_tests/pit_file_stability_fee.go index 2c1f84ff..41ed688f 100644 --- a/pkg/transformers/integration_tests/pit_file_stability_fee.go +++ b/pkg/transformers/integration_tests/pit_file_stability_fee.go @@ -39,7 +39,7 @@ var _ = Describe("PitFileStabilityFee Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/price_feeds.go b/pkg/transformers/integration_tests/price_feeds.go index 3fe2e58e..25877a43 100644 --- a/pkg/transformers/integration_tests/price_feeds.go +++ b/pkg/transformers/integration_tests/price_feeds.go @@ -20,7 +20,6 @@ import ( "github.com/vulcanize/vulcanizedb/pkg/core" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" - "github.com/vulcanize/vulcanizedb/pkg/geth/client" "github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds" "github.com/vulcanize/vulcanizedb/test_config" ) @@ -29,7 +28,6 @@ var _ = Describe("Price feeds transformer", func() { var ( db *postgres.DB blockChain core.BlockChain - rpcClient client.RpcClient ) BeforeEach(func() { @@ -43,7 +41,7 @@ var _ = Describe("Price feeds transformer", func() { It("persists a ETH/USD price feed event", func() { blockNumber := int64(8763054) - err := persistHeader(rpcClient, db, blockNumber) + err := persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) config := price_feeds.IPriceFeedConfig{ ContractAddresses: []string{"0x9FfFE440258B79c5d6604001674A4722FfC0f7Bc"}, @@ -65,7 +63,7 @@ var _ = Describe("Price feeds transformer", func() { It("persists a MKR/USD price feed event", func() { blockNumber := int64(8763059) - err := persistHeader(rpcClient, db, blockNumber) + err := persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) config := price_feeds.IPriceFeedConfig{ ContractAddresses: []string{"0xB1997239Cfc3d15578A3a09730f7f84A90BB4975"}, @@ -87,7 +85,7 @@ var _ = Describe("Price feeds transformer", func() { It("persists a REP/USD price feed event", func() { blockNumber := int64(8763062) - err := persistHeader(rpcClient, db, blockNumber) + err := persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) config := price_feeds.IPriceFeedConfig{ ContractAddresses: []string{"0xf88bBDc1E2718F8857F30A180076ec38d53cf296"}, diff --git a/pkg/transformers/integration_tests/tend.go b/pkg/transformers/integration_tests/tend.go index 23b49558..f54f2c86 100644 --- a/pkg/transformers/integration_tests/tend.go +++ b/pkg/transformers/integration_tests/tend.go @@ -39,7 +39,7 @@ var _ = Describe("Tend Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ @@ -78,7 +78,7 @@ var _ = Describe("Tend Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/vat_flux.go b/pkg/transformers/integration_tests/vat_flux.go index 628c7dbb..025ae23a 100644 --- a/pkg/transformers/integration_tests/vat_flux.go +++ b/pkg/transformers/integration_tests/vat_flux.go @@ -39,7 +39,7 @@ var _ = Describe("VatFlux Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/vat_fold.go b/pkg/transformers/integration_tests/vat_fold.go index 50640565..a0ccb12b 100644 --- a/pkg/transformers/integration_tests/vat_fold.go +++ b/pkg/transformers/integration_tests/vat_fold.go @@ -38,7 +38,7 @@ var _ = Describe("VatFold Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := vat_fold.VatFoldTransformerInitializer{Config: config} diff --git a/pkg/transformers/integration_tests/vat_grab.go b/pkg/transformers/integration_tests/vat_grab.go index 11c8cada..2fa7e552 100644 --- a/pkg/transformers/integration_tests/vat_grab.go +++ b/pkg/transformers/integration_tests/vat_grab.go @@ -39,7 +39,7 @@ var _ = Describe("Vat Grab Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := vat_grab.VatGrabTransformerInitializer{Config: config} diff --git a/pkg/transformers/integration_tests/vat_heal.go b/pkg/transformers/integration_tests/vat_heal.go index dd6c37aa..9ceccf89 100644 --- a/pkg/transformers/integration_tests/vat_heal.go +++ b/pkg/transformers/integration_tests/vat_heal.go @@ -38,7 +38,7 @@ var _ = Describe("VatHeal Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := vat_heal.VatHealTransformerInitializer{Config: config} diff --git a/pkg/transformers/integration_tests/vat_init.go b/pkg/transformers/integration_tests/vat_init.go index fba6fb72..fba3d380 100644 --- a/pkg/transformers/integration_tests/vat_init.go +++ b/pkg/transformers/integration_tests/vat_init.go @@ -39,7 +39,7 @@ var _ = Describe("VatInit Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/vat_move.go b/pkg/transformers/integration_tests/vat_move.go index 0992324b..5819c989 100644 --- a/pkg/transformers/integration_tests/vat_move.go +++ b/pkg/transformers/integration_tests/vat_move.go @@ -40,7 +40,7 @@ var _ = Describe("VatMove Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{ diff --git a/pkg/transformers/integration_tests/vat_slip.go b/pkg/transformers/integration_tests/vat_slip.go index 02411dea..68cb9673 100644 --- a/pkg/transformers/integration_tests/vat_slip.go +++ b/pkg/transformers/integration_tests/vat_slip.go @@ -18,7 +18,7 @@ var _ = Describe("Vat slip transformer", func() { blockChain core.BlockChain ) - BeforeEach(func() { + It("persists vat slip event", func() { rpcClient, ethClient, err := getClients(ipc) Expect(err).NotTo(HaveOccurred()) blockChain, err = getBlockChain(rpcClient, ethClient) @@ -26,16 +26,14 @@ var _ = Describe("Vat slip transformer", func() { db = test_config.NewTestDB(blockChain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, 8953655) - Expect(err).NotTo(HaveOccurred()) - }) + blockNumber := int64(8953655) + config := vat_slip.VatSlipConfig + config.StartingBlockNumber = blockNumber + config.EndingBlockNumber = blockNumber + + err = persistHeader(db, blockNumber) + Expect(err).NotTo(HaveOccurred()) - It("persists vat slip event", func(done Done) { - config := shared.SingleTransformerConfig{ - ContractAddresses: []string{"0xcd726790550afcd77e9a7a47e86a3f9010af126b"}, - StartingBlockNumber: 8953655, - EndingBlockNumber: 8953655, - } initializer := factories.Transformer{ Config: config, Fetcher: &shared.Fetcher{}, @@ -44,11 +42,11 @@ var _ = Describe("Vat slip transformer", func() { } transformer := initializer.NewTransformer(db, blockChain) - err := transformer.Execute() + err = transformer.Execute() Expect(err).NotTo(HaveOccurred()) var headerID int64 - err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, config.StartingBlockNumber) + err = db.Get(&headerID, `SELECT id FROM public.headers WHERE block_number = $1`, blockNumber) Expect(err).NotTo(HaveOccurred()) var model vat_slip.VatSlipModel err = db.Get(&model, `SELECT ilk, guy, rad, tx_idx FROM maker.vat_slip WHERE header_id = $1`, headerID) @@ -61,6 +59,5 @@ var _ = Describe("Vat slip transformer", func() { err = db.Get(&headerChecked, `SELECT vat_slip_checked FROM public.checked_headers WHERE header_id = $1`, headerID) Expect(err).NotTo(HaveOccurred()) Expect(headerChecked).To(BeTrue()) - close(done) - }, 15) + }) }) diff --git a/pkg/transformers/integration_tests/vat_tune.go b/pkg/transformers/integration_tests/vat_tune.go index 5a717508..e09446af 100644 --- a/pkg/transformers/integration_tests/vat_tune.go +++ b/pkg/transformers/integration_tests/vat_tune.go @@ -41,7 +41,7 @@ var _ = Describe("VatTune Transformer", func() { db := test_config.NewTestDB(blockchain.Node()) test_config.CleanTestDB(db) - err = persistHeader(rpcClient, db, blockNumber) + err = persistHeader(db, blockNumber) Expect(err).NotTo(HaveOccurred()) initializer := factories.Transformer{