add config tests

This commit is contained in:
Matthew Hooker 2018-10-26 21:56:39 -07:00
parent 6d6d262308
commit f322397413
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 39 additions and 0 deletions

View File

@ -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)
}
}