From 2104ccf2f0146871252c6ea8223ad50f3e32e668 Mon Sep 17 00:00:00 2001 From: Sai Kumar <17549398+gsk967@users.noreply.github.com> Date: Wed, 8 Feb 2023 10:38:02 +0530 Subject: [PATCH] test: add experimental e2e tests on docker image (#1771) ## Description closes: #1770 --- ### Author Checklist _All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues._ I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] added appropriate labels to the PR - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist _All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items._ I have... - [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- .github/workflows/tests.yml | 37 ++++++++++++++++++++++++++++++ Makefile | 3 +++ contrib/images/umee.e2e.dockerfile | 16 ++++++------- price-feeder/oracle/client/tx.go | 3 ++- tests/grpc/client/tx/sign.go | 3 ++- x/uibc/msg_test.go | 2 ++ 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 45f7b67db4..e61bbbc2f0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -207,3 +207,40 @@ jobs: if: env.GIT_DIFF run: | EXPERIMENTAL=true make test-unit + + experimental-test-e2e: + runs-on: ubuntu-latest + needs: install-tparse + timeout-minutes: 25 + steps: + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6.1.2 + with: + PATTERNS: | + **/**.go + go.mod + go.sum + - uses: actions/setup-go@v3 + if: env.GIT_DIFF + with: + go-version: 1.19 + cache: true + + # In this step, this action saves a list of existing images, + # the cache is created without them in the post run. + # It also restores the cache if it exists. + - name: cache docker layer + uses: satackey/action-docker-layer-caching@v0.0.11 + if: env.GIT_DIFF + # Ignore the failure of a step and avoid terminating the job. + continue-on-error: true + + - name: Build Docker Image with experimental features + if: env.GIT_DIFF + run: | + DOCKER_BUILDKIT=1 make docker-build-experimental + + - name: Test E2E with experimental features + if: env.GIT_DIFF + run: | + EXPERIMENTAL=true make test-e2e \ No newline at end of file diff --git a/Makefile b/Makefile index d4a3c7fd90..f00ec3f772 100644 --- a/Makefile +++ b/Makefile @@ -124,6 +124,9 @@ clean: docker-build: @docker build -t umee-network/umeed-e2e -f contrib/images/umee.e2e.dockerfile . +docker-build-experimental: + @docker build -t umee-network/umeed-e2e -f contrib/images/umee.e2e.dockerfile --build-arg EXPERIMENTAL=true . + docker-push-hermes: @cd tests/e2e/docker; docker build -t ghcr.io/umee-network/hermes-e2e:latest -f hermes.Dockerfile .; docker push ghcr.io/umee-network/hermes-e2e:latest diff --git a/contrib/images/umee.e2e.dockerfile b/contrib/images/umee.e2e.dockerfile index 8bef97bcb1..b2c9506ed4 100644 --- a/contrib/images/umee.e2e.dockerfile +++ b/contrib/images/umee.e2e.dockerfile @@ -2,12 +2,11 @@ # Creates dynamic binaries, by building from the latest version of: # umeed and release version of peggo -FROM golang:1.19-bullseye AS builder +FROM ghcr.io/umee-network/peggo:latest-1.4 as peggo -## Download Peggo -WORKDIR /src -RUN wget https://github.com/umee-network/peggo/releases/download/v1.4.0/peggo-v1.4.0-linux-amd64.tar.gz && \ - tar -xvf peggo-v* +FROM golang:1.19-bullseye AS builder +ARG EXPERIMENTAL=false +ENV EXPERIMENTAL $EXPERIMENTAL ## Download go module dependencies for umeed WORKDIR /src/umee @@ -22,8 +21,9 @@ RUN go mod download ## Build umeed and price-feeder WORKDIR /src/umee COPY . . -RUN make install && \ - cd price-feeder && make install +RUN if [ "$EXPERIMENTAL" = "true" ] ; then echo "Installing experimental build";else echo "Installing stable build";fi +RUN make install +RUN cd price-feeder && make install ## Prepare the final clear binary FROM ubuntu:rolling @@ -32,5 +32,5 @@ ENTRYPOINT ["umeed", "start"] COPY --from=builder /go/pkg/mod/github.com/\!cosm\!wasm/wasmvm\@v*/internal/api/libwasmvm.*.so /usr/lib/ COPY --from=builder /go/bin/* /usr/local/bin/ -COPY --from=builder /src/peggo-v*/peggo /usr/local/bin/ +COPY --from=peggo /usr/local/bin/peggo /usr/local/bin/peggo RUN apt-get update && apt-get install ca-certificates -y diff --git a/price-feeder/oracle/client/tx.go b/price-feeder/oracle/client/tx.go index 43c5f5915b..3f49db777e 100644 --- a/price-feeder/oracle/client/tx.go +++ b/price-feeder/oracle/client/tx.go @@ -24,7 +24,8 @@ func BroadcastTx(clientCtx client.Context, txf tx.Factory, msgs ...sdk.Msg) (*sd return nil, err } - txf = txf.WithGas(adjusted) + // make sure gas in enough to execute the txs + txf = txf.WithGas(adjusted * 3 / 2) unsignedTx, err := txf.BuildUnsignedTx(msgs...) if err != nil { diff --git a/tests/grpc/client/tx/sign.go b/tests/grpc/client/tx/sign.go index 863ae6d7da..7a49289988 100644 --- a/tests/grpc/client/tx/sign.go +++ b/tests/grpc/client/tx/sign.go @@ -24,7 +24,8 @@ func BroadcastTx(clientCtx client.Context, txf tx.Factory, msgs ...sdk.Msg) (*sd return nil, err } - txf = txf.WithGas(adjusted) + // make sure gas in enough to execute the txs + txf = txf.WithGas(adjusted * 3 / 2) unsignedTx, err := txf.BuildUnsignedTx(msgs...) if err != nil { diff --git a/x/uibc/msg_test.go b/x/uibc/msg_test.go index dd2d07ef1f..a522e3b670 100644 --- a/x/uibc/msg_test.go +++ b/x/uibc/msg_test.go @@ -23,6 +23,7 @@ func validMsgGovUpdateQuota() MsgGovUpdateQuota { } func TestMsgGovUpdateQuota(t *testing.T) { + t.Parallel() validMsg := validMsgGovUpdateQuota() invalidAuthority := validMsg @@ -74,6 +75,7 @@ func validMsgGovSetIBCPause() MsgGovSetIBCPause { } func TestMsgGovSetIBCPause(t *testing.T) { + t.Parallel() validMsg := validMsgGovSetIBCPause() invalidAuthority := validMsg