Skip to content

Commit

Permalink
fix(tests): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgabelle committed Nov 5, 2024
1 parent d1c3000 commit 2f636d0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/main/java/io/kestra/plugin/redis/list/ListPop.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.executions.metrics.Counter;
import io.kestra.core.models.property.Property;
import io.kestra.core.models.tasks.RunnableTask;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.kestra.plugin.redis.list;

import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.property.Property;
import io.swagger.v3.oas.annotations.media.Schema;

Expand Down
10 changes: 6 additions & 4 deletions src/main/java/io/kestra/plugin/redis/string/Set.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.property.Property;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
Expand Down Expand Up @@ -63,8 +64,8 @@ public class Set extends AbstractRedisConnection implements RunnableTask<Set.Out
title = "Options available when setting a key in Redis.",
description = "See [redis documentation](https://redis.io/commands/set/)."
)
@Builder.Default
private Property<Options> options = Property.of(Options.builder().build());
@PluginProperty
private Options options;

@Schema(
title = "Define if you get the older value in response, does not work with Redis 5.X."
Expand All @@ -84,9 +85,10 @@ public Output run(RunContext runContext) throws Exception {
try (RedisFactory factory = this.redisFactory(runContext)) {
String oldValue = factory.set(
runContext.render(key).as(String.class).orElseThrow(),
runContext.render(serdeType).as(SerdeType.class).orElseThrow().serialize(runContext.render(value)),
runContext.render(serdeType).as(SerdeType.class).orElseThrow()
.serialize(runContext.render(value).as(String.class).orElseThrow()),
runContext.render(get).as(Boolean.class).orElse(false),
runContext.render(options).as(Options.class).orElse(Options.builder().build()).asRedisSet()
options.asRedisSet()
);

Output.OutputBuilder builder = Output.builder();
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/kestra/plugin/redis/ListPopTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ void setUp() throws Exception {
ListPush.builder()
.url(Property.of(REDIS_URI))
.key(Property.of("mypopkey"))
.from(Property.of(Arrays.asList("value1", "value2", "value3")))
.from(Arrays.asList("value1", "value2", "value3"))
.build().run(runContext);
ListPush.builder()
.url(Property.of(REDIS_URI))
.key(Property.of("mypopkeyjson"))
.from(Property.of(Arrays.asList("{\"city\":\"Paris\"}", "{\"city\":\"London\"}")))
.from(Arrays.asList("{\"city\":\"Paris\"}", "{\"city\":\"London\"}"))
.build().run(runContext);
}
}
4 changes: 2 additions & 2 deletions src/test/java/io/kestra/plugin/redis/PublishTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void testPublishAsList() throws Exception {
Publish task = Publish.builder()
.url(Property.of(REDIS_URI))
.channel(Property.of("mych"))
.from(Property.of(Arrays.asList("value1", "value2")))
.from(Arrays.asList("value1", "value2"))
.build();

Publish.Output runOutput = task.run(runContext);
Expand All @@ -61,7 +61,7 @@ void testPublishAsFile() throws Exception {
Publish task = Publish.builder()
.url(Property.of(REDIS_URI))
.channel(Property.of("mychFile"))
.from(Property.of(uri.toString()))
.from(uri.toString())
.build();

Publish.Output runOutput = task.run(runContext);
Expand Down

0 comments on commit 2f636d0

Please sign in to comment.