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

Experiment Pulsar CI build and tests with Java 21 #155

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-maven-cache-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ jobs:
# on growing from old entries which wouldn't never expire if the old
# cache would be used as the starting point for a new cache entry

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
if: ${{ (github.event_name == 'schedule' || steps.changes.outputs.poms == 'true') && steps.cache.outputs.cache-hit != 'true' }}
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Download dependencies
if: ${{ (github.event_name == 'schedule' || steps.changes.outputs.poms == 'true') && steps.cache.outputs.cache-hit != 'true' }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci-owasp-dependency-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ jobs:
include:
- branch: master
- branch: branch-3.1
jdk: 17
- branch: branch-3.0
jdk: 17
- branch: branch-2.11
jdk: 17
- branch: branch-2.10
jdk: 11
- branch: branch-2.9
Expand Down Expand Up @@ -72,11 +75,11 @@ jobs:
${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK ${{ matrix.jdk || '17' }}
- name: Set up JDK ${{ matrix.jdk || '21' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk || '17' }}
java-version: ${{ matrix.jdk || '21' }}

- name: run install by skip tests
run: mvn -B -ntp clean install -DskipTests -Dspotbugs.skip=true -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true -DskipDocker=true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pulsar-ci-flaky.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Build core-modules
run: |
Expand Down
54 changes: 30 additions & 24 deletions .github/workflows/pulsar-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Check source code license headers
run: mvn -B -T 8 -ntp initialize apache-rat:check license:check
Expand Down Expand Up @@ -233,11 +233,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK ${{ matrix.jdk || '17' }}
- name: Set up JDK ${{ matrix.jdk || '21' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk || '17' }}
java-version: ${{ matrix.jdk || '21' }}

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -337,11 +337,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK ${{ matrix.jdk || '17' }}
- name: Set up JDK ${{ matrix.jdk || '21' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk || '17' }}
java-version: ${{ matrix.jdk || '21' }}

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -417,11 +417,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -496,6 +496,12 @@ jobs:
no_coverage: true

- name: Shade on Java 17
group: SHADE_RUN
runtime_jdk: 17
setup: ./build/run_integration_group.sh SHADE_BUILD
no_coverage: true

- name: Shade on Java 21
group: SHADE_RUN
setup: ./build/run_integration_group.sh SHADE_BUILD
no_coverage: true
Expand Down Expand Up @@ -532,11 +538,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -648,11 +654,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -763,11 +769,11 @@ jobs:
${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -901,11 +907,11 @@ jobs:
${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -1012,11 +1018,11 @@ jobs:
${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -1114,11 +1120,11 @@ jobs:
${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-m2-dependencies-core-modules-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: Install gh-actions-artifact-client.js
uses: apache/pulsar-test-infra/gh-actions-artifact-client/dist@master
Expand Down Expand Up @@ -1232,11 +1238,11 @@ jobs:
restore-keys: |
${{ runner.os }}-m2-dependencies-all-

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
java-version: 21

- name: build package
run: mvn -B clean package -DskipTests -T 1C -ntp
Expand Down Expand Up @@ -1274,11 +1280,11 @@ jobs:
key: ${{ runner.os }}-m2-dependencies-core-modules-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-dependencies-core-modules-
- name: Set up JDK ${{ matrix.jdk || '17' }}
- name: Set up JDK ${{ matrix.jdk || '21' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk || '17' }}
java-version: ${{ matrix.jdk || '21' }}

- name: Clean Disk
uses: ./.github/actions/clean-disk
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RUN mkdir -p /etc/apt/keyrings \
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install temurin-17-jdk
&& apt-get -y install temurin-21-jdk

# Compile and install gtest & gmock
RUN cd /usr/src/googletest && \
Expand Down
11 changes: 8 additions & 3 deletions build/run_integration_group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ set -o errexit

JAVA_MAJOR_VERSION="$(java -version 2>&1 |grep " version " | awk -F\" '{ print $2 }' | awk -F. '{ if ($1=="1") { print $2 } else { print $1 } }')"
# Used to shade run test on Java 8, because the latest TestNG requires Java 11 or higher.
TESTNG_VERSION="7.3.0"
TESTNG_VERSION_JAVA_8="7.3.0"
MOCKITO_VERSION_JAVA_8="4.11.0"

# lists all active maven modules with given parameters
# parses the modules from the "mvn initialize" output
Expand Down Expand Up @@ -112,7 +113,11 @@ test_group_shade() {
}

test_group_shade_build() {
mvn_run_integration_test --build-only "$@" -DShadeTests -DtestForkCount=1 -DtestReuseFork=false
local additional_args
if [[ $JAVA_MAJOR_VERSION -ge 8 && $JAVA_MAJOR_VERSION -lt 11 ]]; then
additional_args="$additional_args -Dtestng.version=$TESTNG_VERSION_JAVA_8 -Dmockito.version=$MOCKITO_VERSION_JAVA_8"
fi
mvn_run_integration_test --build-only "$@" -DShadeTests -DtestForkCount=1 -DtestReuseFork=false $additional_args
}

test_group_shade_run() {
Expand All @@ -122,7 +127,7 @@ test_group_shade_run() {
fi

if [[ $JAVA_MAJOR_VERSION -ge 8 && $JAVA_MAJOR_VERSION -lt 11 ]]; then
additional_args="$additional_args -Dtestng.version=$TESTNG_VERSION"
additional_args="$additional_args -Dtestng.version=$TESTNG_VERSION_JAVA_8 -Dmockito.version=$MOCKITO_VERSION_JAVA_8"
fi

mvn_run_integration_test --skip-build-deps --clean "$@" -Denforcer.skip=true -DShadeTests -DtestForkCount=1 -DtestReuseFork=false $additional_args
Expand Down
7 changes: 1 addition & 6 deletions buildtools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<guava.version>32.1.2-jre</guava.version>
<ant.version>1.10.12</ant.version>
<snakeyaml.version>2.0</snakeyaml.version>
<mockito.version>3.12.4</mockito.version>
<mockito.version>5.6.0</mockito.version>
<!-- required for running tests on JDK11+ -->
<test.additional.args>
--add-opens java.base/jdk.internal.loader=ALL-UNNAMED
Expand Down Expand Up @@ -141,11 +141,6 @@
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
</dependency>
</dependencies>

<build>
Expand Down
6 changes: 3 additions & 3 deletions docker/pulsar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ RUN mkdir -p /etc/apt/keyrings \
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install temurin-17-jdk \
&& apt-get -y install temurin-21-jdk \
&& export ARCH=$(uname -m | sed -r 's/aarch64/arm64/g' | awk '!/arm64/{$0="amd64"}1') \
&& echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/temurin-17-jdk-$ARCH/conf/security/java.security \
&& echo networkaddress.cache.negative.ttl=1 >> /usr/lib/jvm/temurin-17-jdk-$ARCH/conf/security/java.security \
&& echo networkaddress.cache.ttl=1 >> /usr/lib/jvm/temurin-21-jdk-$ARCH/conf/security/java.security \
&& echo networkaddress.cache.negative.ttl=1 >> /usr/lib/jvm/temurin-21-jdk-$ARCH/conf/security/java.security \

# Cleanup apt
RUN apt-get -y --purge autoremove \
Expand Down
16 changes: 2 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ flexible messaging model and an intuitive client API.</description>
<docker-java.version>3.3.0</docker-java.version>
<kerby.version>1.1.1</kerby.version>
<testng.version>7.7.1</testng.version>
<mockito.version>3.12.4</mockito.version>
<mockito.version>5.6.0</mockito.version>
<javassist.version>3.25.0-GA</javassist.version>
<skyscreamer.version>1.5.0</skyscreamer.version>
<objenesis.version>3.1</objenesis.version>
<objenesis.version>3.3</objenesis.version> <!-- should match mockito-core objenesis version -->
<awaitility.version>4.2.0</awaitility.version>
<jettison.version>1.5.4</jettison.version>
<woodstox.version>5.4.0</woodstox.version>
Expand Down Expand Up @@ -362,12 +362,6 @@ flexible messaging model and an intuitive client API.</description>
<version>${mockito.version}</version>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
Expand Down Expand Up @@ -1441,12 +1435,6 @@ flexible messaging model and an intuitive client API.</description>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-lambda</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,10 +868,10 @@ public void persistentTopics() throws Exception {
Assert.assertEquals(responseCaptor.getValue().getStatus(), Response.Status.NO_CONTENT.getStatusCode());
// verify permission
response = mock(AsyncResponse.class);
responseCaptor = ArgumentCaptor.forClass(Response.class);
ArgumentCaptor<Map<String, Set<AuthAction>>> permissionsCaptor = ArgumentCaptor.forClass(Map.class);
persistentTopics.getPermissionsOnTopic(response, property, cluster, namespace, topic);
verify(response, timeout(5000).times(1)).resume(responseCaptor.capture());
Map<String, Set<AuthAction>> permission = (Map<String, Set<AuthAction>>) responseCaptor.getValue();
verify(response, timeout(5000).times(1)).resume(permissionsCaptor.capture());
Map<String, Set<AuthAction>> permission = permissionsCaptor.getValue();
assertEquals(permission.get(role), actions);
// remove permission
response = mock(AsyncResponse.class);
Expand All @@ -882,10 +882,10 @@ public void persistentTopics() throws Exception {
// verify removed permission
Awaitility.await().untilAsserted(() -> {
AsyncResponse response1 = mock(AsyncResponse.class);
ArgumentCaptor<Response> responseCaptor1 = ArgumentCaptor.forClass(Response.class);
ArgumentCaptor<Map<String, Set<AuthAction>>> permissionsCaptor1 = ArgumentCaptor.forClass(Map.class);
persistentTopics.getPermissionsOnTopic(response1, property, cluster, namespace, topic);
verify(response1, timeout(5000).times(1)).resume(responseCaptor1.capture());
Map<String, Set<AuthAction>> p = (Map<String, Set<AuthAction>>) responseCaptor1.getValue();
verify(response1, timeout(5000).times(1)).resume(permissionsCaptor1.capture());
Map<String, Set<AuthAction>> p = permissionsCaptor1.getValue();
assertTrue(p.isEmpty());
});
}
Expand Down
Loading
Loading