forked from mirrors/linux-bench
Don't rely on test ordering
Tests can be run in parallel so we can't rely on the state of a global variable that is modified in one test being ready when we run another
This commit is contained in:
parent
59d2148c4c
commit
80aaa6b6e8
1 changed files with 5 additions and 14 deletions
19
app_test.go
19
app_test.go
|
@ -8,7 +8,6 @@ import (
|
||||||
var (
|
var (
|
||||||
cfgdir = "./cfg"
|
cfgdir = "./cfg"
|
||||||
ver = "1.1.0"
|
ver = "1.1.0"
|
||||||
path string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tests all standard linux-bench defintion files
|
// Tests all standard linux-bench defintion files
|
||||||
|
@ -31,20 +30,12 @@ func TestGetDefinitionFilePath(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetControls(t *testing.T) {
|
|
||||||
var err error
|
|
||||||
path, err = getDefinitionFilePath(ver)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("unexpected error: %s\n", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = getControls(path, nil)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("unexpected error: %s\n", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRunControls(t *testing.T) {
|
func TestRunControls(t *testing.T) {
|
||||||
|
path, err := getDefinitionFilePath(ver)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("unexpected error: %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
control, err := getControls(path, nil)
|
control, err := getControls(path, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error: %s\n", err)
|
t.Errorf("unexpected error: %s\n", err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue