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

Simplify E2E Configuration #7568

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

chatton
Copy link
Contributor

@chatton chatton commented Nov 14, 2024

Description

This PR modifies the way configurations are passed to E2E tests.

While every field can still be overridden by environment variables, the E2Es now have their own config file that is used, and it is possible to remove some special casing around tests being in CI vs running locally.

The TestConfig struct has been updated to behave in a similar way as the relayers, in that we provide a list of all upgrade plans, then just specify which one we want by name.

closes: #4697


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@chatton chatton marked this pull request as draft November 14, 2024 15:40
@chatton chatton marked this pull request as ready for review November 15, 2024 07:54
@chatton chatton changed the title [WIP] Simplify E2E Configuration Simplify E2E Configuration Nov 29, 2024
Copy link
Contributor

@bznein bznein left a comment

Choose a reason for hiding this comment

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

Did a quick fly-by review as discuss offline with Cian, it mostly lgtm with a few minor comments

image: ghcr.io/cosmos/ibc-go-simd # override with CHAIN_IMAGE
binary: simd # override with CHAIN_BINARY

activeRelayer: hermes # override with RELAYER_ID
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this has to be one of the IDs in the list below, maybe worth specifying it in the comment?

Comment on lines +228 to +234
if strings.TrimSpace(upgrade.Tag) == "" {
return fmt.Errorf("upgrade config missing tag: %+v", upgrade)
}

if strings.TrimSpace(upgrade.PlanName) == "" {
return fmt.Errorf("upgrade config missing plan name: %+v", upgrade)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] I wonder if it would make more sense to either:

  1. do this check only if upgrade.PlanName == tc.UpgradePlanName (so a "broken" upgrade config is allowed if it's not used for the test)
  2. split this into two different loops. Since we don't care about efficiency here, I think it's a bit more clear if validation and search are split

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured it would be best to just explode immediately if anything about config is bad. Don't have a strong preference for multiple loops, will always just be a few elements anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

Up to you! I am slightly more inclined towards having one loop of validation followed by one of search, for clarity, but not a deal breaker

Comment on lines +236 to +238
if upgrade.PlanName == tc.UpgradePlanName {
foundPlan = true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] if we go for either 1 or 2 in the above comment, we can return nil here.

Or even:

if we go with 1 above: use slices.IndexFunc() to get the index of the right upgrade plan, and then do the validation and return

if we go with 2 above: simply return slices.ContainsFunc()

Copy link

sonarcloud bot commented Nov 29, 2024

Copy link
Contributor

@bznein bznein left a comment

Choose a reason for hiding this comment

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

SLAM if all tests are green!

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.

Simplify E2E Configuration
2 participants