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

test: switch e2e test setup to create genesis and configs via Dockertest #1363

Merged
merged 20 commits into from
Apr 28, 2022

Conversation

czarcas7ic
Copy link
Member

@czarcas7ic czarcas7ic commented Apr 27, 2022

Closes: #1332

What is the purpose of the change

This pull request utilizes the modularized e2e framework created by @p0mvn and makes it now possible to create a genesis and configuration based off a prior osmosis version. This is a required step in order to automate upgrade testing. Additionally, this PR was done in conjunction with @p0mvn.

Brief change log

  • Creation of ChainMeta and internalChain structs
  • Creation of export.go to assist in json unmarshalling
  • Using Dockertest, serialize data in a docker container and feed this data back into the e2e test framework
  • Retain config folder created by init docker image to be used as a volume in the upgrade docker container
  • Add build step for new docker image through make docker-build-e2e-chain-init

Testing and Verifying

This change is covered by the e2e test already implemented in this repository. This was also tested locally and continues to pass.

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? yes
  • How is the feature or change documented? not documented

@czarcas7ic czarcas7ic changed the title test: switch e2e test setup to creating genesis and configs via Dockertest test: switch e2e test setup to create genesis and configs via Dockertest Apr 27, 2022
Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

Awesome work on this @czarcas7ic ! Left some comments, please take a look

tests/e2e/e2e_setup_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_setup_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_setup_test.go Outdated Show resolved Hide resolved
tests/e2e/chain/chain.go Outdated Show resolved Hide resolved
tests/e2e/chain/chain.go Show resolved Hide resolved
tests/e2e/chain_init/main.go Outdated Show resolved Hide resolved
tests/e2e/e2e_setup_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_setup_test.go Outdated Show resolved Hide resolved
czarcas7ic and others added 5 commits April 28, 2022 09:49
Co-authored-by: Roman <roman@osmosis.team>
Co-authored-by: Roman <roman@osmosis.team>
Co-authored-by: Roman <roman@osmosis.team>
Co-authored-by: Roman <roman@osmosis.team>
@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2022

Codecov Report

Merging #1363 (36e4933) into main (66ebf33) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1363   +/-   ##
=======================================
  Coverage   19.53%   19.53%           
=======================================
  Files         200      200           
  Lines       27532    27532           
=======================================
  Hits         5377     5377           
  Misses      21153    21153           
  Partials     1002     1002           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66ebf33...36e4933. Read the comment docs.

Copy link
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

LGTM

tests/e2e/e2e_setup_test.go Show resolved Hide resolved
Comment on lines 166 to +168
// generate genesis txs
genTxs := make([]json.RawMessage, len(c.Validators))
for i, val := range c.Validators {
genTxs := make([]json.RawMessage, len(c.validators))
for i, val := range c.validators {
Copy link
Member

Choose a reason for hiding this comment

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

Not relevant to this PR, but I think we should extract this into a separate function, and add some more docs on whats going on with stakeAmountCoin, its non-obvious to me

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I believe this is just adding the initial self-bond amount to each validator IIRC.

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Excellent work @czarcas7ic

Comment on lines 166 to +168
// generate genesis txs
genTxs := make([]json.RawMessage, len(c.Validators))
for i, val := range c.Validators {
genTxs := make([]json.RawMessage, len(c.validators))
for i, val := range c.validators {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I believe this is just adding the initial self-bond amount to each validator IIRC.

@@ -0,0 +1,25 @@
package chain
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a doc.go on this package, export? What is it's purpose/intended use-case?

Copy link
Member Author

@czarcas7ic czarcas7ic Apr 28, 2022

Choose a reason for hiding this comment

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

We marshal the data into a json within the docker container in order to later retrieve this data by the e2e test suite. When I initually tried to unmarshal this data however, I ran into an issue where the marshaler did not know how to handle some sdk structs that dont get exported. @p0mvn created this export package in order to export only the required structs needed to initialize the genesis and configs in order to get around this issue.

Copy link
Member

Choose a reason for hiding this comment

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

There is a README explaining what this package is for:
https://github.com/osmosis-labs/osmosis/blob/main/tests/e2e/README.md

@czarcas7ic could you check if README needs to be updated after this PR please

Copy link
Member

Choose a reason for hiding this comment

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

We can probably add to it by saying that the e2e test runner now does chain initialization in the container by default.

Other updates I noticed:

  • there is no upgrade package anymore, it was renamed earlier
  • state marshaling and unmarshaling on the volume

tests/e2e/chain_init/main.go Outdated Show resolved Hide resolved
tests/e2e/e2e_setup_test.go Show resolved Hide resolved
czarcas7ic and others added 3 commits April 28, 2022 14:17
Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
@czarcas7ic czarcas7ic merged commit 8d28b8e into main Apr 28, 2022
@czarcas7ic czarcas7ic deleted the adam/chain-init branch April 28, 2022 21:56
@github-actions github-actions bot mentioned this pull request Apr 1, 2024
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[E2E - Upgrade Testing] switch e2e test setup to creating genesis and configs via Dockertest
5 participants