-
Notifications
You must be signed in to change notification settings - Fork 714
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
build: updates to build and test with LTS JDKs #1385
Conversation
df0a054
to
ca62e4b
Compare
This updates to build and test with LTS JDKs, using the same project setup as zipkin and zipkin-reporter * moves off takari to normal maven wrapper, and updates all plugin versions * removes retrolambda which is incompatible with recent JDKs * ports java 6 code to java 6 syntax * test release profile with JDK 11, which is last to compile java 1.6. * adds opens configuration for old spring and grpc integration tests * moves off abandoned powermock for mockito * bytebuddy no longer supports mocking System, so had to refactor code around currentTime * updates GitHub Actions to build on first and last LTS (11, 21) * adds javadoc tests to ensure it will build prior to running deploy job Signed-off-by: Adrian Cole <adrian@tetrate.io>
da280a2
to
38c7b1f
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.
notes
public class RateLimitingSamplerTest { | ||
|
||
@Test public void samplesOnlySpecifiedNumber() { | ||
mockStatic(System.class); |
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.
no longer possible to mock system
@@ -163,12 +167,16 @@ public Clock clock() { | |||
} | |||
|
|||
static class Jre9 extends Jre7 { | |||
@Override public long currentTimeMicroseconds() { |
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.
moved the actual (internal) function up so that we can use it and mock access to it easier.
@Test public void produceLinkLocalIp_siteLocal_ipv4() throws Exception { | ||
nicWithAddress(InetAddress.getByAddress("local", new byte[] {(byte) 192, (byte) 168, 0, 1})); | ||
@Test void produceLinkLocalIp_siteLocal_ipv4() throws Exception { | ||
try (MockedStatic<NetworkInterface> mb = mockStatic(NetworkInterface.class)) { |
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.
Some core classes are mockable, just System is prohibited now.
<profile> | ||
<id>release</id> | ||
<properties> | ||
<!-- grpc-java < 1.15 supports Java 6 https://github.com/grpc/grpc-java/issues/3961 Current versions support Java 7 even though TLS typically implies Java 8+ --> |
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.
example of building java 1.6 only in a profile, same as zipkin and zipkin-reporter
<systemPropertyVariables> | ||
<java.util.logging.manager>org.apache.logging.log4j.jul.LogManager</java.util.logging.manager> | ||
</systemPropertyVariables> | ||
<!-- Ensure scope leak cause ends up in the console --> | ||
<trimStackTrace>false</trimStackTrace> | ||
<!-- add opens for old grpc to avoid below in JRE 21: |
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.
example of changing to allow old libraries to run on JRE 21
import org.powermock.modules.junit4.PowerMockRunner; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.junit.jupiter.MockitoExtension; |
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.
all tests I had to use mockito for static mocking, I ported to jupiter. the next PR will switch the rest.
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')" | ||
strategy: | ||
fail-fast: false # don't fail fast as sometimes failures are operating system specific | ||
matrix: # use latest available versions and be consistent on all workflows! |
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.
same as zipkin-reporter-java, make sure we can build on JDK 11 as it is what we release on
going to merge to get jupiter started, as bumping all this stuff is prereq to re-cutting zipkin-aws and zipkin-gcp |
This updates to build and test with LTS JDKs, using the same project setup as zipkin and zipkin-reporter