Files
Philip Conrad 63e1877c48 linters+testdata: Reformat all yaml testcases for linting. (#6511)
This commit adds a config for yamllint, mass-reformats all of
the existing Yaml testcases to pass linting, and adds a Yaml
linting job to the pull-request Github Actions workflow. A few 
careful exceptions and ignores were added to the linter's
config to allow keeping our existing Yaml files with minimal
reformatting.

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
2024-01-10 13:16:01 -05:00

86 lines
1.8 KiB
YAML

---
cases:
- data:
networks:
- id: n1
public: false
- id: n2
public: false
- id: n3
public: true
ports:
- id: p1
networks:
- n1
- id: p2
networks:
- n3
- id: p3
networks:
- n2
servers:
- id: s1
name: app
ports:
- p1
- p2
- p3
protocols:
- https
- ssh
- id: s2
name: db
ports:
- p3
protocols:
- mysql
- id: s3
name: cache
ports:
- p3
protocols:
- memcache
- http
- id: s4
name: dev
ports:
- p1
- p2
protocols:
- http
input_term: "{}"
modules:
- |
package opa.example
public_servers[server] {
server = data.servers[_]
server.ports[_] = data.ports[i].id
data.ports[i].networks[_] = data.networks[j].id
data.networks[j].public = true
}
violations[server] {
server = data.servers[_]
server.protocols[_] = "http"
data.opa.example.public_servers[server]
}
- |
package topdown_test_partial
__result__ = _result {
_result = {{"id": "s1", "name": "app", "ports": ["p1", "p2", "p3"], "protocols": ["https", "ssh"]}, {"id": "s4", "name": "dev", "ports": ["p1", "p2"], "protocols": ["http"]}}
}
note: example/violations
query: data.opa.example.violations = x
sort_bindings: true
want_result:
- x:
- id: s4
name: dev
ports:
- p1
- p2
protocols:
- http