Replace GinkgoRandomSeed with proper randomisation

This commit is contained in:
Edvard 2018-10-22 16:14:02 +02:00
parent 794a7e5f99
commit f55449d0e5
17 changed files with 43 additions and 26 deletions

View File

@ -20,6 +20,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
@ -51,8 +52,8 @@ var _ = Describe("Drip file ilk transformer", func() {
Converter: &converter,
Repository: &repository,
}.NewTransformer(nil, nil)
headerOne = core.Header{BlockNumber: GinkgoRandomSeed(), Id: GinkgoRandomSeed()}
headerTwo = core.Header{BlockNumber: GinkgoRandomSeed(), Id: GinkgoRandomSeed()}
headerOne = core.Header{BlockNumber: rand.Int63(), Id: rand.Int63()}
headerTwo = core.Header{BlockNumber: rand.Int63(), Id: rand.Int63()}
})
It("sets the blockchain and database", func() {

View File

@ -16,6 +16,7 @@ package repo_test
import (
"database/sql"
"math/rand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -137,7 +138,7 @@ var _ = Describe("Drip file repo repository", func() {
)
BeforeEach(func() {
startingBlock = GinkgoRandomSeed()
startingBlock = rand.Int63()
dripFileBlock = startingBlock + 1
endingBlock = startingBlock + 2

View File

@ -20,6 +20,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
@ -51,8 +52,8 @@ var _ = Describe("Drip file repo transformer", func() {
Converter: &converter,
Repository: &repository,
}.NewTransformer(nil, nil)
headerOne = core.Header{BlockNumber: GinkgoRandomSeed(), Id: GinkgoRandomSeed()}
headerTwo = core.Header{BlockNumber: GinkgoRandomSeed(), Id: GinkgoRandomSeed()}
headerOne = core.Header{BlockNumber: rand.Int63(), Id: rand.Int63()}
headerTwo = core.Header{BlockNumber: rand.Int63(), Id: rand.Int63()}
})
It("sets the blockchain and database", func() {

View File

@ -16,6 +16,7 @@ package vow_test
import (
"database/sql"
"math/rand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -137,7 +138,7 @@ var _ = Describe("Drip file vow repository", func() {
)
BeforeEach(func() {
startingBlock = GinkgoRandomSeed()
startingBlock = rand.Int63()
dripFileBlock = startingBlock + 1
endingBlock = startingBlock + 2

View File

@ -20,6 +20,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
@ -51,8 +52,8 @@ var _ = Describe("Drip file vow transformer", func() {
Converter: &converter,
Repository: &repository,
}.NewTransformer(nil, nil)
headerOne = core.Header{BlockNumber: GinkgoRandomSeed(), Id: GinkgoRandomSeed()}
headerTwo = core.Header{BlockNumber: GinkgoRandomSeed(), Id: GinkgoRandomSeed()}
headerOne = core.Header{BlockNumber: rand.Int63(), Id: rand.Int63()}
headerTwo = core.Header{BlockNumber: rand.Int63(), Id: rand.Int63()}
})
It("sets the blockchain and database", func() {

View File

@ -16,6 +16,7 @@ package debt_ceiling_test
import (
"database/sql"
"math/rand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -136,7 +137,7 @@ var _ = Describe("Pit file debt ceiling repository", func() {
)
BeforeEach(func() {
startingBlock = GinkgoRandomSeed()
startingBlock = rand.Int63()
pitFileBlock = startingBlock + 1
endingBlock = startingBlock + 2

View File

@ -20,6 +20,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
@ -45,8 +46,8 @@ var _ = Describe("Pit file debt ceiling transformer", func() {
fetcher = mocks.MockLogFetcher{}
converter = debt_ceiling_mocks.MockPitFileDebtCeilingConverter{}
repository = debt_ceiling_mocks.MockPitFileDebtCeilingRepository{}
headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerOne = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
headerTwo = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
transformer = factories.Transformer{
Config: config,
Fetcher: &fetcher,

View File

@ -16,6 +16,7 @@ package ilk_test
import (
"database/sql"
"math/rand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -137,7 +138,7 @@ var _ = Describe("Pit file ilk repository", func() {
)
BeforeEach(func() {
startingBlock = GinkgoRandomSeed()
startingBlock = rand.Int63()
pitFileBlock = startingBlock + 1
endingBlock = startingBlock + 2

View File

@ -20,6 +20,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
@ -45,8 +46,8 @@ var _ = Describe("Pit file ilk transformer", func() {
fetcher = mocks.MockLogFetcher{}
converter = ilk_mocks.MockPitFileIlkConverter{}
repository = ilk_mocks.MockPitFileIlkRepository{}
headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerOne = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
headerTwo = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
transformer = factories.Transformer{
Config: config,
Converter: &converter,

View File

@ -16,6 +16,7 @@ package stability_fee_test
import (
"database/sql"
"math/rand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -136,7 +137,7 @@ var _ = Describe("Pit file stability fee repository", func() {
)
BeforeEach(func() {
startingBlock = GinkgoRandomSeed()
startingBlock = rand.Int63()
pitFileBlock = startingBlock + 1
endingBlock = startingBlock + 2

View File

@ -21,6 +21,7 @@ import (
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/stability_fee"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
@ -51,8 +52,8 @@ var _ = Describe("Pit file stability fee transformer", func() {
Converter: &converter,
Repository: &repository,
}.NewTransformer(nil, nil)
headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerOne = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
headerTwo = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
})
It("sets the blockchain and database", func() {

View File

@ -17,6 +17,7 @@ package tend_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
@ -143,7 +144,7 @@ var _ = Describe("TendRepository", func() {
)
BeforeEach(func() {
tendBlock = GinkgoRandomSeed()
tendBlock = rand.Int63()
startingBlock = tendBlock - 1
endingBlock = tendBlock + 1
outOfRangeBlock = tendBlock + 2

View File

@ -16,6 +16,7 @@ package tend_test
import (
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"math/rand"
"github.com/ethereum/go-ethereum/common"
. "github.com/onsi/ginkgo"
@ -46,8 +47,8 @@ var _ = Describe("Tend Transformer", func() {
converter = tend_mocks.MockTendConverter{}
repository = tend_mocks.MockTendRepository{}
fetcher = mocks.MockLogFetcher{}
headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerOne = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
headerTwo = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
transformer = factories.Transformer{
Config: config,
Fetcher: &fetcher,

View File

@ -16,6 +16,7 @@ package vat_init_test
import (
"database/sql"
"math/rand"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -134,7 +135,7 @@ var _ = Describe("Vat init repository", func() {
)
BeforeEach(func() {
startingBlock = GinkgoRandomSeed()
startingBlock = rand.Int63()
vatInitBlock = startingBlock + 1
endingBlock = startingBlock + 2

View File

@ -20,6 +20,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/factories"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
@ -45,8 +46,8 @@ var _ = Describe("Vat init transformer", func() {
converter = vat_init_mocks.MockVatInitConverter{}
repository = vat_init_mocks.MockVatInitRepository{}
fetcher = mocks.MockLogFetcher{}
headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerOne = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
headerTwo = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
transformer = factories.Transformer{
Config: config,
Fetcher: &fetcher,

View File

@ -18,6 +18,7 @@ import (
"database/sql"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"math/rand"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
@ -94,7 +95,7 @@ var _ = Describe("Vat Move", func() {
})
Describe("MissingHeaders", func() {
var eventBlockNumber = GinkgoRandomSeed()
var eventBlockNumber = rand.Int63()
var startingBlockNumber = eventBlockNumber - 1
var endingBlockNumber = eventBlockNumber + 1
var outOfRangeBlockNumber = eventBlockNumber + 2

View File

@ -27,6 +27,7 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks"
vat_move_mocks "github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/mocks/vat_move"
"github.com/vulcanize/vulcanizedb/pkg/transformers/vat_move"
"math/rand"
)
var _ = Describe("Vat move transformer", func() {
@ -42,8 +43,8 @@ var _ = Describe("Vat move transformer", func() {
fetcher = mocks.MockLogFetcher{}
converter = vat_move_mocks.MockVatMoveConverter{}
repository = vat_move_mocks.MockVatMoveRepository{}
headerOne = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerTwo = core.Header{Id: GinkgoRandomSeed(), BlockNumber: GinkgoRandomSeed()}
headerOne = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
headerTwo = core.Header{Id: rand.Int63(), BlockNumber: rand.Int63()}
transformer = factories.Transformer{
Config: config,
Converter: &converter,