Private beta, by invitation. It may change without warning. While the beta lasts, some paid features are free. See pricing

trumlyspec GitHub
Try trumly

Conformance cases /

check-link-inbound

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
links:
  - type: calls
    to: db
---
nodes/b.md
---
id: b
type: job
links:
  - type: calls
    to: db
---
nodes/db.md
---
id: db
type: store
---
nodes/lonely.md
---
id: lonely
type: store
---
nodes/r1.md
---
id: r1
type: rule
fields:
  statement: s
  applies_to: {type: store}
  check: {require_link: {type: calls, dir: in}}
---
nodes/r2.md
---
id: r2
type: rule
fields:
  statement: s
  applies_to: {type: store}
  check: {require_link: {type: calls, dir: in, node_type: svc, max: 1}}
---
nodes/r3.md
---
id: r3
type: rule
fields:
  statement: s
  applies_to: {type: store}
  check: {require_link: {type: calls, dir: in, node_type: job, max: 0}}
---

Expected output

0 ghosts · 0 load errors · 7 nodes · 6 results

expected.json
{
 "ghosts": [],
 "load_errors": [],
 "nodes": [
  {
   "body": "",
   "fields": {},
   "id": "a",
   "links": [
    {
     "to": "db",
     "type": "calls"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "a",
   "type": "svc"
  },
  {
   "body": "",
   "fields": {},
   "id": "b",
   "links": [
    {
     "to": "db",
     "type": "calls"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "b",
   "type": "job"
  },
  {
   "body": "",
   "fields": {},
   "id": "db",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "db",
   "type": "store"
  },
  {
   "body": "",
   "fields": {},
   "id": "lonely",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "lonely",
   "type": "store"
  },
  {
   "body": "",
   "fields": {
    "applies_to": {
     "type": "store"
    },
    "check": {
     "require_link": {
      "dir": "in",
      "type": "calls"
     }
    },
    "statement": "s"
   },
   "id": "r1",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "r1",
   "type": "rule"
  },
  {
   "body": "",
   "fields": {
    "applies_to": {
     "type": "store"
    },
    "check": {
     "require_link": {
      "dir": "in",
      "max": 1,
      "node_type": "svc",
      "type": "calls"
     }
    },
    "statement": "s"
   },
   "id": "r2",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "r2",
   "type": "rule"
  },
  {
   "body": "",
   "fields": {
    "applies_to": {
     "type": "store"
    },
    "check": {
     "require_link": {
      "dir": "in",
      "max": 0,
      "node_type": "job",
      "type": "calls"
     }
    },
    "statement": "s"
   },
   "id": "r3",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "r3",
   "type": "rule"
  }
 ],
 "results": [
  {
   "node": "db",
   "rule": "r1",
   "severity": "warn",
   "status": "pass"
  },
  {
   "node": "db",
   "rule": "r2",
   "severity": "warn",
   "status": "pass"
  },
  {
   "node": "db",
   "rule": "r3",
   "severity": "warn",
   "status": "fail"
  },
  {
   "node": "lonely",
   "rule": "r1",
   "severity": "warn",
   "status": "fail"
  },
  {
   "node": "lonely",
   "rule": "r2",
   "severity": "warn",
   "status": "pass"
  },
  {
   "node": "lonely",
   "rule": "r3",
   "severity": "warn",
   "status": "pass"
  }
 ],
 "structure": {
  "errors": [],
  "warnings": []
 }
}