mirror of https://github.com/dapr/java-sdk.git
Merge branch 'master' into users/svegiraju/add-failure-policy
This commit is contained in:
commit
9c0c66e2de
|
|
@ -77,6 +77,9 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
|
|||
private String appName;
|
||||
private Integer appPort;
|
||||
private String appHealthCheckPath;
|
||||
private Integer appHealthCheckProbeInterval = 5; //default from docs
|
||||
private Integer appHealthCheckProbeTimeout = 500; //default from docs
|
||||
private Integer appHealthCheckThreshold = 3; //default from docs
|
||||
private boolean shouldReusePlacement;
|
||||
private boolean shouldReuseScheduler;
|
||||
|
||||
|
|
@ -133,6 +136,21 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withAppHealthCheckProbeInterval(Integer appHealthCheckProbeInterval) {
|
||||
this.appHealthCheckProbeInterval = appHealthCheckProbeInterval;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withAppHealthCheckProbeTimeout(Integer appHealthCheckProbeTimeout) {
|
||||
this.appHealthCheckProbeTimeout = appHealthCheckProbeTimeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withAppHealthCheckThreshold(Integer appHealthCheckThreshold) {
|
||||
this.appHealthCheckThreshold = appHealthCheckThreshold;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DaprContainer withConfiguration(Configuration configuration) {
|
||||
this.configuration = configuration;
|
||||
return this;
|
||||
|
|
@ -311,6 +329,16 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
|
|||
cmds.add("--enable-app-health-check");
|
||||
cmds.add("--app-health-check-path");
|
||||
cmds.add(appHealthCheckPath);
|
||||
|
||||
cmds.add("--app-health-probe-interval");
|
||||
cmds.add(Integer.toString(appHealthCheckProbeInterval));
|
||||
|
||||
cmds.add("--app-health-probe-timeout");
|
||||
cmds.add(Integer.toString(appHealthCheckProbeTimeout));
|
||||
|
||||
cmds.add("--app-health-threshold");
|
||||
cmds.add(Integer.toString(appHealthCheckThreshold));
|
||||
|
||||
}
|
||||
|
||||
if (configuration != null) {
|
||||
|
|
@ -385,6 +413,22 @@ public class DaprContainer extends GenericContainer<DaprContainer> {
|
|||
return appPort;
|
||||
}
|
||||
|
||||
public String getAppHealthCheckPath() {
|
||||
return appHealthCheckPath;
|
||||
}
|
||||
|
||||
public Integer getAppHealthCheckProbeInterval() {
|
||||
return appHealthCheckProbeInterval;
|
||||
}
|
||||
|
||||
public Integer getAppHealthCheckProbeTimeout() {
|
||||
return appHealthCheckProbeTimeout;
|
||||
}
|
||||
|
||||
public Integer getAppHealthCheckThreshold() {
|
||||
return appHealthCheckThreshold;
|
||||
}
|
||||
|
||||
public String getAppChannelAddress() {
|
||||
return appChannelAddress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,4 +44,38 @@ public class DaprContainerTest {
|
|||
assertEquals("daprio/scheduler:" + DAPR_VERSION, dapr.getSchedulerDockerImageName().asCanonicalNameString());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appHealthParametersTest(){
|
||||
DaprContainer dapr = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr-app")
|
||||
.withAppPort(8081)
|
||||
.withAppHealthCheckPath("/test")
|
||||
.withAppHealthCheckProbeInterval(10)
|
||||
.withAppHealthCheckProbeTimeout(600)
|
||||
.withAppHealthCheckThreshold(7);
|
||||
|
||||
dapr.configure();
|
||||
|
||||
assertEquals(10, dapr.getAppHealthCheckProbeInterval());
|
||||
assertEquals(600, dapr.getAppHealthCheckProbeTimeout());
|
||||
assertEquals(7, dapr.getAppHealthCheckThreshold());
|
||||
assertEquals("/test", dapr.getAppHealthCheckPath());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appHealthParametersDefaultsTest(){
|
||||
//Check that the defaults are set by default
|
||||
DaprContainer dapr2 = new DaprContainer(DAPR_RUNTIME_IMAGE_TAG)
|
||||
.withAppName("dapr2-app")
|
||||
.withAppPort(8082);
|
||||
|
||||
dapr2.configure();
|
||||
|
||||
assertEquals(5, dapr2.getAppHealthCheckProbeInterval());
|
||||
assertEquals(500, dapr2.getAppHealthCheckProbeTimeout());
|
||||
assertEquals(3, dapr2.getAppHealthCheckThreshold());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue