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

Run tests using jdk8 #306

Merged
merged 11 commits into from
Apr 12, 2022
Merged

Run tests using jdk8 #306

merged 11 commits into from
Apr 12, 2022

Conversation

remcowesterhoud
Copy link
Contributor

@remcowesterhoud remcowesterhoud commented Apr 11, 2022

Description

We claim to have the guarantee that the zeebe-process-test-extension-testcontainer is java 8 compatible. We are guaranteeing this by setting the java version in the maven configuration. However, we do not test this in our CI. The testcontainer tests we have are still being run with java 17.

This has been done by splitting the QA module into 3 separate modules. 1 for the abstract tests, 1 for the embedded tests and 1 for the testcontainer tests. By excluding / including specific modules we can configure what tests we want to run in which scenario.

Please note: this PR has been based off of #288. Here we did the same thing using a different approach. Instead of restarting from the beginning I based this solution off of this branch and modified what was necessary. This is why the first commits are introducing the maven profiles. The relevant commits in this PR are the commits from the 11th of April.
To me using these modules are a more maintainable approach compared to the profiles.

Related issues

closes #287

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually

Documentation:

  • Javadoc has been written
  • The documentation is updated

@remcowesterhoud
Copy link
Contributor Author

@saig0 I have changed the solution of #288 to use modules instead of profiles after discussing with Nicolas. I believe this approach is more clear and better to maintain. Since you had a look at the previous, would you mind taking a look at this one as well?

@github-actions
Copy link

github-actions bot commented Apr 11, 2022

Unit Test Results

  29 files    29 suites   1m 13s ⏱️
  82 tests   82 ✔️ 0 💤 0
259 runs  259 ✔️ 0 💤 0

Results for commit 9ab17f9.

♻️ This comment has been updated with latest results.

Copy link
Member

@saig0 saig0 left a comment

Choose a reason for hiding this comment

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

@remcowesterhoud looks good 👍

The tests in QA are being used by both the testcontainer tests as the embedded tests. Since the testcontainer tests will be run JDK8 the tests written should be compatible with Java 8.
We already had 2 profiles for running either the embedded or the testcontainer tests. In order to run the testcontainer tests with JDK8 some changes to these profiles were required:

1. These profiles should be responsible for which extension dependency they use. For this reason the dependencies have been moved to the profiles.
2. In the `testcontainer` profile we no longer have the `zeebe-process-test-extension` available. This means any test classes using this extension will not compile. For this reason these classes are being excluded from compilation when using this profile.
3. One more thing to note is that the `embedded` profile still has both dependencies. This is because of the ExtendsAbstractsTest. This test verifies that we have implemented all our tests with both extensions. In order to run this test we need to have access to the testcontainer-extension.

Finally a new `default` profile has been added. This profile is activated by default and will contain both dependencies. This is generally used for local development. The IDE will compile everything fine because both dependencies are present. Additionally, running `mvn test` will run both the embedded as the testcontainer tests.
This property allows us to skip any code checks in places where we don't want to do these by running `mvn <goal> -DskipChecks`
The build-and-test-testcontainers has been modified to run the testcontainer tests on java 8.

Some things to note:
1. We first need to package the application using java 17. In this workflow we will build the docker image for running the engine locally. The engine is not java 8 compatible, so we need to do this using java 17.
2. We need a second `setup-java` action. This will downgrade our java environment to java 8 which we want to use to run the tests.
3. We need to remove the ``.mvn/jvm.config` in our tests. This file contains some `--add-exports` flags which are required by spotless. Java 8 does not know these flags, so we cannot run mvn commands with java 8 whilst this file is available.
Only files have been moved. No code has been changed.
These classes do not get packaged when they are in the test sources. In order for the other classes to extends them they need to be moved to the main sources.
All the modules were defined in the QA pom. These have now been moved to the modules that actually make use of them.
The testcontainer module should only bother testing that this module implements all AbstractTests. The same goes for the embedded module.
Instead of using maven profiles to decide which tests we want to run in which scenario, we now use the new modules for this.
@remcowesterhoud remcowesterhoud merged commit 7fd4330 into main Apr 12, 2022
@remcowesterhoud remcowesterhoud deleted the 287_jdk8_modules branch April 12, 2022 08:44
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.

Run testcontainer tests with JDK8
2 participants