Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -133,6 +136,21 @@ public DaprContainer withAppHealthCheckPath(String appHealthCheckPath) {
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;
Expand Down Expand Up @@ -311,6 +329,16 @@ protected void configure() {
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) {
Expand Down Expand Up @@ -385,6 +413,22 @@ public Integer getAppPort() {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,38 @@ public void schedulerAndPlacementCustomImagesStringTest() {
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