1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2024-12-18 12:48:08 +00:00

Add tests for regex test op

This commit is contained in:
wwwil 2019-06-05 12:23:59 +01:00
parent e4f0f470ee
commit 83c7536c8a
2 changed files with 22 additions and 0 deletions

View File

@ -297,3 +297,13 @@ groups:
op: eq op: eq
value: "false" value: "false"
set: true set: true
- id: 26
text: "check regex op matches"
tests:
test_items:
- path: "{.currentMasterVersion}"
compare:
op: regex
value: '^1\.12.*$'
set: true

View File

@ -152,6 +152,10 @@ func TestTestExecute(t *testing.T) {
controls.Groups[0].Checks[22], controls.Groups[0].Checks[22],
"authentication:\n anonymous:\n enabled: false", "authentication:\n anonymous:\n enabled: false",
}, },
{
controls.Groups[0].Checks[26],
"currentMasterVersion: 1.12.7",
},
} }
for _, c := range cases { for _, c := range cases {
@ -180,6 +184,14 @@ func TestTestExecuteExceptions(t *testing.T) {
controls.Groups[0].Checks[25], controls.Groups[0].Checks[25],
"broken } yaml\nenabled: true", "broken } yaml\nenabled: true",
}, },
{
controls.Groups[0].Checks[26],
"currentMasterVersion: 1.11",
},
{
controls.Groups[0].Checks[26],
"currentMasterVersion: ",
},
} }
for _, c := range cases { for _, c := range cases {