Skip to content

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

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

andreaTP
Copy link
Collaborator

@andreaTP andreaTP commented Jan 31, 2022

This PR integrates a few desired features into the current junit extension, without breaking the backward compatibility.

@andreaTP andreaTP force-pushed the improve-testing branch 3 times, most recently from e4dca5e to 8531e75 Compare February 1, 2022 11:37
@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 1, 2022

Those changes are largely inspired by @jonathanvila on this PR: https://github.com/keycloak/keycloak/pull/9625/files

@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 1, 2022

Added a pipeline of the "mysql" sample to showcase the usage and benefits.
I do believe that those changes are reducing the complexity of the user's code and setup while they are not dramatically increasing the complexity in this codebase.

@andreaTP andreaTP marked this pull request as ready for review February 1, 2022 11:52
@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 1, 2022

Happy to have a review of those proposed changes @csviri @metacosm

@andreaTP andreaTP changed the title [WIP] Improve the junit extension Improvements to the junit extension Feb 1, 2022
@andreaTP andreaTP force-pushed the improve-testing branch 3 times, most recently from d3d948a to a2025af Compare February 2, 2022 15:10
@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 2, 2022

NDR: rebased on latest main and Sonar check is correctly skipped @csviri

@csviri csviri requested a review from lburgazzoli February 3, 2022 08:49
this.operatorDeployment = operatorDeployment;
this.deploymentTimeout = deploymentTimeout;
this.infrastructure = infrastructure;
this.infrastructureTimeout = infrastructureTimeout;
this.operator = new Operator(this.kubernetesClient, this.configurationService);
Copy link
Collaborator

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

@csviri
Copy link
Collaborator

csviri commented Feb 3, 2022

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.
So in short these are little different domain, with different needs, this way we provide a mixed api for the two domains. Separating it to two extensions would make it more explicit.

But don't have strong opinion just an idea.

@lburgazzoli
Copy link
Collaborator

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. So in short these are little different domain, with different needs, this way we provide a mixed api for the two domains. Separating it to two extensions would make it more explicit.

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.

@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 3, 2022

@csviri yes, indeed, we are intentionally mixing integration and E2E tests, the objective is to enable this workflow:

  • locally develop the operator and the tests running from your machine (integration) - fast iteration - missing checks on k8s (such as RBAC etc.)
  • in CI using the very same test/code and a simple switch from command line (E2E) - possibly slower - very close if not identical to the final product

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.

@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 3, 2022

Separated into a common abstract class to refactor common functionalities and two sub-classes OperatorExtension and E2EOperatorExtension.
This actually makes everything more clean, great suggestions thanks!

I think this is ready for another round of review 🙏 @lburgazzoli @csviri

Copy link
Collaborator

@csviri csviri left a 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

@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 4, 2022

@csviri thanks! 👍
I'll clean up the sample operators tests and remove the old "kind" approach in favour of the E2EOperatorExtension setup, anything else that should be cleaned up?

@andreaTP
Copy link
Collaborator Author

andreaTP commented Feb 4, 2022

  • cleaned up
  • ported the E2E of the Tomcat operator to this new structure
  • unified the E2E workflows that are now using a GH action matrix
  • got a green CI 🍏

Should be good for a final check @csviri 🙂

uses: actions/setup-java@v2
with:
java-version: 11
distribution: adopt-hotspot
Copy link
Collaborator

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?

Copy link
Collaborator Author

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!

Copy link
Collaborator

@metacosm metacosm left a 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

@metacosm metacosm merged commit ff1a44d into operator-framework:main Feb 4, 2022
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.

4 participants