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

feat: e2e test suite #1253

Merged
merged 31 commits into from
Mar 11, 2022
Merged

feat: e2e test suite #1253

merged 31 commits into from
Mar 11, 2022

Conversation

alexanderbez
Copy link
Contributor

This PR sets up the scaffolding of a full E2E test suite. It includes:

  • Starting two independent Gaia networks
  • Connecting them via IBC
  • Utility functions to send funds over IBC

@codecov
Copy link

codecov bot commented Feb 10, 2022

Codecov Report

Merging #1253 (aa18878) into main (066ce7a) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1253   +/-   ##
=======================================
  Coverage   12.78%   12.78%           
=======================================
  Files           9        9           
  Lines        1259     1259           
=======================================
  Hits          161      161           
  Misses       1092     1092           
  Partials        6        6           

@alexanderbez
Copy link
Contributor Author

alexanderbez commented Feb 11, 2022

@yaruwangway this is almost ready to test. The two missing pieces are:

  1. Build and push the Hermes docker image
  2. Build and push the Gaia docker image

I can do these, but I would (A) need to know what our docker org is and (B) have access to push to it.

@okwme
Copy link
Contributor

okwme commented Feb 16, 2022

@alexanderbez we've been reliant on Tendermint's Docker org til now. Is it possible to use the Github Container Registry for the Cosmos org?

tests/e2e/e2e_setup_test.go Outdated Show resolved Hide resolved
@alexanderbez
Copy link
Contributor Author

@yaruwangway do you think you could help me resolve the CI issues?

@alexanderbez
Copy link
Contributor Author

I need to make one small tweak :)

@tokamak-git
Copy link
Contributor

Hey bez, let me know if I can help out with the CI issues...

@alexanderbez
Copy link
Contributor Author

All that needs to happen now is that we need to build and push the hermes Docker file to our dockerhub. Currently, I have it named cosmos/hermes-e2e.

@tokamak-git
Copy link
Contributor

Ok sure, Ill pick that up first thing in the morning tomorrow.

@yaruwangway
Copy link
Contributor

@yaruwangway do you think you could help me resolve the CI issues?

Hi @alexanderbez , I am not good at this, but I can have a look!

@pratikbin
Copy link
Contributor

pratikbin commented Mar 4, 2022

Can I ask you something
- Why are you using debian:buster-slim and coping hermes?
- Dockerfile name convention SHOULD be Dockerfile or Dockerfile.<name>

# Compile the gaiad binary
FROM golang:1.17-alpine AS gaiad-builder
WORKDIR /src/app/
COPY go.mod go.sum* ./
Copy link
Contributor

Choose a reason for hiding this comment

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

hey bez, do you think it would make sense to have a single copy for all the files? just to clean the dockerfile?

Copy link
Contributor

Choose a reason for hiding this comment

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

It certainly works, but it would be cache inefficient. This is cache efficient.

RUN CGO_ENABLED=0 make install

# Add to a distroless container
FROM gcr.io/distroless/cc:$IMG_TAG
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure the purpose of the distroless continer? could we use a standard scratch container image here?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can use scratch actually, but then we have to manually add certificates and all like this

FROM alpine as certs
RUN apk add ca-certificates --no-cache
...
FROM scratch
COPY --from=certs /etc/ssl/certs/ /etc/ssl/certs/
...

So I would suggest to use gcr.io/distroless/static since we are CGO_ENABLED=0


benchmark:
@go test -mod=readonly -bench=. ./...
docker-build-debug:
Copy link
Contributor

Choose a reason for hiding this comment

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

hey, whats the purpose of this docker build?

)

const (
keyringPassphrase = "testpassphrase"
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we configure injeccting these via env vars? could help in automation of testing down the line for different senarios. what do you think?

@@ -0,0 +1,12 @@
FROM informalsystems/hermes:0.12.0 AS hermes-builder
Copy link
Contributor

Choose a reason for hiding this comment

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

guess it would make sense to pass the hermies version via a config/env just so that we can use different published images. wdyt?

sdk "github.com/cosmos/cosmos-sdk/types"
)

func (s *IntegrationTestSuite) TestIBCTokenTransfer() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall I add a description so as to add context for noobes?

}

func queryGaiaTx(endpoint, txHash string) error {
resp, err := http.Get(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/%s", endpoint, txHash))
Copy link
Contributor

Choose a reason for hiding this comment

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

A question really, should we interact with the chains over somthing other than rest?
essentially seeing as not all types of query/commands are available via rest, maybe rpc/grpc is a better approach in this case?

genFile := config.GenesisFile()
doc := &tmtypes.GenesisDoc{}

if _, err := os.Stat(genFile); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we modify this to use ioutils.ReadAll just so as to reduce a few lines of code?

touch /root/.hermes/config.toml

# setup Hermes relayer configuration
tee /root/.hermes/config.toml <<EOF
Copy link
Contributor

Choose a reason for hiding this comment

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

any thoughts of making copying this as a file from our repository? like a test/hermies_config.toml for example?

gaia "github.com/cosmos/gaia/v6/app"
)

type validator struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Im not sure, but do you think we can reuse the validator type from the sdk?

Copy link
Contributor

@tokamak-git tokamak-git left a comment

Choose a reason for hiding this comment

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

LGTM

@tokamak-git
Copy link
Contributor

@alexanderbez checked the link that is reported as broken, looks to be working now. Guess all we need to do is to rerun the actions associated with the pr.

@okwme
Copy link
Contributor

okwme commented Mar 9, 2022

@tokamak-git started re-running the link checker job. @alexanderbez your final "build and push the hermes docker", this is completed?

@okwme
Copy link
Contributor

okwme commented Mar 9, 2022

looks like we're having some docker issues @tokamak-git :

e2e_setup_test.go:56
        	Error:      	Received unexpected error:
        	            	API error (404): pull access denied for cosmos/hermes-e2e, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

i dont' see anything here: https://github.com/cosmos/hermes-e2e
is that where it's supposed to be now?

@alexanderbez
Copy link
Contributor Author

I had to make the hermes-e2e package public. Rerunning the test suite....

@alexanderbez
Copy link
Contributor Author

Also had to fix the repo name to ghcr.io/cosmos/hermes-e2e.

@alexanderbez alexanderbez merged commit d6f7b57 into main Mar 11, 2022
@alexanderbez alexanderbez deleted the bez/e2e-test-setup branch March 11, 2022 21:09
@chatton chatton mentioned this pull request Jun 27, 2022
33 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants