Skip to content
Merged
44 changes: 13 additions & 31 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
Expand All @@ -35,29 +25,21 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: java
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
dependency-caching: true
build-mode: manual

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '8'
cache: maven

#- run: |
# make bootstrap
# make release
- name: Build
run: mvn -B package

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
9 changes: 6 additions & 3 deletions .github/workflows/doctests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
doctests:
runs-on: ubuntu-latest
services:
redis-stack:
image: redis/redis-stack-server:latest
redis:
image: redis:latest
options: >-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:
Expand All @@ -33,6 +33,9 @@ jobs:
with:
java-version: '11'
distribution: 'temurin'
- name: Maven offline
run: |
mvn -q dependency:go-offline
- name: Run doctests
run: |
mvn -Pdoctests test
mvn -Pdoctests clean compile test
12 changes: 0 additions & 12 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,3 @@ jobs:
env:
JVM_OPTS: -Xmx3200m
TERM: dumb
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ github.event_name == 'schedule' || (github.event_name == 'push') || github.event_name == 'workflow_dispatch'}}
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: false
files: ./target/surefire-reports/TEST*
token: ${{ secrets.CODECOV_TOKEN }}
18 changes: 13 additions & 5 deletions .github/workflows/test-on-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ jobs:
export TEST_WORK_FOLDER=$REDIS_ENV_WORK_DIR
echo $TEST_WORK_FOLDER
if [ -z "$TESTS" ]; then
mvn clean compile test
mvn clean compile verify
else
mvn -Dtest=$TESTS clean compile test
mvn -Dtest=$TESTS clean verify
fi
env:
JVM_OPTS: "-XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=${{ runner.temp }}/heapdump-${{ matrix.redis_version }}.hprof"
Expand All @@ -105,6 +105,7 @@ jobs:
with:
files: |
target/surefire-reports/**/*.xml
target/failsafe-reports/**/*.xml
# Collect logs on failure
- name: Collect logs on failure
if: failure() # This runs only if the previous steps failed
Expand All @@ -125,15 +126,22 @@ jobs:
docker compose $COMPOSE_ENV_FILES -f src/test/resources/env/docker-compose.yml down
continue-on-error: true
# Upload code coverage
- name: Upload coverage to Codecov
- name: Upload merged coverage to Codecov
uses: codecov/codecov-action@v5
with:
# Upload the merged JaCoCo XML report generated at verify phase
files: ./target/site/jacoco/jacoco.xml
flags: docker-${{ matrix.redis_version }}
name: merged-coverage
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
- name: Upload test results to Codecov (unit + IT)
if: ${{ github.event_name == 'schedule' || (github.event_name == 'push') || github.event_name == 'workflow_dispatch'}}
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: false
files: ./target/surefire-reports/TEST*
files: |
./target/surefire-reports/*.xml
./target/failsafe-reports/*.xml
flags: test-results-docker-${{ matrix.redis_version }}
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,10 @@ stop:
test: | start mvn-test-local stop

mvn-test-local:
@TEST_ENV_PROVIDER=local mvn -Dtest=${TEST} clean compile test
@TEST_ENV_PROVIDER=local mvn -Dtest=${TEST} clean compile verify

mvn-test:
mvn -Dtest=${TEST} clean compile test
mvn -Dtest=${TEST} clean compile verify

package: | start mvn-package stop

Expand Down
137 changes: 129 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,70 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.13</version>
<executions>
<!-- Collect coverage for unit tests -->
<execution>
<id>prepare-agent-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>argLine</propertyName>
<destFile>${project.build.directory}/jacoco-ut.exec</destFile>
</configuration>
</execution>
<!-- Collect coverage for integration tests tagged with @Tag("integration") -->
<execution>
<id>prepare-agent-it-tagged</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>failsafeTaggedArgLine</propertyName>
<destFile>${project.build.directory}/jacoco-it-tagged.exec</destFile>
</configuration>
</execution>
<!-- Collect coverage for integration tests with filename suffix IntegrationTest(s) -->
<execution>
<id>prepare-agent-it-suffix</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>failsafeSuffixArgLine</propertyName>
<destFile>${project.build.directory}/jacoco-it-suffix.exec</destFile>
</configuration>
</execution>
<!-- Merge all coverage data after all integration tests -->
<execution>
<id>merge-coverage</id>
<phase>post-integration-test</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>jacoco-ut.exec</include>
<include>jacoco-it-tagged.exec</include>
<include>jacoco-it-suffix.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${project.build.directory}/jacoco-merged.exec</destFile>
</configuration>
</execution>
<!-- Generate the final report on the merged data -->
<execution>
<id>report</id>
<phase>test</phase>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-merged.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -282,12 +335,80 @@
<systemPropertyVariables>
<redis-hosts>${redis-hosts}</redis-hosts>
</systemPropertyVariables>
<excludedGroups>integration,scenario</excludedGroups>
<excludes>
<exclude>**/examples/*Example.java</exclude>
<exclude>**/examples/*.java</exclude>
<exclude>**/scenario/*Test.java</exclude>
<!-- Exclude integration tests from unit-test phase -->
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*IntegrationTests.java</exclude>
Comment on lines +340 to +344
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

The exclusion patterns for integration tests are duplicated between surefire and failsafe plugins. Consider extracting these patterns into properties to maintain consistency and reduce duplication.

Copilot uses AI. Check for mistakes.

</excludes>
<!--<trimStackTrace>false</trimStackTrace>-->
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<argLine>@{failsafeSuffixArgLine} ${JVM_OPTS}</argLine>
<systemPropertyVariables>
<redis-hosts>${redis-hosts}</redis-hosts>
</systemPropertyVariables>
<!-- Default includes used when invoking failsafe goals directly (e.g., mvn failsafe:integration-test) -->
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*IntegrationTests.java</include>
</includes>
<excludes>
<exclude>**/examples/*.java</exclude>
<exclude>**/scenario/*Test.java</exclude>
<!-- Exclude unit tests -->
<exclude>**/mocked/*.java</exclude>
</excludes>
</configuration>
<executions>
<!-- Run all tests tagged with @Tag("integration") regardless of file name -->
<execution>
<id>it-tagged</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<argLine>@{failsafeTaggedArgLine} ${JVM_OPTS}</argLine>
<groups>integration</groups>
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
</includes>
</configuration>
</execution>
<!-- Also run tests whose filenames end with IntegrationTest or IntegrationTests, even if not tagged -->
<execution>
<id>it-suffix</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<argLine>@{failsafeSuffixArgLine} ${JVM_OPTS}</argLine>

<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*IntegrationTests.java</include>
</includes>
</configuration>
</execution>
<!-- Verify phase should run once after both IT executions -->
<execution>
<id>it-verify</id>
<goals>
<goal>verify</goal>
</goals>
<configuration>
<summaryFile>${project.build.directory}/failsafe-summary.xml</summaryFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
Expand Down Expand Up @@ -359,19 +480,19 @@
<include>**/VAddParams.java</include>
<include>**/VSimParams.java</include>
<include>**/VSimScoreAttribs.java</include>
<include>**/*FunctionCommandsTest*</include>
<include>**/*FunctionCommandsTest*.java</include>
<include>**/Endpoint.java</include>
<include>src/main/java/redis/clients/jedis/mcf/*.java</include>
<include>src/test/java/redis/clients/jedis/failover/*.java</include>
<include>**/mcf/EchoStrategyIntegrationTest.java</include>
<include>**/mcf/LagAwareStrategyUnitTest.java</include>
<include>**/mcf/RedisRestAPI*.java</include>
<include>**/mcf/ActiveActiveLocalFailoverTest*</include>
<include>**/mcf/FailbackMechanism*</include>
<include>**/mcf/PeriodicFailbackTest*</include>
<include>**/mcf/AutomaticFailoverTest*</include>
<include>**/mcf/MultiCluster*</include>
<include>**/mcf/StatusTracker*</include>
<include>**/mcf/FailbackMechanism*.java</include>
<include>**/mcf/PeriodicFailbackTest*.java</include>
<include>**/mcf/AutomaticFailoverTest*.java</include>
<include>**/mcf/MultiCluster*.java</include>
<include>**/mcf/StatusTracker*.java</include>
<include>**/Health*.java</include>
<include>src/main/java/redis/clients/jedis/MultiClusterClientConfig.java</include>
<include>src/main/java/redis/clients/jedis/HostAndPort.java</include>
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/redis/clients/jedis/ACLJedisPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.RegisterExtension;
import redis.clients.jedis.exceptions.InvalidURIException;
import redis.clients.jedis.exceptions.JedisAccessControlException;
Expand All @@ -29,6 +30,7 @@
* This test is only executed when the server/cluster is Redis 6. or more.
*/
@SinceRedisVersion("6.0.0")
@Tag("integration")
public class ACLJedisPoolTest {
private static final EndpointConfig endpoint = HostAndPorts.getRedisEndpoint("standalone0-acl");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.RegisterExtension;
import redis.clients.jedis.exceptions.JedisConnectionException;
import redis.clients.jedis.exceptions.JedisException;
Expand All @@ -25,6 +26,7 @@
* This tests are only executed when the server/cluster is Redis 6 or more.
*/
@SinceRedisVersion("6.0.0")
@Tag("integration")
public class ACLJedisSentinelPoolTest {

private static final String MASTER_NAME = "aclmaster";
Expand Down
8 changes: 2 additions & 6 deletions src/test/java/redis/clients/jedis/ClusterPipeliningTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.*;
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

[nitpick] Using wildcard imports (.*) is generally discouraged as it can lead to namespace pollution and unclear dependencies. Consider importing specific classes instead.

Suggested change
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

Copilot uses AI. Check for mistakes.

import redis.clients.jedis.args.*;
import redis.clients.jedis.exceptions.JedisDataException;
import redis.clients.jedis.params.*;
Expand All @@ -36,6 +31,7 @@
import redis.clients.jedis.util.JedisClusterTestUtil;
import redis.clients.jedis.util.SafeEncoder;

@Tag("integration")
public class ClusterPipeliningTest {

private static final String LOCAL_IP = "127.0.0.1";
Expand Down
Loading
Loading