From d0a672ae7d9e492084c71b8f8086eefed67e4767 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Fri, 8 Dec 2023 15:40:40 +0100 Subject: [PATCH] tests: update hermes images and setup (#2841) * tests: update hermes images and setup * fix makefile hermes build * scripts: update hermes bootstrap scripts --- Makefile | 2 +- tests/e2e/docker/hermes.Dockerfile | 4 +- tests/e2e/e2e_setup_test.go | 65 +++++++++++++------------- tests/e2e/scripts/hermes1_bootstrap.sh | 8 ++-- tests/e2e/scripts/hermes_bootstrap.sh | 4 +- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index a85756b2e71..b77454f0603 100644 --- a/Makefile +++ b/Makefile @@ -234,7 +234,7 @@ docker-build-debug: # TODO: Push this to the Cosmos Dockerhub so we don't have to keep building it # in CI. docker-build-hermes: - @cd tests/e2e/docker; docker build -t ghcr.io/cosmos/hermes-e2e:1.4.1 -f hermes.Dockerfile . + @cd tests/e2e/docker; docker build -t ghcr.io/cosmos/hermes-e2e:1.0.0 -f hermes.Dockerfile . docker-build-all: docker-build-debug docker-build-hermes diff --git a/tests/e2e/docker/hermes.Dockerfile b/tests/e2e/docker/hermes.Dockerfile index 81d675079f8..97176a7d37b 100644 --- a/tests/e2e/docker/hermes.Dockerfile +++ b/tests/e2e/docker/hermes.Dockerfile @@ -1,6 +1,6 @@ -FROM --platform=linux/amd64 informalsystems/hermes:1.4.1 AS hermes-builder +FROM --platform=linux/amd64 informalsystems/hermes:v1.7.3 AS hermes-builder -FROM debian:buster-slim +FROM --platform=linux/amd64 debian:buster-slim USER root COPY --from=hermes-builder /usr/bin/hermes /usr/local/bin/ diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 9aa1ef43de7..992526387fa 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -4,7 +4,9 @@ import ( "context" "encoding/json" "fmt" + "io" "math/rand" + "net/http" "os" "os/exec" "path" @@ -641,7 +643,7 @@ func (s *IntegrationTestSuite) runIBCRelayer0() { &dockertest.RunOptions{ Name: fmt.Sprintf("%s-%s-relayer-0", s.chainA.id, s.chainB.id), Repository: "ghcr.io/cosmos/hermes-e2e", - Tag: "1.4.1", + Tag: "1.0.0", NetworkID: s.dkrNet.Network.ID, Mounts: []string{ fmt.Sprintf("%s/:/root/hermes", hermesCfgPath), @@ -669,36 +671,35 @@ func (s *IntegrationTestSuite) runIBCRelayer0() { noRestart, ) s.Require().NoError(err) - // TODO: fix Hermes container REST endpoint - // endpoint := fmt.Sprintf("http://%s/state", s.hermesResource0.GetHostPort("3031/tcp")) - // s.Require().Eventually( - // func() bool { - // resp, err := http.Get(endpoint) //nolint:gosec // this is a test - // if err != nil { - // return false - // } - - // defer resp.Body.Close() - - // bz, err := io.ReadAll(resp.Body) - // if err != nil { - // return false - // } - - // var respBody map[string]interface{} - // if err := json.Unmarshal(bz, &respBody); err != nil { - // return false - // } - - // status := respBody["status"].(string) - // result := respBody["result"].(map[string]interface{}) - - // return status == "success" && len(result["chains"].([]interface{})) == 2 - // }, - // 5*time.Minute, - // time.Second, - // "hermes relayer not healthy", - // ) + endpoint := fmt.Sprintf("http://%s/state", s.hermesResource0.GetHostPort("3031/tcp")) + s.Require().Eventually( + func() bool { + resp, err := http.Get(endpoint) //nolint:gosec // this is a test + if err != nil { + return false + } + + defer resp.Body.Close() + + bz, err := io.ReadAll(resp.Body) + if err != nil { + return false + } + + var respBody map[string]interface{} + if err := json.Unmarshal(bz, &respBody); err != nil { + return false + } + + status := respBody["status"].(string) + result := respBody["result"].(map[string]interface{}) + + return status == "success" && len(result["chains"].([]interface{})) == 2 + }, + 5*time.Minute, + time.Second, + "hermes relayer not healthy", + ) s.T().Logf("started Hermes relayer 0 container: %s", s.hermesResource0.Container.ID) @@ -741,7 +742,7 @@ func (s *IntegrationTestSuite) runIBCRelayer1() { &dockertest.RunOptions{ Name: fmt.Sprintf("%s-%s-relayer-1", s.chainA.id, s.chainB.id), Repository: "ghcr.io/cosmos/hermes-e2e", - Tag: "1.4.1", + Tag: "1.0.0", NetworkID: s.dkrNet.Network.ID, Mounts: []string{ fmt.Sprintf("%s/:/root/hermes", hermesCfgPath), diff --git a/tests/e2e/scripts/hermes1_bootstrap.sh b/tests/e2e/scripts/hermes1_bootstrap.sh index 049c61b8ad4..8d572e0a2d3 100755 --- a/tests/e2e/scripts/hermes1_bootstrap.sh +++ b/tests/e2e/scripts/hermes1_bootstrap.sh @@ -47,7 +47,7 @@ port = 3002 id = '$GAIA_A_E2E_CHAIN_ID' rpc_addr = 'http://$GAIA_A_E2E_VAL_HOST:26657' grpc_addr = 'http://$GAIA_A_E2E_VAL_HOST:9090' -websocket_addr = 'ws://$GAIA_A_E2E_VAL_HOST:26657/websocket' +event_source = { mode = "push", url = "ws://$GAIA_A_E2E_VAL_HOST:26657/websocket", batch_delay = "50ms" } rpc_timeout = '10s' account_prefix = 'cosmos' key_name = 'rly01-gaia-a' @@ -63,7 +63,7 @@ trust_threshold = { numerator = '1', denominator = '3' } id = '$GAIA_B_E2E_CHAIN_ID' rpc_addr = 'http://$GAIA_B_E2E_VAL_HOST:26657' grpc_addr = 'http://$GAIA_B_E2E_VAL_HOST:9090' -websocket_addr = 'ws://$GAIA_B_E2E_VAL_HOST:26657/websocket' +event_source = { mode = "push", url = "ws://$GAIA_B_E2E_VAL_HOST:26657/websocket", batch_delay = "50ms" } rpc_timeout = '10s' account_prefix = 'cosmos' key_name = 'rly01-gaia-b' @@ -114,7 +114,7 @@ port = 3002 id = '$GAIA_A_E2E_CHAIN_ID' rpc_addr = 'http://$GAIA_A_E2E_VAL_HOST:26657' grpc_addr = 'http://$GAIA_A_E2E_VAL_HOST:9090' -websocket_addr = 'ws://$GAIA_A_E2E_VAL_HOST:26657/websocket' +event_source = { mode = "push", url = "ws://$GAIA_A_E2E_VAL_HOST:26657/websocket", batch_delay = "50ms" } rpc_timeout = '10s' account_prefix = 'cosmos' key_name = 'rly01-gaia-a' @@ -130,7 +130,7 @@ trust_threshold = { numerator = '1', denominator = '3' } id = '$GAIA_B_E2E_CHAIN_ID' rpc_addr = 'http://$GAIA_B_E2E_VAL_HOST:26657' grpc_addr = 'http://$GAIA_B_E2E_VAL_HOST:9090' -websocket_addr = 'ws://$GAIA_B_E2E_VAL_HOST:26657/websocket' +event_source = { mode = "push", url = "ws://$GAIA_B_E2E_VAL_HOST:26657/websocket", batch_delay = "50ms" } rpc_timeout = '10s' account_prefix = 'cosmos' key_name = 'rly01-gaia-b' diff --git a/tests/e2e/scripts/hermes_bootstrap.sh b/tests/e2e/scripts/hermes_bootstrap.sh index cc360b759bf..8c0db498623 100755 --- a/tests/e2e/scripts/hermes_bootstrap.sh +++ b/tests/e2e/scripts/hermes_bootstrap.sh @@ -47,7 +47,7 @@ port = 3001 id = '$GAIA_A_E2E_CHAIN_ID' rpc_addr = 'http://$GAIA_A_E2E_VAL_HOST:26657' grpc_addr = 'http://$GAIA_A_E2E_VAL_HOST:9090' -websocket_addr = 'ws://$GAIA_A_E2E_VAL_HOST:26657/websocket' +event_source = { mode = "push", url = "ws://$GAIA_A_E2E_VAL_HOST:26657/websocket", batch_delay = "50ms" } rpc_timeout = '10s' account_prefix = 'cosmos' key_name = 'rly01-gaia-a' @@ -63,7 +63,7 @@ trust_threshold = { numerator = '1', denominator = '3' } id = '$GAIA_B_E2E_CHAIN_ID' rpc_addr = 'http://$GAIA_B_E2E_VAL_HOST:26657' grpc_addr = 'http://$GAIA_B_E2E_VAL_HOST:9090' -websocket_addr = 'ws://$GAIA_B_E2E_VAL_HOST:26657/websocket' +event_source = { mode = "push", url = "ws://$GAIA_B_E2E_VAL_HOST:26657/websocket", batch_delay = "50ms" } rpc_timeout = '10s' account_prefix = 'cosmos' key_name = 'rly01-gaia-b'