From f3c247b54b84f850402da1a3a70f9b8137db5d4f Mon Sep 17 00:00:00 2001 From: i-norden Date: Wed, 29 Dec 2021 15:20:12 -0600 Subject: [PATCH] fix test conditional skip --- .github/workflows/on-pr.yaml | 2 +- test/direct_proxy_integration_test.go | 27 ++++++++++++++++++++++++--- test/integration_test.go | 27 ++++++++++++++++++++++++--- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/.github/workflows/on-pr.yaml b/.github/workflows/on-pr.yaml index da3c92b9..5f889365 100644 --- a/.github/workflows/on-pr.yaml +++ b/.github/workflows/on-pr.yaml @@ -62,7 +62,7 @@ jobs: make integrationtest integrationtest_forwardethcalls: - name: Run integration tests + name: Run integration tests for direct proxy fall-through of eth_calls env: GOPATH: /tmp/go DB_WRITE: false diff --git a/test/direct_proxy_integration_test.go b/test/direct_proxy_integration_test.go index fb653c9b..7e6a075a 100644 --- a/test/direct_proxy_integration_test.go +++ b/test/direct_proxy_integration_test.go @@ -20,9 +20,6 @@ import ( var _ = Describe("Integration test", func() { directProxyEthCalls, err := strconv.ParseBool(os.Getenv("ETH_FORWARD_ETH_CALLS")) Expect(err).To(BeNil()) - if !directProxyEthCalls { - Skip("skipping direct-proxy-forwarding integration tests") - } gethHttpPath := "http://127.0.0.1:8545" gethClient, err := ethclient.Dial(gethHttpPath) Expect(err).ToNot(HaveOccurred()) @@ -43,6 +40,9 @@ var _ = Describe("Integration test", func() { Describe("get Block", func() { BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -94,6 +94,9 @@ var _ = Describe("Integration test", func() { Describe("Transaction", func() { BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -119,6 +122,9 @@ var _ = Describe("Integration test", func() { Describe("Receipt", func() { BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -136,6 +142,9 @@ var _ = Describe("Integration test", func() { Describe("FilterLogs", func() { BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -160,6 +169,9 @@ var _ = Describe("Integration test", func() { Describe("CodeAt", func() { BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -207,6 +219,9 @@ var _ = Describe("Integration test", func() { Describe("Get balance", func() { address := "0x1111111111111111111111111111111111111112" BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } tx, txErr = integration.SendEth(address, "0.01") time.Sleep(sleepInterval) }) @@ -270,6 +285,9 @@ var _ = Describe("Integration test", func() { Describe("Get Storage", func() { BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() erc20TotalSupply, bigIntResult = new(big.Int).SetString("1000000000000000000000", 10) @@ -383,6 +401,9 @@ var _ = Describe("Integration test", func() { Describe("eth call", func() { BeforeEach(func() { + if !directProxyEthCalls { + Skip("skipping direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() erc20TotalSupply, bigIntResult = new(big.Int).SetString("1000000000000000000000", 10) diff --git a/test/integration_test.go b/test/integration_test.go index 5a6f1ab6..2c19815a 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -31,9 +31,6 @@ var ( var _ = Describe("Integration test", func() { directProxyEthCalls, err := strconv.ParseBool(os.Getenv("ETH_FORWARD_ETH_CALLS")) Expect(err).To(BeNil()) - if directProxyEthCalls { - Skip("skipping no-direct-proxy-forwarding integration tests") - } gethHttpPath := "http://127.0.0.1:8545" gethClient, err := ethclient.Dial(gethHttpPath) Expect(err).ToNot(HaveOccurred()) @@ -54,6 +51,9 @@ var _ = Describe("Integration test", func() { Describe("get Block", func() { BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -123,6 +123,9 @@ var _ = Describe("Integration test", func() { Describe("Transaction", func() { BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -154,6 +157,9 @@ var _ = Describe("Integration test", func() { Describe("Receipt", func() { BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -181,6 +187,9 @@ var _ = Describe("Integration test", func() { Describe("FilterLogs", func() { BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -211,6 +220,9 @@ var _ = Describe("Integration test", func() { Describe("CodeAt", func() { BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() time.Sleep(sleepInterval) }) @@ -258,6 +270,9 @@ var _ = Describe("Integration test", func() { Describe("Get balance", func() { address := "0x1111111111111111111111111111111111111112" BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } tx, txErr = integration.SendEth(address, "0.01") time.Sleep(sleepInterval) }) @@ -321,6 +336,9 @@ var _ = Describe("Integration test", func() { Describe("Get Storage", func() { BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() erc20TotalSupply, bigIntResult = new(big.Int).SetString("1000000000000000000000", 10) @@ -434,6 +452,9 @@ var _ = Describe("Integration test", func() { Describe("eth call", func() { BeforeEach(func() { + if directProxyEthCalls { + Skip("skipping no-direct-proxy-forwarding integration tests") + } contract, contractErr = integration.DeployContract() erc20TotalSupply, bigIntResult = new(big.Int).SetString("1000000000000000000000", 10)