-
Notifications
You must be signed in to change notification settings - Fork 899
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
tests(e2e): introduce environment wrapper and test suites #4343
Conversation
FYI: I wanted to open an issue first, but while trying to validate my idea on a long train trip, I ended up mostly implementing the whole thing and to change my initial idea according to a few limitations from the e2e-framework and go testing framework in general. So in the end I decided it would have been easier to let the code speak directly, but feel free to challenge or discuss the whole approach as if it was a proposal instead 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
e81a918
to
a0245d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvements, thanks @phisco . Added one minor question
I would like to have a feedback from @negz too when he's back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions, but I like the general direction here.
config.LabelTestSuite: []string{SuiteCompositionWebhookSchemaValidation, config.TestSuiteDefault}, | ||
}), | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed that some other users of e2e-framework have a sub package per "suite". Would that approach make sense for us? I think in that world all of these init functions would become part of TestMain
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried moving them to separate sub packages too in the beginning, but then you need to either inject the environment from the root to all the sub packages in some way or reinitialize it for each one of them or make it importable from the root package, which would mean moving it to a non _test.go
file. I tried looking around before this iteration, but couldn't find applicable examples, we can definitely think about that for the next iteration.
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you!
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Description of your changes
This PR introduces the following changes:
test/e2e/README.md
for more details.e2e
package asE2EConfig
e2e-framework
to use unreleased versions, mainly due to the fix to label selection introduced in kubernetes-sigs/e2e-framework@b38dd95BeforeEachFeature
checking that all features are defining the a label ascribing them to a specifictest preset
, to avoid having unselected features by mistake, this is due to the fact that e2e-framework doesn't modifying the feature from the provided function so there is no way to implicitly add a default value to all the features not having it set. However "explicit is better than implicit", so I feel it's better like this.Test suites allow to define custom groups of tests alongside required additional conditional setup steps and custom Crossplane installation options which currently allow to run both all the non alpha feature tests against the default Crossplane configuration, but also to run for each alpha feature all the basic and feature specific tests against a Crossplane installation with the selected alpha feature enabled from the start. We run the uninstall and upgrade tests as part of the basic suite, so we are still covering the "what happens to a running Crossplane instance if we enable/disable this alpha feature?". This will allow us to gain in the future the confidence required to promote alpha features to beta, knowing that none of the basic tests is failing.
AFAICT, test suites should transparently work with all current test selection modes, e.g.
-test.run <regexp>
or e2e-framework selection via labels/features/assessments.TODO:
// TODO(phisco): make it configurable
comments in the code./e2e
command to run e2e test suites on-demand from the PR, reworking the tests we run by default on each push to a PR.I have:
make reviewable
to ensure this PR is ready for review.Addedbackport release-x.y
labels to auto-backport this PR if necessary.