try to fix flake

This commit is contained in:
Roy Crihfield 2023-05-28 19:01:14 +08:00
parent 2d038eff86
commit 911b0ed5f3
2 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"math/big" "math/big"
"math/rand" "math/rand"
"time"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -26,8 +25,6 @@ var (
erc20TotalSupply, _ = new(big.Int).SetString("1000000000000000000000", 10) erc20TotalSupply, _ = new(big.Int).SetString("1000000000000000000000", 10)
ercTotalSupplyIndex = common.HexToHash("0x2") ercTotalSupplyIndex = common.HexToHash("0x2")
delayInterval = time.Second * 1
) )
var _ = Describe("Basic integration test", func() { var _ = Describe("Basic integration test", func() {
@ -43,7 +40,8 @@ var _ = Describe("Basic integration test", func() {
contract, contractErr = integration.DeployContract() contract, contractErr = integration.DeployContract()
Expect(contractErr).ToNot(HaveOccurred()) Expect(contractErr).ToNot(HaveOccurred())
time.Sleep(delayInterval) err := waitForBlock(ctx, ipldClient, contract.BlockNumber)
Expect(err).ToNot(HaveOccurred())
}) })
It("get not existing block by number", func() { It("get not existing block by number", func() {
@ -298,6 +296,9 @@ var _ = Describe("Basic integration test", func() {
Expect(contract.BlockNumber).ToNot(BeZero()) Expect(contract.BlockNumber).ToNot(BeZero())
contractSalt = common.Bytes2Hex(contract.BlockHash[:10]) contractSalt = common.Bytes2Hex(contract.BlockHash[:10])
err := waitForBlock(ctx, ipldClient, contract.BlockNumber)
Expect(err).ToNot(HaveOccurred())
}) })
It("gets ERC20 total supply (with block number)", func() { It("gets ERC20 total supply (with block number)", func() {

View File

@ -22,6 +22,7 @@ func waitForBlock(ctx context.Context, client *ethclient.Client, target int64) e
if uint64(target) <= latest { if uint64(target) <= latest {
return nil return nil
} }
time.Sleep(time.Second)
} }
} }