From de89119bde788b03de15eaef855f40dacb38c780 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 22 Apr 2022 16:12:59 -0400 Subject: [PATCH] create image and makefile steps to initialize chain state --- Makefile | 7 +++++++ tests/e2e/upgrade/init-e2e.Dockerfile | 23 +++++++++++++++++++++++ tests/e2e/upgrade/main.go | 21 +++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 tests/e2e/upgrade/init-e2e.Dockerfile create mode 100644 tests/e2e/upgrade/main.go diff --git a/Makefile b/Makefile index 5be2f5454a9..7cdbd3c31f6 100644 --- a/Makefile +++ b/Makefile @@ -114,6 +114,10 @@ build-contract-tests-hooks: mkdir -p $(BUILDDIR) go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ ./cmd/contract_tests +build-e2e-upgrade: + mkdir -p $(BUILDDIR) + go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ ./tests/e2e/upgrade + go-mod-cache: go.sum @echo "--> Download go modules to local cache" @go mod download @@ -241,6 +245,9 @@ benchmark: docker-build-debug: @docker build -t osmosis:debug --build-arg BASE_IMG_TAG=debug -f Dockerfile . +docker-build-e2e-init: + @docker build -t osmosis-e2e:debug --build-arg BASE_IMG_TAG=debug -f tests/e2e//upgrade/init-e2e.Dockerfile . + ############################################################################### ### Linting ### ############################################################################### diff --git a/tests/e2e/upgrade/init-e2e.Dockerfile b/tests/e2e/upgrade/init-e2e.Dockerfile new file mode 100644 index 00000000000..320445f85a7 --- /dev/null +++ b/tests/e2e/upgrade/init-e2e.Dockerfile @@ -0,0 +1,23 @@ +# syntax=docker/dockerfile:1 + +## Build Image +FROM golang:1.18-bullseye as build + +WORKDIR /osmosis +COPY . /osmosis + +# From https://github.com/CosmWasm/wasmd/blob/master/Dockerfile +# For more details see https://github.com/CosmWasm/wasmvm#builds-of-libwasmvm +ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0-beta7/libwasmvm_muslc.a /lib/libwasmvm_muslc.a +RUN sha256sum /lib/libwasmvm_muslc.a | grep d0152067a5609bfdfb3f0d5d6c0f2760f79d5f2cd7fd8513cafa9932d22eb350 +RUN BUILD_TAGS=muslc make build-e2e-upgrade + +## Deploy image +FROM ubuntu + +COPY --from=build /osmosis/build/upgrade /bin/upgrade + +ENV HOME /osmosis +WORKDIR $HOME + +CMD [ "upgrade" ] diff --git a/tests/e2e/upgrade/main.go b/tests/e2e/upgrade/main.go new file mode 100644 index 00000000000..849647edbdc --- /dev/null +++ b/tests/e2e/upgrade/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + "io/ioutil" + + "github.com/osmosis-labs/osmosis/v7/tests/e2e/chain" +) + +func main() { + tmpDir, err := ioutil.TempDir("", "osmosis-e2e-testnet-") + if err != nil { + panic(err) + } + + chain, err := chain.Init(chain.ChainAID, tmpDir) + if err != nil { + panic(err) + } + fmt.Println(chain) +}