From 09718d7b11b73b053116d8c2d6b00fdee3724474 Mon Sep 17 00:00:00 2001 From: dengliming Date: Sun, 10 Mar 2024 02:20:02 +0800 Subject: [PATCH] fix ci --- .github/workflows/build.yml | 24 +++++++++-- .../common/test/RedisConditions.java | 11 ++--- .../common/test/RedisConditionsDecoder.java | 43 ------------------- .../redismodule/redisbloom/TopKFilter.java | 2 +- .../redismodule/redisearch/RediSearch.java | 2 +- .../redismodule/redisgears/AbstractTest.java | 3 +- .../redismodule/redisgraph/AbstractTest.java | 3 +- .../redisgraph/RedisGraphTest.java | 2 +- 8 files changed, 34 insertions(+), 56 deletions(-) delete mode 100644 commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditionsDecoder.java diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e43eef9..bd7f69f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,8 @@ jobs: build: runs-on: ubuntu-latest services: - redismod: - image: redislabs/redismod:edge + redis-stack-server: + image: redis/redis-stack-server:edge options: >- --health-cmd "redis-cli ping" --health-interval 10s @@ -30,6 +30,24 @@ jobs: --health-retries 5 ports: - 52568:6379 + redisgears: + image: redislabs/redisgears:latest + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6383:6379 + redisgraph: + image: redislabs/redisgraph:edge + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6384:6379 steps: - uses: actions/checkout@v2 - name: Set up JDK 1.8 @@ -44,5 +62,5 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - name: Build with Maven - run: mvn clean install -DREDIS_HOST=localhost -DREDIS_PORT=52567 -DREDISAI_PORT=52568 -Dgpg.skip --file pom.xml + run: mvn clean install -DREDIS_HOST=localhost -DREDIS_PORT=52567 -DREDISAI_PORT=52568 -DREDIS_GEARS_PORT=6383 -DREDIS_GRAPH_PORT=6384 -Dgpg.skip --file pom.xml - uses: codecov/codecov-action@v1 diff --git a/commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditions.java b/commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditions.java index c0eb775..66f47c5 100644 --- a/commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditions.java +++ b/commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 dengliming. + * Copyright 2022-2024 dengliming. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,9 @@ import org.redisson.client.codec.StringCodec; import org.redisson.client.protocol.RedisCommand; import org.redisson.client.protocol.decoder.ListMultiDecoder2; +import org.redisson.client.protocol.decoder.MapKeyDecoder; import org.redisson.client.protocol.decoder.ObjectListReplayDecoder; +import org.redisson.client.protocol.decoder.ObjectSetReplayDecoder; import org.redisson.client.protocol.decoder.StringListReplayDecoder; import org.redisson.command.CommandAsyncExecutor; @@ -28,12 +30,11 @@ public class RedisConditions { - private static final RedisCommand COMMAND = new RedisCommand<>("COMMAND", - new ListMultiDecoder2<>(new RedisConditionsDecoder(), new ObjectListReplayDecoder<>(), - new StringListReplayDecoder())); + private static final RedisCommand COMMAND = new RedisCommand<>("COMMAND", "LIST", + new MapKeyDecoder(new ObjectSetReplayDecoder())); private static final RedisCommand MODULE_LIST = new RedisCommand<>("MODULE", "LIST", - new ListMultiDecoder2<>(new ModuleListDecoder(), new ObjectListReplayDecoder<>())); + new ListMultiDecoder2<>(new ModuleListDecoder(), new ObjectListReplayDecoder<>(), new StringListReplayDecoder())); private final Set commands; diff --git a/commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditionsDecoder.java b/commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditionsDecoder.java deleted file mode 100644 index d7d3f97..0000000 --- a/commons/src/test/java/io/github/dengliming/redismodule/common/test/RedisConditionsDecoder.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 dengliming. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.github.dengliming.redismodule.common.test; - -import org.redisson.client.handler.State; -import org.redisson.client.protocol.decoder.MultiDecoder; - -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -public class RedisConditionsDecoder implements MultiDecoder> { - - @Override - public Set decode(List parts, State state) { - if (parts == null || parts.size() == 0) { - return null; - } - Set commands = parts.stream() - .map(p -> (List) p) - .filter(Objects::nonNull) - .filter(it -> it.size() > 0) - .map(values -> values.get(0).toLowerCase()) - .collect(Collectors.toSet()); - return commands; - } -} - diff --git a/redisbloom/src/main/java/io/github/dengliming/redismodule/redisbloom/TopKFilter.java b/redisbloom/src/main/java/io/github/dengliming/redismodule/redisbloom/TopKFilter.java index 8f2e803..60be1b3 100644 --- a/redisbloom/src/main/java/io/github/dengliming/redismodule/redisbloom/TopKFilter.java +++ b/redisbloom/src/main/java/io/github/dengliming/redismodule/redisbloom/TopKFilter.java @@ -140,7 +140,7 @@ public List list() { } public RFuture> listAsync() { - return commandExecutor.readAsync(getName(), codec, TOPK_LIST, getName()); + return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, TOPK_LIST, getName()); } /** diff --git a/redisearch/src/main/java/io/github/dengliming/redismodule/redisearch/RediSearch.java b/redisearch/src/main/java/io/github/dengliming/redismodule/redisearch/RediSearch.java index af428b1..3efac2e 100644 --- a/redisearch/src/main/java/io/github/dengliming/redismodule/redisearch/RediSearch.java +++ b/redisearch/src/main/java/io/github/dengliming/redismodule/redisearch/RediSearch.java @@ -386,7 +386,7 @@ public Map getConfig(ConfigOption option) { public RFuture> getConfigAsync(ConfigOption option) { RAssert.notNull(option, "ConfigOption must be not null"); - return commandExecutor.readAsync(getName(), codec, FT_CONFIG_GET, option.getKeyword()); + return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, FT_CONFIG_GET, option.getKeyword()); } public Map getHelp(ConfigOption option) { diff --git a/redisgears/src/test/java/io/github/dengliming/redismodule/redisgears/AbstractTest.java b/redisgears/src/test/java/io/github/dengliming/redismodule/redisgears/AbstractTest.java index 97931c6..5986691 100644 --- a/redisgears/src/test/java/io/github/dengliming/redismodule/redisgears/AbstractTest.java +++ b/redisgears/src/test/java/io/github/dengliming/redismodule/redisgears/AbstractTest.java @@ -32,7 +32,8 @@ public abstract class AbstractTest { @BeforeEach public void init() { Config config = new Config(); - config.useSingleServer().setAddress("redis://" + TestSettings.host() + ":" + TestSettings.port()); + config.useSingleServer().setAddress("redis://" + TestSettings.host() + ":" + System.getProperty("REDIS_GEARS_PORT", + TestSettings.port() + "")); redisGearsClient = new RedisGearsClient(config); redisGearsClient.flushall(); } diff --git a/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/AbstractTest.java b/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/AbstractTest.java index 87a7663..5235eab 100644 --- a/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/AbstractTest.java +++ b/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/AbstractTest.java @@ -32,7 +32,8 @@ public abstract class AbstractTest { @BeforeEach public void init() { Config config = new Config(); - config.useSingleServer().setAddress("redis://" + TestSettings.host() + ":" + TestSettings.port()); + config.useSingleServer().setAddress("redis://" + TestSettings.host() + ":" + System.getProperty("REDIS_GRAPH_PORT", + TestSettings.port() + "")); redisGraphClient = new RedisGraphClient(config); redisGraphClient.flushall(); } diff --git a/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/RedisGraphTest.java b/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/RedisGraphTest.java index 17cac6c..b4f3138 100644 --- a/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/RedisGraphTest.java +++ b/redisgraph/src/test/java/io/github/dengliming/redismodule/redisgraph/RedisGraphTest.java @@ -49,7 +49,7 @@ public void testDelete() { RedisGraph redisGraph = getRedisGraph(); assertThat(redisGraph.query("social", "CREATE (:person{name:'roi',age:32, doubleValue:3.14, boolValue:true})", -1)).isNotNull(); - assertThat(redisGraph.delete("social")).contains("Graph removed"); + assertThat(redisGraph.delete("social")).contains("OK"); } @Test