[SB3 Update] RedisSink use testcontainers

This commit is contained in:
Chris Bono
2022-10-17 17:05:24 -05:00
parent 01e2a81398
commit 4b2e2e05b5
2 changed files with 16 additions and 7 deletions

View File

@@ -24,12 +24,18 @@
<artifactId>redis-consumer</artifactId>
</dependency>
<dependency>
<groupId>com.playtika.testcontainers</groupId>
<artifactId>embedded-redis</artifactId>
<version>${embedded-redis.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud.fn</groupId>
<artifactId>redis-common</artifactId>
<version>4.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>

View File

@@ -25,6 +25,7 @@ import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.fn.consumer.redis.RedisConsumerConfiguration;
import org.springframework.cloud.fn.consumer.redis.RedisTestContainerSupport;
import org.springframework.cloud.stream.binder.test.InputDestination;
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
@@ -40,8 +41,9 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Soby Chacko
* @author Artem Bilan
* @author Chris Bono
*/
public class RedisSinkTests {
public class RedisSinkTests implements RedisTestContainerSupport {
@Test
public void testRedisSink() {
@@ -50,6 +52,7 @@ public class RedisSinkTests {
.getCompleteConfiguration(RedisSinkTestApplication.class))
.web(WebApplicationType.NONE)
.run("--spring.cloud.function.definition=redisConsumer",
"--spring.data.redis.url=" + RedisTestContainerSupport.getUri(),
"--redis.consumer.key=foo")) {
//Setup