Fake test file that GitHub Actions should accept

This commit is contained in:
Liz Rice 2020-12-21 16:25:29 +00:00
parent 0c3a7001d7
commit 65ff70ae4e
2 changed files with 39 additions and 7 deletions

View file

@ -5,14 +5,9 @@ import (
"testing"
)
var (
cfgdir = "./cfg"
ver = "1.1.0"
)
// Tests all standard linux-bench defintion files
func TestGetDefinitionFilePath(t *testing.T) {
d, err := os.Open(cfgdir)
d, err := os.Open("./cfg")
if err != nil {
t.Errorf("unexpected error: %s\n", err)
}
@ -23,6 +18,7 @@ func TestGetDefinitionFilePath(t *testing.T) {
}
for _, ver := range vers {
t.Logf("%v", ver)
_, err := getDefinitionFilePath(ver)
if err != nil {
t.Errorf("unexpected error: %s\n", err)
@ -31,7 +27,8 @@ func TestGetDefinitionFilePath(t *testing.T) {
}
func TestRunControls(t *testing.T) {
path, err := getDefinitionFilePath(ver)
cfgDir = "./hack"
path, err := getDefinitionFilePath("test-definitions")
if err != nil {
t.Errorf("unexpected error: %s\n", err)
}

View file

@ -0,0 +1,35 @@
---
controls:
version: 0.1
id: 1
description: "Test YAMl file"
type: "hack"
groups:
- id: 1.1
description: "Filesystem Configuration"
checks:
- id: 1.1.1
description: "Disable unused filesystems"
checks:
- id: 1.1.1.1.a
description: "Ensure mounting of cramfs filesystems is disabled"
audit: "echo hello"
tests:
test_items:
- flag: "hello"
set: true
remediation: |
Correct something about this test
scored: true
- id: 1.1.1.1.b
description: "Ensure mounting of cramfs filesystems is disabled"
audit: "echo hello=false"
tests:
test_items:
- flag: "hello"
compare:
op: eq
value: "false"
set: true
remediation: |
Put your remediation here