rule-advisory
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
applies_to: {type: svc}
---nodes/r2.md---
id: r2
type: rule
fields:
statement: s
applies_to: {type: svc}
check: {}
---nodes/r3.md---
id: r3
type: rule
fields:
statement: s
severity: info
applies_to: {type: svc}
check: {mystery: 1}
---Expected output
0 ghosts · 0 load errors · 4 nodes · 3 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"
},
"statement": "s"
},
"id": "r1",
"links": [],
"parent": null,
"plane": null,
"title": "r1",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {},
"statement": "s"
},
"id": "r2",
"links": [],
"parent": null,
"plane": null,
"title": "r2",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"mystery": 1
},
"severity": "info",
"statement": "s"
},
"id": "r3",
"links": [],
"parent": null,
"plane": null,
"title": "r3",
"type": "rule"
}
],
"results": [
{
"node": "a",
"rule": "r1",
"severity": "warn",
"status": "advisory"
},
{
"node": "a",
"rule": "r2",
"severity": "warn",
"status": "advisory"
},
{
"node": "a",
"rule": "r3",
"severity": "info",
"status": "unsupported"
}
],
"structure": {
"errors": [],
"warnings": []
}
}