mirror of https://github.com/dapr/java-sdk.git
Make the DAPR version being used consistent across all tests (#1299)
This commit is contained in:
parent
9b635dae6d
commit
8b8684a2db
|
@ -39,7 +39,7 @@ jobs:
|
|||
GOPROXY: https://proxy.golang.org
|
||||
JDK_VER: ${{ matrix.java }}
|
||||
DAPR_CLI_VER: 1.15.0
|
||||
DAPR_RUNTIME_VER: 1.15.3
|
||||
DAPR_RUNTIME_VER: 1.15.4
|
||||
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.15.0/install/install.sh
|
||||
DAPR_CLI_REF:
|
||||
DAPR_REF:
|
||||
|
|
|
@ -38,7 +38,7 @@ jobs:
|
|||
GOPROXY: https://proxy.golang.org
|
||||
JDK_VER: ${{ matrix.java }}
|
||||
DAPR_CLI_VER: 1.15.0
|
||||
DAPR_RUNTIME_VER: 1.15.3
|
||||
DAPR_RUNTIME_VER: 1.15.4
|
||||
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/v1.15.0/install/install.sh
|
||||
DAPR_CLI_REF:
|
||||
DAPR_REF:
|
||||
|
|
|
@ -80,7 +80,7 @@ public class DaprTestContainersConfig {
|
|||
@ServiceConnection
|
||||
public DaprContainer daprContainer(Network daprNetwork, PostgreSQLContainer<?> postgreSQLContainer){
|
||||
|
||||
return new DaprContainer("daprio/daprd:1.14.1")
|
||||
return new DaprContainer("daprio/daprd:1.15.4")
|
||||
.withAppName("producer-app")
|
||||
.withNetwork(daprNetwork)
|
||||
.withComponent(new Component("kvstore", "state.postgresql", "v1", STATE_STORE_PROPERTIES))
|
||||
|
@ -235,7 +235,7 @@ Finally, because Dapr PubSub requires a bidirectional connection between your ap
|
|||
@ServiceConnection
|
||||
public DaprContainer daprContainer(Network daprNetwork, PostgreSQLContainer<?> postgreSQLContainer, RabbitMQContainer rabbitMQContainer){
|
||||
|
||||
return new DaprContainer("daprio/daprd:1.14.1")
|
||||
return new DaprContainer("daprio/daprd:1.15.4")
|
||||
.withAppName("producer-app")
|
||||
.withNetwork(daprNetwork)
|
||||
.withComponent(new Component("kvstore", "state.postgresql", "v1", STATE_STORE_PROPERTIES))
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -17,7 +17,7 @@
|
|||
<grpc.version>1.69.0</grpc.version>
|
||||
<protobuf.version>3.25.5</protobuf.version>
|
||||
<protocCommand>protoc</protocCommand>
|
||||
<dapr.proto.baseurl>https://raw.githubusercontent.com/dapr/dapr/v1.15.3/dapr/proto</dapr.proto.baseurl>
|
||||
<dapr.proto.baseurl>https://raw.githubusercontent.com/dapr/dapr/v1.15.4/dapr/proto</dapr.proto.baseurl>
|
||||
<dapr.sdk.version>1.15.0-SNAPSHOT</dapr.sdk.version>
|
||||
<dapr.sdk.alpha.version>0.15.0-SNAPSHOT</dapr.sdk.alpha.version>
|
||||
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
|
||||
package io.dapr.springboot;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
@RequestMapping(value = {"v1", "v2"})
|
||||
public class MockController {
|
||||
|
|
|
@ -58,8 +58,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
|
|||
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
|
||||
import static io.dapr.it.resiliency.SdkResiliencyIT.WIREMOCK_PORT;
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.DAPR_IMAGE_TAG;
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.TOXIPROXY_IMAGE_TAG;
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
|
@ -74,7 +73,7 @@ public class SdkResiliencyIT {
|
|||
private static final int INFINITE_RETRY = -1;
|
||||
|
||||
@Container
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(WIREMOCK_PORT)
|
||||
.withDaprLogLevel(DaprLogLevel.DEBUG)
|
||||
|
@ -85,7 +84,7 @@ public class SdkResiliencyIT {
|
|||
.withNetwork(NETWORK);
|
||||
|
||||
@Container
|
||||
private static final ToxiproxyContainer TOXIPROXY = new ToxiproxyContainer(TOXIPROXY_IMAGE_TAG)
|
||||
private static final ToxiproxyContainer TOXIPROXY = new ToxiproxyContainer("ghcr.io/shopify/toxiproxy:2.5.0")
|
||||
.withNetwork(NETWORK);
|
||||
|
||||
private static Proxy proxy;
|
||||
|
|
|
@ -35,8 +35,10 @@ import java.util.Map;
|
|||
|
||||
import static io.dapr.it.spring.data.DaprSpringDataConstants.BINDING_NAME;
|
||||
import static io.dapr.it.spring.data.DaprSpringDataConstants.STATE_STORE_NAME;
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.DAPR_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link DaprKeyValueRepositoryIT}.
|
||||
|
@ -65,7 +67,7 @@ public class DaprKeyValueRepositoryIT {
|
|||
|
||||
@Container
|
||||
@ServiceConnection
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("postgresql-repository-dapr-app")
|
||||
.withNetwork(DAPR_NETWORK)
|
||||
.withComponent(new Component(STATE_STORE_NAME, "state.postgresql", "v1", STATE_STORE_PROPERTIES))
|
||||
|
|
|
@ -44,7 +44,7 @@ import java.util.Optional;
|
|||
|
||||
import static io.dapr.it.spring.data.DaprSpringDataConstants.STATE_STORE_NAME;
|
||||
import static io.dapr.it.spring.data.DaprSpringDataConstants.BINDING_NAME;
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.DAPR_IMAGE_TAG;
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class MySQLDaprKeyValueTemplateIT {
|
|||
|
||||
@Container
|
||||
@ServiceConnection
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("mysql-dapr-app")
|
||||
.withNetwork(DAPR_NETWORK)
|
||||
.withComponent(new Component(STATE_STORE_NAME, "state.mysql", "v1", STATE_STORE_PROPERTIES))
|
||||
|
|
|
@ -32,11 +32,15 @@ import org.testcontainers.containers.PostgreSQLContainer;
|
|||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static io.dapr.it.spring.data.DaprSpringDataConstants.BINDING_NAME;
|
||||
import static io.dapr.it.spring.data.DaprSpringDataConstants.STATE_STORE_NAME;
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.DAPR_IMAGE_TAG;
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
@ -67,7 +71,7 @@ public class PostgreSQLDaprKeyValueTemplateIT {
|
|||
|
||||
@Container
|
||||
@ServiceConnection
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("postgresql-dapr-app")
|
||||
.withNetwork(DAPR_NETWORK)
|
||||
.withComponent(new Component(STATE_STORE_NAME, "state.postgresql", "v1", STATE_STORE_PROPERTIES))
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.DAPR_IMAGE_TAG;
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(
|
||||
|
@ -61,7 +61,7 @@ public class DaprSpringMessagingIT {
|
|||
|
||||
@Container
|
||||
@ServiceConnection
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("messaging-dapr-app")
|
||||
.withNetwork(DAPR_NETWORK)
|
||||
.withComponent(new Component("pubsub", "pubsub.in-memory", "v1", Collections.emptyMap()))
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package io.dapr.it.testcontainers;
|
||||
|
||||
public interface ContainerConstants {
|
||||
String TOXIPROXY_IMAGE_TAG = "ghcr.io/shopify/toxiproxy:2.5.0";
|
||||
String DAPR_RUNTIME_VERSION = "1.15.3";
|
||||
String DAPR_IMAGE_TAG = "daprio/daprd:" + DAPR_RUNTIME_VERSION;
|
||||
String DAPR_PLACEMENT_IMAGE_TAG = "daprio/placement:" + DAPR_RUNTIME_VERSION;
|
||||
String DAPR_SCHEDULER_IMAGE_TAG = "daprio/scheduler:" + DAPR_RUNTIME_VERSION;
|
||||
}
|
|
@ -37,6 +37,7 @@ import java.util.Map;
|
|||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@SpringBootTest(
|
||||
|
@ -53,10 +54,10 @@ public class DaprActorsIT {
|
|||
private static final Random RANDOM = new Random();
|
||||
private static final int PORT = RANDOM.nextInt(1000) + 8000;
|
||||
|
||||
private static final String ACTORS_MESSAGE_PATTERN = ".*Actor API level in the cluster has been updated to 10.*";
|
||||
private static final String ACTORS_MESSAGE_PATTERN = ".*Actor runtime started.*";
|
||||
|
||||
@Container
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer("daprio/daprd:1.14.4")
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("actor-dapr-app")
|
||||
.withNetwork(DAPR_NETWORK)
|
||||
.withComponent(new Component("kvstore", "state.in-memory", "v1",
|
||||
|
@ -88,7 +89,8 @@ public class DaprActorsIT {
|
|||
public void setUp(){
|
||||
org.testcontainers.Testcontainers.exposeHostPorts(PORT);
|
||||
daprActorRuntime.registerActor(TestActorImpl.class);
|
||||
// Ensure the subscriptions are registered
|
||||
|
||||
// Wait for actor runtime to start.
|
||||
Wait.forLogMessage(ACTORS_MESSAGE_PATTERN, 1).waitUntilReady(DAPR_CONTAINER);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package io.dapr.it.testcontainers;
|
||||
|
||||
public interface DaprContainerConstants {
|
||||
String DAPR_RUNTIME_VERSION = "1.15.4";
|
||||
String DAPR_RUNTIME_IMAGE_TAG = "daprio/daprd:" + DAPR_RUNTIME_VERSION;
|
||||
String DAPR_PLACEMENT_IMAGE_TAG = "daprio/placement:" + DAPR_RUNTIME_VERSION;
|
||||
String DAPR_SCHEDULER_IMAGE_TAG = "daprio/scheduler:" + DAPR_RUNTIME_VERSION;
|
||||
}
|
|
@ -18,7 +18,6 @@ import io.dapr.client.DaprClient;
|
|||
import io.dapr.client.DaprClientBuilder;
|
||||
import io.dapr.client.domain.Metadata;
|
||||
import io.dapr.client.domain.State;
|
||||
|
||||
import io.dapr.config.Properties;
|
||||
import io.dapr.testcontainers.DaprContainer;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
@ -27,7 +26,6 @@ import org.junit.jupiter.api.Test;
|
|||
import org.testcontainers.containers.wait.strategy.Wait;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
|
||||
import org.testcontainers.shaded.org.awaitility.core.ConditionTimeoutException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -49,10 +47,11 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
|
|||
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
|
||||
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.DAPR_IMAGE_TAG;
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
|
||||
|
||||
|
||||
@Testcontainers
|
||||
|
@ -69,7 +68,7 @@ public class DaprContainerIT {
|
|||
private static final String APP_FOUND_MESSAGE_PATTERN = ".*application discovered on port 8081.*";
|
||||
|
||||
@Container
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withAppHealthCheckPath("/actuator/health")
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.testcontainers.junit.jupiter.Container;
|
|||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
@ -58,7 +57,7 @@ public class DaprJobsIT {
|
|||
private static final int PORT = RANDOM.nextInt(1000) + 8000;
|
||||
|
||||
@Container
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(ContainerConstants.DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("jobs-dapr-app")
|
||||
.withNetwork(DAPR_NETWORK)
|
||||
.withDaprLogLevel(DaprLogLevel.DEBUG)
|
||||
|
|
|
@ -27,7 +27,7 @@ public class DaprPlacementContainerIT {
|
|||
|
||||
@Container
|
||||
private static final DaprPlacementContainer PLACEMENT_CONTAINER =
|
||||
new DaprPlacementContainer(ContainerConstants.DAPR_PLACEMENT_IMAGE_TAG);
|
||||
new DaprPlacementContainer(DaprContainerConstants.DAPR_PLACEMENT_IMAGE_TAG);
|
||||
|
||||
@Test
|
||||
public void testDaprPlacementContainerDefaults() {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2024 The Dapr Authors
|
||||
* 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.dapr.it.testcontainers;
|
||||
|
||||
import io.dapr.testcontainers.DaprSchedulerContainer;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@Testcontainers
|
||||
@Tag("testcontainers")
|
||||
public class DaprSchedulerContainerIT {
|
||||
|
||||
@Container
|
||||
private static final DaprSchedulerContainer SCHEDULER_CONTAINER =
|
||||
new DaprSchedulerContainer(DaprContainerConstants.DAPR_SCHEDULER_IMAGE_TAG);
|
||||
|
||||
@Test
|
||||
public void testDaprSchedulerContainerDefaults() {
|
||||
assertEquals(51005, SCHEDULER_CONTAINER.getPort(), "The default port is not set");
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.dapr.it.testcontainers.ContainerConstants.DAPR_IMAGE_TAG;
|
||||
import static io.dapr.it.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class DaprWorkflowsIT {
|
|||
private static final Network DAPR_NETWORK = Network.newNetwork();
|
||||
|
||||
@Container
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_IMAGE_TAG)
|
||||
private static final DaprContainer DAPR_CONTAINER = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("workflow-dapr-app")
|
||||
.withNetwork(DAPR_NETWORK)
|
||||
.withComponent(new Component("kvstore", "state.in-memory", "v1",
|
||||
|
|
|
@ -31,6 +31,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
public class DaprTestContainersConfig {
|
||||
|
||||
|
@ -87,7 +89,7 @@ public class DaprTestContainersConfig {
|
|||
rabbitMqProperties.put("user", "guest");
|
||||
rabbitMqProperties.put("password", "guest");
|
||||
|
||||
return new DaprContainer("daprio/daprd:1.14.4")
|
||||
return new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("consumer-app")
|
||||
.withNetwork(daprNetwork).withComponent(new Component("pubsub",
|
||||
"pubsub.rabbitmq", "v1", rabbitMqProperties))
|
||||
|
|
|
@ -30,7 +30,7 @@ Once you have the cluster up and running you can install Dapr:
|
|||
helm repo add dapr https://dapr.github.io/helm-charts/
|
||||
helm repo update
|
||||
helm upgrade --install dapr dapr/dapr \
|
||||
--version=1.14.4 \
|
||||
--version=1.15.4 \
|
||||
--namespace dapr-system \
|
||||
--create-namespace \
|
||||
--wait
|
||||
|
|
|
@ -33,6 +33,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
|
||||
@TestConfiguration(proxyBeanMethods = false)
|
||||
public class DaprTestContainersConfig {
|
||||
|
||||
|
@ -110,7 +112,7 @@ public class DaprTestContainersConfig {
|
|||
rabbitMqProperties.put("user", "guest");
|
||||
rabbitMqProperties.put("password", "guest");
|
||||
|
||||
return new DaprContainer("daprio/daprd:1.14.4")
|
||||
return new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("producer-app")
|
||||
.withNetwork(daprNetwork)
|
||||
.withComponent(new Component("kvstore", "state.postgresql", "v1", STATE_STORE_PROPERTIES))
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.testcontainers.containers.wait.strategy.Wait;
|
|||
import org.testcontainers.containers.wait.strategy.WaitStrategy;
|
||||
import org.testcontainers.images.builder.Transferable;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
import org.testcontainers.utility.MountableFile;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -41,12 +40,17 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_PLACEMENT_IMAGE_TAG;
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_SCHEDULER_IMAGE_TAG;
|
||||
|
||||
public class DaprContainer extends GenericContainer<DaprContainer> {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaprContainer.class);
|
||||
private static final int DAPRD_DEFAULT_HTTP_PORT = 3500;
|
||||
private static final int DAPRD_DEFAULT_GRPC_PORT = 50001;
|
||||
private static final DaprProtocol DAPR_PROTOCOL = DaprProtocol.HTTP;
|
||||
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("daprio/daprd");
|
||||
private static final DockerImageName DEFAULT_IMAGE_NAME =
|
||||
DockerImageName.parse(DAPR_RUNTIME_IMAGE_TAG);
|
||||
private static final Yaml YAML_MAPPER = YamlMapperFactory.create();
|
||||
private static final YamlConverter<Component> COMPONENT_CONVERTER = new ComponentYamlConverter(YAML_MAPPER);
|
||||
private static final YamlConverter<Subscription> SUBSCRIPTION_CONVERTER = new SubscriptionYamlConverter(YAML_MAPPER);
|
||||
|
@ -64,8 +68,8 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
|
|||
private String appChannelAddress = "localhost";
|
||||
private String placementService = "placement";
|
||||
private String schedulerService = "scheduler";
|
||||
private String placementDockerImageName = "daprio/placement";
|
||||
private String schedulerDockerImageName = "daprio/scheduler";
|
||||
private String placementDockerImageName = DAPR_PLACEMENT_IMAGE_TAG;
|
||||
private String schedulerDockerImageName = DAPR_SCHEDULER_IMAGE_TAG;
|
||||
|
||||
private Configuration configuration;
|
||||
private DaprPlacementContainer placementContainer;
|
||||
|
@ -137,6 +141,11 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withSchedulerService(String schedulerService) {
|
||||
this.schedulerService = schedulerService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withAppName(String appName) {
|
||||
this.appName = appName;
|
||||
return this;
|
||||
|
@ -162,6 +171,11 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withSchedulerImage(String schedulerDockerImageName) {
|
||||
this.schedulerDockerImageName = schedulerDockerImageName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withReusablePlacement(boolean shouldReusePlacement) {
|
||||
this.shouldReusePlacement = shouldReusePlacement;
|
||||
return this;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package io.dapr.testcontainers;
|
||||
|
||||
public interface DaprContainerConstants {
|
||||
String DAPR_VERSION = "1.15.4";
|
||||
String DAPR_PLACEMENT_IMAGE_TAG = "daprio/placement:" + DAPR_VERSION;
|
||||
String DAPR_SCHEDULER_IMAGE_TAG = "daprio/scheduler:" + DAPR_VERSION;
|
||||
String DAPR_RUNTIME_IMAGE_TAG = "daprio/daprd:" + DAPR_VERSION;
|
||||
}
|
|
@ -40,7 +40,7 @@ public class DaprSchedulerContainer extends GenericContainer<DaprSchedulerContai
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new Dapr scheduler container.
|
||||
* Creates a new Dapr schedulers container.
|
||||
* @param image Docker image name.
|
||||
*/
|
||||
public DaprSchedulerContainer(String image) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
|
||||
public class DaprComponentTest {
|
||||
private final Yaml MAPPER = YamlMapperFactory.create();
|
||||
|
@ -33,7 +34,7 @@ public class DaprComponentTest {
|
|||
|
||||
@Test
|
||||
public void containerConfigurationTest() {
|
||||
DaprContainer dapr = new DaprContainer("daprio/daprd")
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withDaprLogLevel(DaprLogLevel.DEBUG)
|
||||
|
@ -50,7 +51,7 @@ public class DaprComponentTest {
|
|||
URL stateStoreYaml = this.getClass().getClassLoader().getResource("dapr-resources/statestore.yaml");
|
||||
Path path = Paths.get(stateStoreYaml.getPath());
|
||||
|
||||
DaprContainer dapr = new DaprContainer("daprio/daprd")
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withComponent(path)
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.yaml.snakeyaml.Yaml;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
|
@ -17,7 +18,7 @@ class ComponentYamlConverterTest {
|
|||
|
||||
@Test
|
||||
public void testComponentToYaml() {
|
||||
DaprContainer dapr = new DaprContainer("daprio/daprd")
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withComponent(new Component(
|
||||
|
@ -50,7 +51,7 @@ class ComponentYamlConverterTest {
|
|||
|
||||
@Test
|
||||
public void testComponentWithInLineStringToYaml() {
|
||||
DaprContainer dapr = new DaprContainer("daprio/daprd")
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withComponent(new Component(
|
||||
|
|
|
@ -22,6 +22,7 @@ import io.dapr.testcontainers.TracingConfigurationSettings;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class ConfigurationYamlConverterTest {
|
|||
|
||||
AppHttpPipeline appHttpPipeline = new AppHttpPipeline(handlers);
|
||||
|
||||
DaprContainer dapr = new DaprContainer("daprio/daprd")
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withConfiguration(new Configuration("my-config", tracing, appHttpPipeline))
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.yaml.snakeyaml.Yaml;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class HttpEndpointYamlConverterTest {
|
||||
|
@ -16,7 +17,7 @@ class HttpEndpointYamlConverterTest {
|
|||
|
||||
@Test
|
||||
void testHttpEndpointToYaml() {
|
||||
DaprContainer dapr = new DaprContainer("daprio/daprd")
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withHttpEndpoint(new HttpEndpoint("my-endpoint", "http://localhost:8080"))
|
||||
|
|
|
@ -7,7 +7,8 @@ import org.yaml.snakeyaml.Yaml;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static io.dapr.testcontainers.DaprContainerConstants.DAPR_RUNTIME_IMAGE_TAG;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class SubscriptionYamlConverterTest {
|
||||
private final Yaml MAPPER = YamlMapperFactory.create();
|
||||
|
@ -15,7 +16,7 @@ class SubscriptionYamlConverterTest {
|
|||
|
||||
@Test
|
||||
public void testSubscriptionToYaml() {
|
||||
DaprContainer dapr = new DaprContainer("daprio/daprd")
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withSubscription(new Subscription("my-subscription", "pubsub", "topic", "/events"))
|
||||
|
|
Loading…
Reference in New Issue