mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-27 02:34:52 -06:00
63e1877c48
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>
457 lines
8.8 KiB
YAML
457 lines
8.8 KiB
YAML
---
|
|
cases:
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("\"100TIB\"") == 109951162777600
|
|
}
|
|
note: units_parse_bytes/removes quotes and lowercases string
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("0") == 0
|
|
}
|
|
note: units_parse_bytes/zero
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("0.0") == 0
|
|
}
|
|
note: units_parse_bytes/zero float
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes(".0") == 0
|
|
}
|
|
note: units_parse_bytes/zero bare float
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("12345") == 12345
|
|
}
|
|
note: units_parse_bytes/raw number
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10KB") == 10000
|
|
}
|
|
note: units_parse_bytes/10 kilobytes uppercase
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10KIB") == 10240
|
|
}
|
|
note: units_parse_bytes/10 KiB uppercase
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10kb") == 10000
|
|
}
|
|
note: units_parse_bytes/10 KB lowercase
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10Kib") == 10240
|
|
}
|
|
note: units_parse_bytes/10 KiB mixed case
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("200mb") == 200000000
|
|
}
|
|
note: units_parse_bytes/200 megabytes as mb
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("300GiB") == 322122547200
|
|
}
|
|
note: units_parse_bytes/300 GiB
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("1.1KB") == 1100
|
|
}
|
|
note: units_parse_bytes/1.1 KB floating point
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("1.1KiB") == 1126
|
|
}
|
|
note: units_parse_bytes/1.1 KiB floating point rounded
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes(".5KB") == 500
|
|
}
|
|
note: units_parse_bytes/.5 KB bare floating point
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100k") == 100000
|
|
}
|
|
note: units_parse_bytes/100 kilobytes as k
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100kb") == 100000
|
|
}
|
|
note: units_parse_bytes/100 kilobytes as kb
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100ki") == 102400
|
|
}
|
|
note: units_parse_bytes/100 kibibytes as ki
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100kib") == 102400
|
|
}
|
|
note: units_parse_bytes/100 kibibytes as kib
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100m") == 100000000
|
|
}
|
|
note: units_parse_bytes/100 megabytes as m
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100mb") == 100000000
|
|
}
|
|
note: units_parse_bytes/100 megabytes as mb
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100mi") == 104857600
|
|
}
|
|
note: units_parse_bytes/100 mebibytes as mi
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100mib") == 104857600
|
|
}
|
|
note: units_parse_bytes/100 mebibytes as mib
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100g") == 100000000000
|
|
}
|
|
note: units_parse_bytes/100 gigabytes as g
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100gb") == 100000000000
|
|
}
|
|
note: units_parse_bytes/100 gigabytes as gb
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100gi") == 107374182400
|
|
}
|
|
note: units_parse_bytes/100 gibibytes as gi
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100gib") == 107374182400
|
|
}
|
|
note: units_parse_bytes/100 gibibytes as gib
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100t") == 100000000000000
|
|
}
|
|
note: units_parse_bytes/100 terabytes as t
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100tb") == 100000000000000
|
|
}
|
|
note: units_parse_bytes/100 terabytes as tb
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100ti") == 109951162777600
|
|
}
|
|
note: units_parse_bytes/100 tebibytes as ti
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100tib") == 109951162777600
|
|
}
|
|
note: units_parse_bytes/100 tebibytes as tib
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100p") == 100000000000000000
|
|
}
|
|
note: units_parse_bytes/100 petabytes as p
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100pb") == 100000000000000000
|
|
}
|
|
note: units_parse_bytes/100 petabytes as pb
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100pi") == 112589990684262400
|
|
}
|
|
note: units_parse_bytes/100 pebibytes as pi
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("100pib") == 112589990684262400
|
|
}
|
|
note: units_parse_bytes/100 pebibytes as pib
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10e") == 10000000000000000000
|
|
}
|
|
note: units_parse_bytes/10 etabytes as e
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10eb") == 10000000000000000000
|
|
}
|
|
note: units_parse_bytes/10 etabytes as eb
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10ei") == 11529215046068469760
|
|
}
|
|
note: units_parse_bytes/10 ebibytes as ei
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|
|
|
|
- data:
|
|
modules:
|
|
- |
|
|
package test
|
|
p {
|
|
units.parse_bytes("10eib") == 11529215046068469760
|
|
}
|
|
note: units_parse_bytes/10 ebibytes as eib
|
|
query: data.test.p = x
|
|
want_result:
|
|
- x: true
|