-
Notifications
You must be signed in to change notification settings - Fork 219
Improvements to the junit extension #891
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
Conversation
...mysql-schema/src/test/java/io/javaoperatorsdk/operator/sample/MySQLSchemaOperatorNewE2E.java
Outdated
Show resolved
Hide resolved
...mysql-schema/src/test/java/io/javaoperatorsdk/operator/sample/MySQLSchemaOperatorNewE2E.java
Outdated
Show resolved
Hide resolved
e4dca5e
to
8531e75
Compare
Those changes are largely inspired by @jonathanvila on this PR: https://github.com/keycloak/keycloak/pull/9625/files |
8531e75
to
e1940fd
Compare
Added a pipeline of the "mysql" sample to showcase the usage and benefits. |
e1940fd
to
c731fd2
Compare
d3d948a
to
a2025af
Compare
NDR: rebased on latest |
...ator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/OperatorExtension.java
Outdated
Show resolved
Hide resolved
this.operatorDeployment = operatorDeployment; | ||
this.deploymentTimeout = deploymentTimeout; | ||
this.infrastructure = infrastructure; | ||
this.infrastructureTimeout = infrastructureTimeout; | ||
this.operator = new Operator(this.kubernetesClient, this.configurationService); |
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.
maybe this should be passed in the constructor and created by the builder I don't think there is a case where you need both a local operator and a deployed operator
...ator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/OperatorExtension.java
Outdated
Show resolved
Hide resolved
...ator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/OperatorExtension.java
Outdated
Show resolved
Hide resolved
Conceptually we are mixing here the Integration and E2E tests. In general not opposed to this. But not sure if these should not be two different extensions, in Integration tests we don't usually use other resources (e.g. infrastructure) we don't deploy of course the operator etc. Maybe having a hierarchy between these two extension? like a common base class, if we need to share code. But don't have strong opinion just an idea. |
I don't have a strong opinion too but I think this is a valid point. Maybe (but it can be done in a follow up PR) we should end up with two different extensions: one that deals with an embedded operator and one with a deployed one. |
@csviri yes, indeed, we are intentionally mixing integration and E2E tests, the objective is to enable this workflow:
I'm not opposed to split the implementation using two subclasses but I would really like to make it easy to "switch" integration/E2E keeping the same(or almost) test sources. |
Separated into a common abstract class to refactor common functionalities and two sub-classes I think this is ready for another round of review 🙏 @lburgazzoli @csviri |
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, I think we can remove the old tests and the related workflow and merge it
@csviri thanks! 👍 |
100107e
to
eead2d4
Compare
Should be good for a final check @csviri 🙂 |
eead2d4
to
4e7492c
Compare
.github/workflows/e2e-test.yml
Outdated
uses: actions/setup-java@v2 | ||
with: | ||
java-version: 11 | ||
distribution: adopt-hotspot |
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.
Is using a different distribution from the tests on purpose here? Might actually be a good idea since it improves somewhat VM coverage?
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.
adopt
rebranded the distribution to temurin
, so adopt v17 doesn't exists (it's temurin
now).
Switched to temurin
, I "think" that, in this repository, we are not leveraging sensible parts of the JVM and we should not need to test against different distributions ... but open to suggestions!
4e7492c
to
2b66241
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.
LGTM, will open a subsequent PR to improve things a little
This PR integrates a few desired features into the current junit extension, without breaking the backward compatibility.