rule-disabled
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
plane: p
---nodes/off-no-check.md---
id: off-no-check
type: rule
fields:
statement: s
enabled: false
applies_to: {type: svc}
---nodes/off.md---
id: off
type: rule
fields:
statement: s
severity: error
enabled: false
applies_to: {type: svc}
check: {require_fields: [owner]}
---nodes/on.md---
id: on
type: rule
fields:
statement: s
enabled: true
applies_to: {type: svc}
check: {require_fields: [owner]}
---nodes/p.md---
id: p
type: plane
fields:
order: 1
---nodes/str.md---
id: str
type: rule
fields:
statement: s
enabled: 'false'
applies_to: {type: svc}
check: {require_link: {type: needs}}
---Expected output
1 ghosts · 0 load errors · 6 nodes · 2 results
expected.json{
"ghosts": [
{
"link": "needs",
"node": "a",
"plane": "p",
"rule": "str",
"to_type": null
}
],
"load_errors": [],
"nodes": [
{
"body": "",
"fields": {},
"id": "a",
"links": [],
"parent": null,
"plane": "p",
"title": "a",
"type": "svc"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"require_fields": [
"owner"
]
},
"enabled": false,
"severity": "error",
"statement": "s"
},
"id": "off",
"links": [],
"parent": null,
"plane": null,
"title": "off",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"enabled": false,
"statement": "s"
},
"id": "off-no-check",
"links": [],
"parent": null,
"plane": null,
"title": "off-no-check",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"require_fields": [
"owner"
]
},
"enabled": true,
"statement": "s"
},
"id": "on",
"links": [],
"parent": null,
"plane": null,
"title": "on",
"type": "rule"
},
{
"body": "",
"fields": {
"order": 1
},
"id": "p",
"links": [],
"parent": null,
"plane": null,
"title": "p",
"type": "plane"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"require_link": {
"type": "needs"
}
},
"enabled": "false",
"statement": "s"
},
"id": "str",
"links": [],
"parent": null,
"plane": null,
"title": "str",
"type": "rule"
}
],
"results": [
{
"node": "a",
"rule": "on",
"severity": "warn",
"status": "fail"
},
{
"node": "a",
"rule": "str",
"severity": "warn",
"status": "fail"
}
],
"structure": {
"errors": [],
"warnings": []
}
}