add config tests
This commit is contained in:
parent
6d6d262308
commit
f322397413
|
@ -0,0 +1,39 @@
|
|||
package classic
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPVConfigEntry(t *testing.T) {
|
||||
/*
|
||||
IL_DEFAULT ENTRY expected
|
||||
0 nil 0
|
||||
0 1 1
|
||||
1 nil 5
|
||||
1 1 1
|
||||
*/
|
||||
|
||||
entry := 1
|
||||
var entryTests = []struct {
|
||||
imageList string
|
||||
imageListEntry *int
|
||||
expected int
|
||||
}{
|
||||
{"x", nil, 0},
|
||||
{"x", &entry, 1},
|
||||
{imageListDefault, nil, 5},
|
||||
{imageListDefault, &entry, 1},
|
||||
}
|
||||
for _, tt := range entryTests {
|
||||
tc := &PVConfig{
|
||||
PersistentVolumeSize: 1,
|
||||
BuilderImageList: tt.imageList,
|
||||
BuilderImageListEntry: tt.imageListEntry,
|
||||
}
|
||||
errs := tc.Prepare(nil)
|
||||
assert.Nil(t, errs, "Didn't expect any errors")
|
||||
assert.Equal(t, tt.expected, *tc.BuilderImageListEntry)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue