diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1cab36..de947e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,22 +30,19 @@ jobs: java: [ 8, 21 ] steps: - name: "Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Set up Java JDK" - uses: actions/setup-java@v3.12.0 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: ${{ matrix.java }} - name: "Print maven version" run: ./mvnw -version - - name: "Test, Check style, Check PMD, Check license with Maven and Java8" - if: matrix.java == '8' + - name: "Test, Check style, Check PMD, Check license with Maven and Java" run: | ./mvnw -T 4C clean test && sh ./tools/check_format.sh - - name: "Test with Maven and Java${{ matrix.java }}" - if: matrix.java != '8' - run: | - ./mvnw -T 4C clean test - name: "Codecov" if: matrix.java == '8' - uses: codecov/codecov-action@v3.1.4 + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/codecov.yml b/codecov.yml index 15e2a70..a9a1762 100644 --- a/codecov.yml +++ b/codecov.yml @@ -28,10 +28,10 @@ coverage: precision: 2 range: "50...100" ignore: - - ".github/.*" - - ".mvn/.*" - - ".style/.*" - - "*.md" + - ".github/.*" + - ".mvn/.*" + - ".style/.*" + - "*.md" comment: layout: "reach,diff,flags,tree" behavior: default diff --git a/pom.xml b/pom.xml index c7861f8..0a9fe65 100644 --- a/pom.xml +++ b/pom.xml @@ -207,6 +207,26 @@ + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + + prepare-agent + + prepare-agent + + + + report + test + + report + + + + \ No newline at end of file diff --git a/src/test/java/icu/funkye/redispike/ServerTest.java b/src/test/java/icu/funkye/redispike/ServerTest.java index 1f7900a..6c0ed0d 100644 --- a/src/test/java/icu/funkye/redispike/ServerTest.java +++ b/src/test/java/icu/funkye/redispike/ServerTest.java @@ -41,7 +41,9 @@ public class ServerTest { static Server server; static IAerospikeClient aspClient; - static Logger logger = LoggerFactory.getLogger(ServerTest.class); + static Logger logger = LoggerFactory.getLogger(ServerTest.class); + + private final int RandomValue = Integer.MAX_VALUE; @BeforeAll public static void init() throws ParseException { @@ -53,7 +55,7 @@ public static void init() throws ParseException { @Test public void testhHash() { - String key = String.valueOf(ThreadLocalRandom.current().nextInt(50000)); + String key = String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue)); try (Jedis jedis = JedisPooledFactory.getJedisInstance()) { Long result = jedis.hset(key.getBytes(StandardCharsets.UTF_8), "b".getBytes(StandardCharsets.UTF_8), "c".getBytes(StandardCharsets.UTF_8)); @@ -67,7 +69,7 @@ public void testhHash() { Assertions.assertEquals(result, 2); result = jedis.hdel(key, map.keySet().toArray(new String[0])); Assertions.assertEquals(result, 2); - key = String.valueOf(ThreadLocalRandom.current().nextInt(50000)); + key = String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue)); result = jedis.hsetnx(key, "f", "g"); Assertions.assertEquals(result, 1); result = jedis.hsetnx(key, "f", "g"); @@ -114,7 +116,7 @@ public void testGetNilAsp() { @Test public void testSetExAsp() { - String key = String.valueOf(ThreadLocalRandom.current().nextInt(50000)); + String key = String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue)); try (Jedis jedis = JedisPooledFactory.getJedisInstance()) { String result = jedis.set(key, "b", SetParams.setParams().ex(1L)); Assertions.assertEquals(result, "OK"); @@ -128,13 +130,13 @@ public void testSetExAsp() { @Test public void testSetNxNilAsp() { - String key = String.valueOf(ThreadLocalRandom.current().nextInt(50000)); + String key = String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue)); try (Jedis jedis = JedisPooledFactory.getJedisInstance()) { String result = jedis.set(key, "b", SetParams.setParams().nx()); Assertions.assertEquals(result, "OK"); result = jedis.set(key, "b", SetParams.setParams().nx()); Assertions.assertNull(result); - key = String.valueOf(ThreadLocalRandom.current().nextInt(50000)); + key = String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue)); result = String.valueOf(jedis.setnx(key, "b")); Assertions.assertEquals(result, "1"); result = String.valueOf(jedis.setnx(key, "b")); @@ -144,7 +146,7 @@ public void testSetNxNilAsp() { @Test public void testSetExNxAsp() { - String key = String.valueOf(ThreadLocalRandom.current().nextInt(50000)); + String key = String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue)); try (Jedis jedis = JedisPooledFactory.getJedisInstance()) { String result = jedis.set(key, "b", SetParams.setParams().nx().ex(1L)); Assertions.assertEquals(result, "OK"); @@ -158,7 +160,7 @@ public void testSetExNxAsp() { @Test public void testDelAsp() { - String key = String.valueOf(ThreadLocalRandom.current().nextInt(50000)); + String key = String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue)); try (Jedis jedis = JedisPooledFactory.getJedisInstance()) { String result = jedis.set(key, "b"); Assertions.assertEquals(result, "OK"); @@ -171,7 +173,7 @@ public void testDelAsp() { public void testBatchDelAsp() { List keys = new ArrayList<>(); for (int i = 0; i < 2; i++) { - keys.add(String.valueOf(ThreadLocalRandom.current().nextInt(50000))); + keys.add(String.valueOf(ThreadLocalRandom.current().nextInt(RandomValue))); } try (Jedis jedis = JedisPooledFactory.getJedisInstance()) { String result = jedis.set(keys.get(0), "b");