mirror of https://github.com/dapr/java-sdk.git
Update docker version for CI to fix flaky tests (#1276)
* update docker version for ci Signed-off-by: salaboy <Salaboy@gmail.com> * adding DOCKER_HOST to all tests Signed-off-by: salaboy <Salaboy@gmail.com> * Move dependency management and plugin management to parent pom (#1260) * Clean up pom Signed-off-by: sirivarma <siri.varma@outlook.com> * downgrade dependency Signed-off-by: sirivarma <siri.varma@outlook.com> * Fix Signed-off-by: sirivarma <siri.varma@outlook.com> * Fix thigns Signed-off-by: sirivarma <siri.varma@outlook.com> * Fix class not found Signed-off-by: sirivarma <siri.varma@outlook.com> * Remove import Signed-off-by: sirivarma <siri.varma@outlook.com> * Address comments Signed-off-by: Siri Varma Vegiraju <svegiraju@microsoft.com> * cleanup Signed-off-by: Siri Varma Vegiraju <svegiraju@microsoft.com> * Fix deps Signed-off-by: siri-varma <siri.varma@outlook.com> * cleanup Signed-off-by: Siri Varma Vegiraju <svegiraju@microsoft.com> Signed-off-by: siri-varma <siri.varma@outlook.com> * Fix deps Signed-off-by: siri-varma <siri.varma@outlook.com> * Fix things Signed-off-by: siri-varma <siri.varma@outlook.com> * Fix finals Signed-off-by: siri-varma <siri.varma@outlook.com> * Fix finals Signed-off-by: siri-varma <siri.varma@outlook.com> * upgrade test containers to .5 Signed-off-by: sirivarma <siri.varma@outlook.com> * This is it Signed-off-by: sirivarma <siri.varma@outlook.com> * Fix feedback Signed-off-by: sirivarma <siri.varma@outlook.com> * Add comment Signed-off-by: sirivarma <siri.varma@outlook.com> * Add comment Signed-off-by: sirivarma <siri.varma@outlook.com> * Change to properties Signed-off-by: sirivarma <siri.varma@outlook.com> --------- Signed-off-by: sirivarma <siri.varma@outlook.com> Signed-off-by: Siri Varma Vegiraju <svegiraju@microsoft.com> Signed-off-by: siri-varma <siri.varma@outlook.com> Co-authored-by: Siri Varma Vegiraju <svegiraju@microsoft.com> Co-authored-by: salaboy <Salaboy@gmail.com> Co-authored-by: artur-ciocanu <artur.ciocanu@gmail.com> Co-authored-by: Cassie Coyle <cassie@diagrid.io> Signed-off-by: salaboy <Salaboy@gmail.com> * fixing flaky docker network Signed-off-by: salaboy <Salaboy@gmail.com> --------- Signed-off-by: salaboy <Salaboy@gmail.com> Signed-off-by: sirivarma <siri.varma@outlook.com> Signed-off-by: Siri Varma Vegiraju <svegiraju@microsoft.com> Signed-off-by: siri-varma <siri.varma@outlook.com> Co-authored-by: Siri Varma Vegiraju <siri.varma@outlook.com> Co-authored-by: Siri Varma Vegiraju <svegiraju@microsoft.com> Co-authored-by: artur-ciocanu <artur.ciocanu@gmail.com> Co-authored-by: Cassie Coyle <cassie@diagrid.io>
This commit is contained in:
parent
7b82d7336b
commit
7990ed79ec
|
@ -45,6 +45,11 @@ jobs:
|
|||
DAPR_REF:
|
||||
TOXIPROXY_URL: https://github.com/Shopify/toxiproxy/releases/download/v2.5.0/toxiproxy-server-linux-amd64
|
||||
steps:
|
||||
- name: Install Stable Docker
|
||||
id: setup_docker
|
||||
uses: docker/setup-docker-action@v4
|
||||
- name: Check Docker version
|
||||
run: docker version
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up OpenJDK ${{ env.JDK_VER }}
|
||||
uses: actions/setup-java@v4
|
||||
|
@ -113,6 +118,8 @@ jobs:
|
|||
run: ./mvnw compile -B -q
|
||||
- name: Unit tests
|
||||
run: ./mvnw test # making it temporarily verbose.
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Codecov
|
||||
uses: codecov/codecov-action@v4.4.1
|
||||
- name: Install jars
|
||||
|
@ -120,6 +127,8 @@ jobs:
|
|||
- name: Integration tests using spring boot version ${{ matrix.spring-boot-version }}
|
||||
id: integration_tests
|
||||
run: PRODUCT_SPRING_BOOT_VERSION=${{ matrix.spring-boot-version }} ./mvnw -B -Pintegration-tests verify
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Upload test report for sdk
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
|
|
@ -49,6 +49,11 @@ jobs:
|
|||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: ${{ env.JDK_VER }}
|
||||
- name: Install Stable Docker
|
||||
id: setup_docker
|
||||
uses: docker/setup-docker-action@v4
|
||||
- name: Check Docker version
|
||||
run: docker version
|
||||
- name: Set up Dapr CLI
|
||||
run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }}
|
||||
- name: Set up Go ${{ env.GOVER }}
|
||||
|
@ -108,63 +113,95 @@ jobs:
|
|||
run: ./mvnw compile -q
|
||||
- name: Install jars
|
||||
run: ./mvnw install -q
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate invoke http example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/invoke/http/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate invoke grpc example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/invoke/grpc/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate tracing example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/tracing/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate expection handling example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/exception/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate state example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/state/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate pubsub example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/pubsub/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate bindings HTTP example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/bindings/http/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate secrets example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/secrets/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate unit testing example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/unittesting/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate Configuration API example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/configuration/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate actors example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/actors/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate query state HTTP example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/querystate/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate workflows example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/workflows/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate streaming subscription example
|
||||
working-directory: ./examples
|
||||
run: |
|
||||
mm.py ./src/main/java/io/dapr/examples/pubsub/stream/README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
- name: Validate Spring Boot examples
|
||||
working-directory: ./spring-boot-examples
|
||||
run: |
|
||||
mm.py README.md
|
||||
mm.py README.md
|
||||
env:
|
||||
DOCKER_HOST: ${{steps.setup_docker.outputs.sock}}
|
||||
|
|
|
@ -35,31 +35,36 @@ import java.util.Map;
|
|||
public class DaprTestContainersConfig {
|
||||
|
||||
@Bean
|
||||
public Network getDaprNetwork() {
|
||||
Network defaultDaprNetwork = new Network() {
|
||||
@Override
|
||||
public String getId() {
|
||||
return "dapr-network";
|
||||
public Network getDaprNetwork(Environment env) {
|
||||
boolean reuse = env.getProperty("reuse", Boolean.class, false);
|
||||
if (reuse) {
|
||||
Network defaultDaprNetwork = new Network() {
|
||||
@Override
|
||||
public String getId() {
|
||||
return "dapr-network";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
List<com.github.dockerjava.api.model.Network> networks = DockerClientFactory.instance().client().listNetworksCmd()
|
||||
.withNameFilter("dapr-network").exec();
|
||||
if (networks.isEmpty()) {
|
||||
Network.builder().createNetworkCmdModifier(cmd -> cmd.withName("dapr-network")).build().getId();
|
||||
return defaultDaprNetwork;
|
||||
} else {
|
||||
return defaultDaprNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
List<com.github.dockerjava.api.model.Network> networks = DockerClientFactory.instance().client().listNetworksCmd()
|
||||
.withNameFilter("dapr-network").exec();
|
||||
if (networks.isEmpty()) {
|
||||
Network.builder().createNetworkCmdModifier(cmd -> cmd.withName("dapr-network")).build().getId();
|
||||
return defaultDaprNetwork;
|
||||
} else {
|
||||
return defaultDaprNetwork;
|
||||
return Network.newNetwork();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,10 +72,10 @@ public class DaprTestContainersConfig {
|
|||
public RabbitMQContainer rabbitMQContainer(Network daprNetwork, Environment env) {
|
||||
boolean reuse = env.getProperty("reuse", Boolean.class, false);
|
||||
return new RabbitMQContainer(DockerImageName.parse("rabbitmq:3.7.25-management-alpine"))
|
||||
.withExposedPorts(5672)
|
||||
.withNetworkAliases("rabbitmq")
|
||||
.withReuse(reuse)
|
||||
.withNetwork(daprNetwork);
|
||||
.withExposedPorts(5672)
|
||||
.withNetworkAliases("rabbitmq")
|
||||
.withReuse(reuse)
|
||||
.withNetwork(daprNetwork);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -83,16 +88,15 @@ public class DaprTestContainersConfig {
|
|||
rabbitMqProperties.put("password", "guest");
|
||||
|
||||
return new DaprContainer("daprio/daprd:1.14.4")
|
||||
.withAppName("consumer-app")
|
||||
.withNetwork(daprNetwork).withComponent(new Component("pubsub",
|
||||
"pubsub.rabbitmq", "v1", rabbitMqProperties))
|
||||
.withDaprLogLevel(DaprLogLevel.INFO)
|
||||
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
|
||||
.withAppPort(8081).withAppChannelAddress("host.testcontainers.internal")
|
||||
.withReusablePlacement(reuse)
|
||||
.withAppHealthCheckPath("/actuator/health")
|
||||
.dependsOn(rabbitMQContainer);
|
||||
.withAppName("consumer-app")
|
||||
.withNetwork(daprNetwork).withComponent(new Component("pubsub",
|
||||
"pubsub.rabbitmq", "v1", rabbitMqProperties))
|
||||
.withDaprLogLevel(DaprLogLevel.INFO)
|
||||
.withLogConsumer(outputFrame -> System.out.println(outputFrame.getUtf8String()))
|
||||
.withAppPort(8081).withAppChannelAddress("host.testcontainers.internal")
|
||||
.withReusablePlacement(reuse)
|
||||
.withAppHealthCheckPath("/actuator/health")
|
||||
.dependsOn(rabbitMQContainer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -44,32 +44,36 @@ public class DaprTestContainersConfig {
|
|||
|
||||
|
||||
@Bean
|
||||
public Network getNetwork() {
|
||||
Network defaultDaprNetwork = new Network() {
|
||||
@Override
|
||||
public String getId() {
|
||||
return "dapr-network";
|
||||
public Network getDaprNetwork(Environment env) {
|
||||
boolean reuse = env.getProperty("reuse", Boolean.class, false);
|
||||
if (reuse) {
|
||||
Network defaultDaprNetwork = new Network() {
|
||||
@Override
|
||||
public String getId() {
|
||||
return "dapr-network";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
List<com.github.dockerjava.api.model.Network> networks = DockerClientFactory.instance().client().listNetworksCmd()
|
||||
.withNameFilter("dapr-network").exec();
|
||||
if (networks.isEmpty()) {
|
||||
Network.builder().createNetworkCmdModifier(cmd -> cmd.withName("dapr-network")).build().getId();
|
||||
return defaultDaprNetwork;
|
||||
} else {
|
||||
return defaultDaprNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
List<com.github.dockerjava.api.model.Network> networks = DockerClientFactory.instance().client().listNetworksCmd().withNameFilter("dapr-network").exec();
|
||||
if (networks.isEmpty()) {
|
||||
Network.builder()
|
||||
.createNetworkCmdModifier(cmd -> cmd.withName("dapr-network"))
|
||||
.build().getId();
|
||||
return defaultDaprNetwork;
|
||||
} else {
|
||||
return defaultDaprNetwork;
|
||||
return Network.newNetwork();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue