-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: implement Dockerized chain initialization in e2e tests (#1330)
Closes: #XXX ## What is the purpose of the change This is a follow-up PR to #1293 and builds upon its work. It is part of the e2e test chain upgrade epic #1235 This PR introduces the ability to run chain initialization in a Docker container by running the following: ``` docker run -v < path >:/tmp/osmo-test osmosis-e2e-chain-init:debug --data-dir=/tmp/osmo-test ``` All chain data is placed at the given `< path >` that is mounted as a volume on the container. In addition, this PR introduces documentation about the current state of the e2e tests. ## Brief change log - [pull chain temp folder creation our of chain to e2e package](c175289) - [create image and makefile steps to initialize chain state](de89119) - [allow for running the upgrade initialization in Docker by providing a data dir](dabb683) - [improve abstractions for chain initialization and add README](cf0d8a3) - improve README ## Testing and Verifying - ran e2e tests locally a few times - `make build-e2e-chain-init` - `make docker-build-e2e-chain-init` - `docker run -v /home/roman/cosmos/osmosis/tmp:/tmp/osmo-test osmosis-e2e-chain-init:debug --data-dir=/tmp/osmo-test` All steps worked as desired ## Documentation and Release Note - Does this pull request introduce a new feature or user-facing behavior changes? no - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no - How is the feature or change documented? improved `tests/e2e/README.md` ## Next Steps The next step is to switch our chain initialization logic in `func (s *IntegrationTestSuite) configureChain(chainId string)` to use Dockertest and the newly introduced container. Then, mount the genesis and configs on the Osmosis containers, against which the e2e tests are executed
- Loading branch information
Showing
7 changed files
with
126 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-chain-init | ||
|
||
## Deploy image | ||
FROM ubuntu | ||
|
||
COPY --from=build /osmosis/build/chain_init /bin/chain_init | ||
|
||
ENV HOME /osmosis | ||
WORKDIR $HOME | ||
|
||
ENTRYPOINT [ "chain_init" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/osmosis-labs/osmosis/v7/tests/e2e/chain" | ||
) | ||
|
||
func main() { | ||
var dataDir string | ||
flag.StringVar(&dataDir, "data-dir", "", "chain data directory") | ||
flag.Parse() | ||
|
||
if len(dataDir) == 0 { | ||
panic("data-dir is required") | ||
} | ||
|
||
if err := os.MkdirAll(dataDir, 0o755); err != nil { | ||
panic(err) | ||
} | ||
|
||
chain, err := chain.Init(chain.ChainAID, dataDir) | ||
if err != nil { | ||
panic(err) | ||
} | ||
fmt.Println(chain) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters