Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: update hermes images and setup #2841

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give a sentence of context for the change in the minor version numbers? LGTM apart from that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a helper image, we just put hermes used in e2e tests inside it:

The cosmos/hermes-e2e does not have anything to do with hermes versions, so changing it was not required. It is supposed to be exactly 1.0.0 because that's the latest available image.


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
Loading