check-unsupported
Tests one check in the rule vocabulary: how it decides, and what it reports.
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
fields:
owner: x
---nodes/b.md---
id: b
type: svc
---nodes/r1.md---
id: r1
type: rule
fields:
statement: s
applies_to: {type: svc}
check: {mystery: 1}
---nodes/r2.md---
id: r2
type: rule
fields:
statement: s
applies_to: {type: svc}
check: {require_fields: [owner], mystery: 1}
---nodes/r3.md---
id: r3
type: rule
fields:
statement: s
applies_to: {type: svc}
check: {require_fields: owner}
---nodes/r4.md---
id: r4
type: rule
fields:
statement: s
applies_to: {type: svc}
check: {field_is: {x: {bogus: 1}}}
---nodes/r5.md---
id: r5
type: rule
fields:
statement: s
applies_to: {type: svc}
check: {compare_fields: {left: a, op: '~', right: b}}
---Expected output
0 ghosts · 0 load errors · 7 nodes · 10 results
expected.json{
"ghosts": [],
"load_errors": [],
"nodes": [
{
"body": "",
"fields": {
"owner": "x"
},
"id": "a",
"links": [],
"parent": null,
"plane": null,
"title": "a",
"type": "svc"
},
{
"body": "",
"fields": {},
"id": "b",
"links": [],
"parent": null,
"plane": null,
"title": "b",
"type": "svc"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"mystery": 1
},
"statement": "s"
},
"id": "r1",
"links": [],
"parent": null,
"plane": null,
"title": "r1",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"mystery": 1,
"require_fields": [
"owner"
]
},
"statement": "s"
},
"id": "r2",
"links": [],
"parent": null,
"plane": null,
"title": "r2",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"require_fields": "owner"
},
"statement": "s"
},
"id": "r3",
"links": [],
"parent": null,
"plane": null,
"title": "r3",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"field_is": {
"x": {
"bogus": 1
}
}
},
"statement": "s"
},
"id": "r4",
"links": [],
"parent": null,
"plane": null,
"title": "r4",
"type": "rule"
},
{
"body": "",
"fields": {
"applies_to": {
"type": "svc"
},
"check": {
"compare_fields": {
"left": "a",
"op": "~",
"right": "b"
}
},
"statement": "s"
},
"id": "r5",
"links": [],
"parent": null,
"plane": null,
"title": "r5",
"type": "rule"
}
],
"results": [
{
"node": "a",
"rule": "r1",
"severity": "warn",
"status": "unsupported"
},
{
"node": "a",
"rule": "r2",
"severity": "warn",
"status": "unsupported"
},
{
"node": "a",
"rule": "r3",
"severity": "warn",
"status": "unsupported"
},
{
"node": "a",
"rule": "r4",
"severity": "warn",
"status": "unsupported"
},
{
"node": "a",
"rule": "r5",
"severity": "warn",
"status": "unsupported"
},
{
"node": "b",
"rule": "r1",
"severity": "warn",
"status": "unsupported"
},
{
"node": "b",
"rule": "r2",
"severity": "warn",
"status": "fail"
},
{
"node": "b",
"rule": "r3",
"severity": "warn",
"status": "unsupported"
},
{
"node": "b",
"rule": "r4",
"severity": "warn",
"status": "unsupported"
},
{
"node": "b",
"rule": "r5",
"severity": "warn",
"status": "unsupported"
}
],
"structure": {
"errors": [],
"warnings": []
}
}