Set timeout before assertions in integration tests

- Prevent early evaluation from triggering failure
This commit is contained in:
Rob Mulholand 2018-09-21 10:51:35 -05:00
parent 2bfbd85ba5
commit e138e58120

View File

@ -17,6 +17,7 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds"
"github.com/vulcanize/vulcanizedb/test_config"
"math/big"
"time"
)
var _ = Describe("Price feeds transformer", func() {
@ -51,12 +52,14 @@ var _ = Describe("Price feeds transformer", func() {
err := transformer.Execute()
time.AfterFunc(3*time.Second, func() {
Expect(err).NotTo(HaveOccurred())
var model price_feeds.PriceFeedModel
err = db.Get(&model, `SELECT block_number, medianizer_address, usd_value, tx_idx, raw_log FROM maker.price_feeds WHERE block_number = $1`, config.StartingBlockNumber)
Expect(err).NotTo(HaveOccurred())
Expect(model.UsdValue).To(Equal("207.314891143"))
})
})
It("persists a MKR/USD price feed event", func() {
config := price_feeds.IPriceFeedConfig{
@ -69,12 +72,14 @@ var _ = Describe("Price feeds transformer", func() {
err := transformer.Execute()
time.AfterFunc(3*time.Second, func() {
Expect(err).NotTo(HaveOccurred())
var model price_feeds.PriceFeedModel
err = db.Get(&model, `SELECT block_number, medianizer_address, usd_value, tx_idx, raw_log FROM maker.price_feeds WHERE block_number = $1`, config.StartingBlockNumber)
Expect(err).NotTo(HaveOccurred())
Expect(model.UsdValue).To(Equal("391.803979212"))
})
})
It("persists a REP/USD price feed event", func() {
config := price_feeds.IPriceFeedConfig{
@ -87,6 +92,7 @@ var _ = Describe("Price feeds transformer", func() {
err := transformer.Execute()
time.AfterFunc(3*time.Second, func() {
Expect(err).NotTo(HaveOccurred())
var model price_feeds.PriceFeedModel
err = db.Get(&model, `SELECT block_number, medianizer_address, usd_value, tx_idx, raw_log FROM maker.price_feeds WHERE block_number = $1`, config.StartingBlockNumber)
@ -94,6 +100,7 @@ var _ = Describe("Price feeds transformer", func() {
Expect(model.UsdValue).To(Equal("12.8169284827"))
})
})
})
func getClients(ipc string) (client.RpcClient, *ethclient.Client, error) {
raw, err := rpc.Dial(ipc)