fix race conditions in tests, call contract service instead of hardcoded values
This commit is contained in:
parent
7d88e78fa8
commit
9d590e15bc
3
.github/workflows/on-pr.yaml
vendored
3
.github/workflows/on-pr.yaml
vendored
@ -55,5 +55,6 @@ jobs:
|
||||
run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d db dapptools contract eth-server
|
||||
- name: Test
|
||||
run: |
|
||||
sleep 10
|
||||
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
||||
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
||||
make integrationtest
|
||||
|
@ -135,9 +135,9 @@ TODO: Add the rest of the standard endpoints and unique endpoints (e.g. getSlice
|
||||
| `eth-server-graphql` | `ETH_SERVER_GRAPHQL` | false | If `true` enable Eth GraphQL Server |
|
||||
| `eth-server-graphql-path` | `ETH_SERVER_GRAPHQLPATH` | | If `eth-server-graphql` set to true, endpoint url for graphql server (host:port) |
|
||||
| `eth-server-http` | `ETH_SERVER_HTTP` | true | If `true` enable Eth HTTP JSON-RPC Server |
|
||||
| `eth-server-http-path` | `ETH_SERVER_HTTP_PATH` | | If `eth-server-http` set to `true`, endpoint url for Eth HTTP JSON-RPC server (host:port) |
|
||||
| `eth-server-http-path` | `ETH_SERVER_HTTPPATH` | | If `eth-server-http` set to `true`, endpoint url for Eth HTTP JSON-RPC server (host:port) |
|
||||
| `eth-server-ws` | `ETH_SERVER_WS` | false | If `true` enable Eth WS JSON-RPC Server |
|
||||
| `eth-server-ws-path` | `ETH_SERVER_WS_PATH` | | If `eth-server-ws` set to `true`, endpoint url for Eth WS JSON-RPC server (host:port) |
|
||||
| `eth-server-ws-path` | `ETH_SERVER_WSPATH` | | If `eth-server-ws` set to `true`, endpoint url for Eth WS JSON-RPC server (host:port) |
|
||||
| `eth-server-ipc` | `ETH_SERVER_IPC` | false | If `true` enable Eth IPC JSON-RPC Server |
|
||||
| `eth-server-ipc-path` | `ETH_SERVER_IPC_PATH` | | If `eth-server-ws` set to `true`, path for Eth IPC JSON-RPC server |
|
||||
| `ipld-server-graphql` | `IPLD_SERVER_GRAPHQL` | false | If `true` enable IPLD GraphQL Server |
|
||||
|
@ -52,6 +52,7 @@ services:
|
||||
environment:
|
||||
IPLD_SERVER_GRAPHQL: "true"
|
||||
IPLD_POSTGRAPHILEPATH: http://graphql:5000
|
||||
ETH_SERVER_HTTPPATH: 0.0.0.0:8081
|
||||
VDB_COMMAND: "serve"
|
||||
DATABASE_NAME: "vulcanize_public"
|
||||
DATABASE_HOSTNAME: "db"
|
||||
@ -59,7 +60,7 @@ services:
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_PASSWORD: "password"
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
- "127.0.0.1:8081:8081"
|
||||
|
||||
graphql:
|
||||
restart: unless-stopped
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
)
|
||||
|
||||
type ContractDeployed struct {
|
||||
Address string
|
||||
TransactionHash string
|
||||
BlockNumber int
|
||||
BlockHash string
|
||||
Address string `json:"address"`
|
||||
TransactionHash string `json:"txHash"`
|
||||
BlockNumber int `json:"blockNumber"`
|
||||
BlockHash string `json:"blockHash"`
|
||||
}
|
||||
|
||||
func DeployContract() (*ContractDeployed, error) {
|
||||
|
@ -102,14 +102,15 @@ var _ = Describe("Integration test", func() {
|
||||
})
|
||||
|
||||
Describe("Transaction", func() {
|
||||
txHash := "0xdb3d5ef2d4e3260e1b8c1bcbb09b2d8fe7a6423196a20b8a3fa6c09dd9d79073"
|
||||
blockHash := "0xb821ca79bd37174368073e469db92ead75148a95f7c24c49f2435fb7c7797588"
|
||||
contract, contractErr = integration.DeployContract()
|
||||
|
||||
It("Get tx by hash", func() {
|
||||
gethTx, _, err := gethClient.TransactionByHash(ctx, common.HexToHash(txHash))
|
||||
Expect(contractErr).ToNot(HaveOccurred())
|
||||
|
||||
gethTx, _, err := gethClient.TransactionByHash(ctx, common.HexToHash(contract.TransactionHash))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
ipldTx, _, err := ipldClient.TransactionByHash(ctx, common.HexToHash(txHash))
|
||||
ipldTx, _, err := ipldClient.TransactionByHash(ctx, common.HexToHash(contract.TransactionHash))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(gethTx).To(Equal(ipldTx))
|
||||
@ -118,27 +119,28 @@ var _ = Describe("Integration test", func() {
|
||||
})
|
||||
|
||||
It("Get tx by block hash and index", func() {
|
||||
gethTx, err := gethClient.TransactionInBlock(ctx, common.HexToHash(blockHash), 0)
|
||||
gethTx, err := gethClient.TransactionInBlock(ctx, common.HexToHash(contract.BlockHash), 0)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
ipldTx, err := ipldClient.TransactionInBlock(ctx, common.HexToHash(blockHash), 0)
|
||||
ipldTx, err := ipldClient.TransactionInBlock(ctx, common.HexToHash(contract.BlockHash), 0)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(gethTx).To(Equal(ipldTx))
|
||||
|
||||
Expect(gethTx.Hash()).To(Equal(ipldTx.Hash()))
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Describe("Receipt", func() {
|
||||
txHash := "0xdb3d5ef2d4e3260e1b8c1bcbb09b2d8fe7a6423196a20b8a3fa6c09dd9d79073"
|
||||
contract, contractErr = integration.DeployContract()
|
||||
|
||||
It("Get tx receipt", func() {
|
||||
gethReceipt, err := gethClient.TransactionReceipt(ctx, common.HexToHash(txHash))
|
||||
Expect(contractErr).ToNot(HaveOccurred())
|
||||
|
||||
gethReceipt, err := gethClient.TransactionReceipt(ctx, common.HexToHash(contract.TransactionHash))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
ipldReceipt, err := ipldClient.TransactionReceipt(ctx, common.HexToHash(txHash))
|
||||
ipldReceipt, err := ipldClient.TransactionReceipt(ctx, common.HexToHash(contract.TransactionHash))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(gethReceipt).To(Equal(ipldReceipt))
|
||||
@ -154,13 +156,12 @@ var _ = Describe("Integration test", func() {
|
||||
})
|
||||
|
||||
Describe("FilterLogs", func() {
|
||||
//txHash := "0xdb3d5ef2d4e3260e1b8c1bcbb09b2d8fe7a6423196a20b8a3fa6c09dd9d79073"
|
||||
//blockHash := "0xb821ca79bd37174368073e469db92ead75148a95f7c24c49f2435fb7c7797588"
|
||||
blockHash := common.HexToHash(
|
||||
"0xb821ca79bd37174368073e469db92ead75148a95f7c24c49f2435fb7c7797588",
|
||||
)
|
||||
contract, contractErr = integration.DeployContract()
|
||||
|
||||
It("with blockhash", func() {
|
||||
Expect(contractErr).ToNot(HaveOccurred())
|
||||
|
||||
blockHash := common.HexToHash(contract.BlockHash)
|
||||
filterQuery := ethereum.FilterQuery{
|
||||
//Addresses: addresses,
|
||||
BlockHash: &blockHash,
|
||||
@ -195,7 +196,7 @@ var _ = Describe("Integration test", func() {
|
||||
})
|
||||
|
||||
Describe("Chain ID", func() {
|
||||
FIt("Check chain id", func() {
|
||||
It("Check chain id", func() {
|
||||
gethChainId, err := gethClient.ChainID(ctx)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user