forked from cerc-io/ipld-eth-server
Set timeout before assertions in integration tests
- Prevent early evaluation from triggering failure
This commit is contained in:
parent
2bfbd85ba5
commit
e138e58120
@ -17,6 +17,7 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds"
|
"github.com/vulcanize/vulcanizedb/pkg/transformers/price_feeds"
|
||||||
"github.com/vulcanize/vulcanizedb/test_config"
|
"github.com/vulcanize/vulcanizedb/test_config"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Price feeds transformer", func() {
|
var _ = Describe("Price feeds transformer", func() {
|
||||||
@ -51,11 +52,13 @@ var _ = Describe("Price feeds transformer", func() {
|
|||||||
|
|
||||||
err := transformer.Execute()
|
err := transformer.Execute()
|
||||||
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
time.AfterFunc(3*time.Second, func() {
|
||||||
var model price_feeds.PriceFeedModel
|
Expect(err).NotTo(HaveOccurred())
|
||||||
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)
|
var model price_feeds.PriceFeedModel
|
||||||
Expect(err).NotTo(HaveOccurred())
|
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(model.UsdValue).To(Equal("207.314891143"))
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(model.UsdValue).To(Equal("207.314891143"))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
It("persists a MKR/USD price feed event", func() {
|
It("persists a MKR/USD price feed event", func() {
|
||||||
@ -69,11 +72,13 @@ var _ = Describe("Price feeds transformer", func() {
|
|||||||
|
|
||||||
err := transformer.Execute()
|
err := transformer.Execute()
|
||||||
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
time.AfterFunc(3*time.Second, func() {
|
||||||
var model price_feeds.PriceFeedModel
|
Expect(err).NotTo(HaveOccurred())
|
||||||
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)
|
var model price_feeds.PriceFeedModel
|
||||||
Expect(err).NotTo(HaveOccurred())
|
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(model.UsdValue).To(Equal("391.803979212"))
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(model.UsdValue).To(Equal("391.803979212"))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
It("persists a REP/USD price feed event", func() {
|
It("persists a REP/USD price feed event", func() {
|
||||||
@ -87,11 +92,13 @@ var _ = Describe("Price feeds transformer", func() {
|
|||||||
|
|
||||||
err := transformer.Execute()
|
err := transformer.Execute()
|
||||||
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
time.AfterFunc(3*time.Second, func() {
|
||||||
var model price_feeds.PriceFeedModel
|
Expect(err).NotTo(HaveOccurred())
|
||||||
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)
|
var model price_feeds.PriceFeedModel
|
||||||
Expect(err).NotTo(HaveOccurred())
|
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(model.UsdValue).To(Equal("12.8169284827"))
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(model.UsdValue).To(Equal("12.8169284827"))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user