Add support for health-check-http-endpoint property

This commit is contained in:
Kris De Volder
2017-04-24 11:16:40 -07:00
parent e493724543
commit 6e1881543d
4 changed files with 93 additions and 42 deletions

View File

@@ -0,0 +1,11 @@
#!/bin/bash
s3cmd expire s3://s3-test.spring.io \
--expiry-prefix mvn-caches --expiry-days 7 \
# Note: it seems we can only apply one rule to a bucket.
# We would really want to expire other folders as well:
# --expiry-prefix sts3/commons/snapshots --expiry-days 7 \
# --expiry-prefix sts4/vscode-extensions/snapshots --expiry-days 30
# But since that doesn't work, I only added one rule for the biggest space waster.

View File

@@ -123,19 +123,7 @@ public class ManifestYmlSchema implements YamlSchema {
TOPLEVEL_TYPE.addProperty(f.yprop("applications", f.yseq(application)));
TOPLEVEL_TYPE.addProperty("inherit", t_string, descriptionFor("inherit"));
// YAtomicType t_test_hanging = f.yatomic("Hanging");
// t_test_hanging.addHintProvider(() -> {
// try {
// Thread.sleep(60_000);
// } catch (InterruptedException e) {
// LaunguageServerApp.LOG.info("test_hanging hint provider interrupted!");
// throw e;
// }
// return YTypeFactory.hints(ImmutableList.of("very", "slow", "hints"));
// });
YTypedPropertyImpl[] props = {
// f.yprop("test_hanging", t_test_hanging),
f.yprop("buildpack", t_buildpack),
f.yprop("command", t_string),
f.yprop("disk_quota", t_memory),
@@ -155,7 +143,8 @@ public class ManifestYmlSchema implements YamlSchema {
f.yprop("services", t_services),
f.yprop("stack", t_string),
f.yprop("timeout", t_pos_integer),
f.yprop("health-check-type", t_health_check_type)
f.yprop("health-check-type", t_health_check_type),
f.yprop("health-check-http-endpoint", t_ne_string)
};
for (YTypedPropertyImpl prop : props) {

View File

@@ -0,0 +1,6 @@
Use the `health-check-http-endpoint` attribute to customize the endpoint for the `http` health check type. If you do not provide a `health-check-http-endpoint` attribute, it uses endpoint `/`.
---
...
health-check-type: http
health-check-http-endpoint: /health

View File

@@ -257,6 +257,8 @@ public class ManifestYamlEditorTest {
"env:\n"+
" <*>",
// ---------------
"health-check-http-endpoint: <*>",
// ---------------
"health-check-type: <*>",
// ---------------
// "host: <*>",
@@ -327,6 +329,9 @@ public class ManifestYamlEditorTest {
" <*>",
// ---------------
"applications:\n" +
"- health-check-http-endpoint: <*>",
// ---------------
"applications:\n" +
"- health-check-type: <*>",
// ---------------
"applications:\n" +
@@ -415,6 +420,48 @@ public class ManifestYamlEditorTest {
);
}
@Test
public void reconcileHealthCheckType() throws Exception {
Editor editor;
Diagnostic problem;
editor = harness.newEditor(
"applications:\n" +
"- name: my-app\n" +
" health-check-type: http\n" +
" health-check-http-endpoint: /health"
);
editor.assertProblems(/*NONE*/);
editor = harness.newEditor(
"applications:\n" +
"- name: foo\n" +
" health-check-type: none"
);
problem = editor.assertProblems("none|'none' is deprecated in favor of 'process'").get(0);
assertEquals(DiagnosticSeverity.Warning, problem.getSeverity());
editor = harness.newEditor(
"applications:\n" +
"- name: foo\n" +
" health-check-type: none"
);
editor = harness.newEditor(
"applications:\n" +
"- name: foo\n" +
" health-check-type: port"
);
editor.assertProblems(/*NONE*/);
editor = harness.newEditor(
"applications:\n" +
"- name: foo\n" +
" health-check-type: process"
);
editor.assertProblems(/*NONE*/);
}
@Test
public void hoverInfos() throws Exception {
Editor editor = harness.newEditor(
@@ -449,7 +496,8 @@ public class ManifestYamlEditorTest {
" - instance_XYZ\n" +
" stack: cflinuxfs2\n" +
" timeout: 80\n" +
" health-check-type: none\n"
" health-check-type: none\n" +
" health-check-http-endpoint: /health\n"
);
editor.assertIsHoverRegion("memory");
@@ -497,17 +545,7 @@ public class ManifestYamlEditorTest {
editor.assertHoverContains("stack", "Use the `stack` attribute to specify which stack to deploy your application to.");
editor.assertHoverContains("timeout", "The `timeout` attribute defines the number of seconds Cloud Foundry allocates for starting your application");
editor.assertHoverContains("health-check-type", "Use the `health-check-type` attribute to");
}
@Test
public void deprecatedHealthCheckTypeNone() throws Exception {
Editor editor = harness.newEditor(
"applications:\n" +
"- name: foo\n" +
" health-check-type: none"
);
Diagnostic problem = editor.assertProblems("none|'none' is deprecated in favor of 'process'").get(0);
assertEquals(DiagnosticSeverity.Warning, problem.getSeverity());
editor.assertHoverContains("health-check-http-endpoint", "customize the endpoint for the `http`");
}
@Test
@@ -590,6 +628,9 @@ public class ManifestYamlEditorTest {
" <*>",
// ---------------
"applications:\n" +
"- health-check-http-endpoint: <*>",
// ---------------
"applications:\n" +
"- health-check-type: <*>",
// ---------------
"applications:\n" +
@@ -668,6 +709,10 @@ public class ManifestYamlEditorTest {
"- name: test"
, // ---------------------
"applications:\n" +
"- health-check-http-endpoint: <*>\n" +
"- name: test"
, // ---------------------
"applications:\n" +
"- health-check-type: <*>\n" +
"- name: test"
, // ---------------------
@@ -1010,23 +1055,6 @@ public class ManifestYamlEditorTest {
assertDoesNotContainCompletions("domains:\n" + " - <*>", "wrong.cfapps.io");
}
//////////////////////////////////////////////////////////////////////////////
private void assertCompletions(String textBefore, String... textAfter) throws Exception {
Editor editor = harness.newEditor(textBefore);
editor.assertCompletions(textAfter);
}
private void assertDoesNotContainCompletions(String textBefore, String... notToBeFound) throws Exception {
Editor editor = harness.newEditor(textBefore);
editor.assertDoesNotContainCompletions(notToBeFound);
}
private void assertContainsCompletions(String textBefore, String... textAfter) throws Exception {
Editor editor = harness.newEditor(textBefore);
editor.assertContainsCompletions(textAfter);
}
@Test
public void reconcileRouteFormat() throws Exception {
Editor editor = harness.newEditor(
@@ -1120,4 +1148,21 @@ public class ManifestYamlEditorTest {
editor.assertProblems();
}
//////////////////////////////////////////////////////////////////////////////
private void assertCompletions(String textBefore, String... textAfter) throws Exception {
Editor editor = harness.newEditor(textBefore);
editor.assertCompletions(textAfter);
}
private void assertDoesNotContainCompletions(String textBefore, String... notToBeFound) throws Exception {
Editor editor = harness.newEditor(textBefore);
editor.assertDoesNotContainCompletions(notToBeFound);
}
private void assertContainsCompletions(String textBefore, String... textAfter) throws Exception {
Editor editor = harness.newEditor(textBefore);
editor.assertContainsCompletions(textAfter);
}
}