rule-bad-severity
Tests how a rule is read and applied: severity, scope, options and switching rules off.
Our implementation passes this case when its check --json output for the input below equals the expected
output.
Input
nodes/a.md---
id: a
type: svc
---nodes/r1.md---
id: r1
type: rule
fields:
statement: s
severity: loud
applies_to: {type: svc}
check: {require_fields: [zz]}
---nodes/r2.md---
id: r2
type: rule
fields:
statement: s
severity: error
applies_to: {type: svc}
check: {require_fields: [zz]}
---Expected output
0 ghosts · 0 load errors · 3 nodes · 2 results
expected.json{
"ghosts": [],
"load_errors": [],
"nodes": [
{
"body": "",
"fields": {},
"id": "a",
"links": [],
"parent": null,
"plane": null,
"title": "a",
"type": "svc"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"require_fields": [
"zz"
]
},
"severity": "loud",
"statement": "s"
},
"id": "r1",
"links": [],
"parent": null,
"plane": null,
"title": "r1",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"require_fields": [
"zz"
]
},
"severity": "error",
"statement": "s"
},
"id": "r2",
"links": [],
"parent": null,
"plane": null,
"title": "r2",
"type": "rule"
}
],
"results": [
{
"node": "a",
"rule": "r1",
"severity": "warn",
"status": "fail"
},
{
"node": "a",
"rule": "r2",
"severity": "error",
"status": "fail"
}
],
"structure": {
"errors": [],
"warnings": []
}
}