Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-bench
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
aquasecurity
kube-bench
Commits
8ea08924
Commit
8ea08924
authored
7 years ago
by
Abubakr-Sadik Nii Nai Davis
Browse files
Options
Downloads
Patches
Plain Diff
Update controls to support multiple Kubernetes versions.
parent
f2e744bd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
check/controls.go
+1
-0
1 addition, 0 deletions
check/controls.go
check/controls_test.go
+21
-12
21 additions, 12 deletions
check/controls_test.go
with
22 additions
and
12 deletions
check/controls.go
+
1
−
0
View file @
8ea08924
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
// Controls holds all controls to check for master nodes.
// Controls holds all controls to check for master nodes.
type
Controls
struct
{
type
Controls
struct
{
ID
string
`yaml:"id"`
ID
string
`yaml:"id"`
Version
string
Text
string
Text
string
Type
NodeType
Type
NodeType
Groups
[]
*
Group
Groups
[]
*
Group
...
...
This diff is collapsed.
Click to expand it.
check/controls_test.go
+
21
−
12
View file @
8ea08924
...
@@ -11,22 +11,31 @@ const cfgDir = "../cfg/"
...
@@ -11,22 +11,31 @@ const cfgDir = "../cfg/"
// validate that the files we're shipping are valid YAML
// validate that the files we're shipping are valid YAML
func
TestYamlFiles
(
t
*
testing
.
T
)
{
func
TestYamlFiles
(
t
*
testing
.
T
)
{
files
,
err
:=
ioutil
.
ReadDir
(
cfgDir
)
// TODO: make this list dynamic
if
err
!=
nil
{
dirs
:=
[]
string
{
"1.6/"
,
"1.7/"
}
t
.
Fatalf
(
"error reading %s directory: %v"
,
cfgDir
,
err
)
}
for
_
,
dir
:=
range
dirs
{
for
_
,
file
:=
range
files
{
dir
=
cfgDir
+
dir
fileName
:=
file
.
Name
()
in
,
err
:=
ioutil
.
Read
File
(
cfgDir
+
fileName
)
files
,
err
:=
ioutil
.
Read
Dir
(
dir
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"error
opening file %s: %v"
,
fileName
,
err
)
t
.
Fatalf
(
"error
reading %s directory: %v"
,
dir
,
err
)
}
}
c
:=
new
(
Controls
)
for
_
,
file
:=
range
files
{
err
=
yaml
.
Unmarshal
(
in
,
c
)
fileName
:=
file
.
Name
()
if
err
!=
nil
{
in
,
err
:=
ioutil
.
ReadFile
(
dir
+
fileName
)
t
.
Fatalf
(
"failed to load YAML from %s: %v"
,
fileName
,
err
)
if
err
!=
nil
{
t
.
Fatalf
(
"error opening file %s: %v"
,
fileName
,
err
)
}
c
:=
new
(
Controls
)
err
=
yaml
.
Unmarshal
(
in
,
c
)
if
err
!=
nil
{
t
.
Fatalf
(
"failed to load YAML from %s: %v"
,
fileName
,
err
)
}
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment