Skip to content

Commit 211bdd1

Browse files
authored
Test /health/ not /health (#10924)
1 parent ca02861 commit 211bdd1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/src/test/java/jenkins/health/HealthCheckActionTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void setUp(JenkinsRule rule) {
5353

5454
@Test
5555
void healthCheck() throws Exception {
56-
try (var webClient = r.createWebClient()) {
56+
try (var webClient = r.createWebClient().withRedirectEnabled(false)) {
5757
var page = webClient.goTo(healthUrl(), "application/json");
5858
assertThat(page.getWebResponse().getStatusCode(), is(200));
5959
assertEquals(JSONObject.fromObject("""
@@ -64,13 +64,14 @@ void healthCheck() throws Exception {
6464
}
6565
}
6666

67+
6768
private static String healthUrl() {
68-
return ExtensionList.lookupSingleton(HealthCheckAction.class).getUrlName();
69+
return ExtensionList.lookupSingleton(HealthCheckAction.class).getUrlName() + "/";
6970
}
7071

7172
@Test
7273
void healthCheckSuccessExtension() throws Exception {
73-
try (var webClient = r.createWebClient()) {
74+
try (var webClient = r.createWebClient().withRedirectEnabled(false)) {
7475
var page = webClient.goTo(healthUrl(), "application/json");
7576
assertThat(page.getWebResponse().getStatusCode(), is(200));
7677
assertEquals(JSONObject.fromObject("""
@@ -97,7 +98,7 @@ public boolean check() {
9798

9899
@Test
99100
void healthCheckFailingExtension() throws Exception {
100-
try (var webClient = r.createWebClient()) {
101+
try (var webClient = r.createWebClient().withRedirectEnabled(false)) {
101102
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
102103
webClient.getOptions().setPrintContentOnFailingStatusCode(false);
103104
var page = webClient.goTo(healthUrl(), "application/json");

0 commit comments

Comments
 (0)