Add. Shubham, Ankit | Add. Validation for all the attributes of healthchecks
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema/#",
|
||||
"definitions": {
|
||||
"healthCheck": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"enum": ["tcp", "http"]
|
||||
},
|
||||
"port": {
|
||||
"enum": ["metrics","serviceport"]
|
||||
},
|
||||
"successThreshold": {
|
||||
"type": "integer"
|
||||
},
|
||||
"initialDelaySeconds": {
|
||||
"type": "integer"
|
||||
},
|
||||
"periodSeconds": {
|
||||
"type": "integer"
|
||||
},
|
||||
"failureThreshold": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"livenessCheck": {
|
||||
"$ref": "#/definitions/healthCheck"
|
||||
},
|
||||
"readinessCheck":{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/healthCheck"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,4 +83,13 @@ public class SchemaTest {
|
||||
|
||||
assertFalse(validationUtils.isJsonValid(schemaFile, jsonFile));
|
||||
}
|
||||
|
||||
@Test
|
||||
void expectTrueWhenAllThePropertiesOfHealthChecksAreValid() throws IOException, ProcessingException {
|
||||
File schemaFile = new File(schemaPath + "healthChecks.json");
|
||||
File jsonFile = new File(testData + "validHealthChecks.json");
|
||||
ValidationUtils validationUtils = new ValidationUtils();
|
||||
|
||||
assertTrue(validationUtils.isJsonValid(schemaFile, jsonFile));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"livenessCheck": {
|
||||
"type": "tcp",
|
||||
"port": "metrics",
|
||||
"successThreshold": 1,
|
||||
"initialDelaySeconds": 120,
|
||||
"periodSeconds": 15,
|
||||
"failureThreshold": 5
|
||||
},
|
||||
"readinessCheck": {
|
||||
"type": "http",
|
||||
"port": "metrics",
|
||||
"path": "/actuator/health",
|
||||
"successThreshold": 1,
|
||||
"initialDelaySeconds": 120,
|
||||
"periodSeconds": 15,
|
||||
"failureThreshold": 5
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user