Skip to content

Commit

Permalink
tests: update hermes images and setup (#2841)
Browse files Browse the repository at this point in the history
* tests: update hermes images and setup

* fix makefile hermes build

* scripts: update hermes bootstrap scripts
  • Loading branch information
MSalopek authored Dec 8, 2023
1 parent ff8acab commit d0a672a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/docker/hermes.Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
65 changes: 33 additions & 32 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"math/rand"
"net/http"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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),
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/scripts/hermes1_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/scripts/hermes_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down

0 comments on commit d0a672a

Please sign in to comment.