diff --git a/.github/workflows/on-pr.yaml b/.github/workflows/on-pr.yaml index c5777181..6a731bb1 100644 --- a/.github/workflows/on-pr.yaml +++ b/.github/workflows/on-pr.yaml @@ -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 diff --git a/README.md b/README.md index 83566560..1ecf32a4 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/docker-compose.yml b/docker-compose.yml index 160113c3..d8441493 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/test/helper.go b/test/helper.go index ab72b1bf..ac66014a 100644 --- a/test/helper.go +++ b/test/helper.go @@ -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) { diff --git a/test/integration_test.go b/test/integration_test.go index 0b72d507..dea4fe37 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -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())