diff --git a/builder/oracle/classic/pv_config_test.go b/builder/oracle/classic/pv_config_test.go new file mode 100644 index 000000000..74ea651c9 --- /dev/null +++ b/builder/oracle/classic/pv_config_test.go @@ -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) + } +}