@@ -34,12 +34,13 @@ type mockClusterClientProperties struct {
3434 name string
3535 haNodes int
3636 workerNodes int
37+ diskSize int
3738}
3839
3940func TestClusterCreation (t * testing.T ) {
4041 resource .Test (t , resource.TestCase {
4142 IsUnitTest : true ,
42- Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterCreation" , 1 , 0 }))},
43+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterCreation" , 1 , 0 , 20000 }))},
4344 Steps : []resource.TestStep {
4445 {
4546 Config : testUnitClusterConfig ("some_driver" , "TestClusterCreation" ),
@@ -54,13 +55,13 @@ func TestClusterCreation(t *testing.T) {
5455func TestClusterUpdate (t * testing.T ) {
5556 resource .Test (t , resource.TestCase {
5657 IsUnitTest : true ,
57- Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockUpdate (mockClusterClientProperties {t , "TestClusterCreation " , 1 , 0 }))},
58+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockUpdate (mockClusterClientProperties {t , "TestClusterUpdate " , 1 , 0 , 20000 }))},
5859 Steps : []resource.TestStep {
5960 {
60- Config : testUnitClusterConfig ("some_driver" , "TestClusterCreation " ),
61+ Config : testUnitClusterConfig ("some_driver" , "TestClusterUpdate " ),
6162 },
6263 {
63- Config : testUnitClusterConfig_Update ("some_driver" , "TestClusterCreation " ),
64+ Config : testUnitClusterConfig_Update ("some_driver" , "TestClusterUpdate " ),
6465 Check : resource .ComposeTestCheckFunc (
6566 resource .TestCheckResourceAttr ("minikube_cluster.new" , "addons.2" , "ingress" ),
6667 ),
@@ -72,18 +73,31 @@ func TestClusterUpdate(t *testing.T) {
7273func TestClusterHA (t * testing.T ) {
7374 resource .Test (t , resource.TestCase {
7475 IsUnitTest : true ,
75- Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterCreationHA" , 3 , 5 }))},
76+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterCreationHA" , 3 , 5 , 20000 }))},
7677 Steps : []resource.TestStep {
7778 {
7879 Config : testUnitClusterHAConfig ("some_driver" , "TestClusterCreationHA" ),
7980 },
8081 },
8182 })
8283}
84+
85+ func TestClusterDisk (t * testing.T ) {
86+ resource .Test (t , resource.TestCase {
87+ IsUnitTest : true ,
88+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterCreationDisk" , 3 , 5 , 20480 }))},
89+ Steps : []resource.TestStep {
90+ {
91+ Config : testUnitClusterDiskConfig ("some_driver" , "TestClusterCreationDisk" ),
92+ },
93+ },
94+ })
95+ }
96+
8397func TestClusterWait (t * testing.T ) {
8498 resource .Test (t , resource.TestCase {
8599 IsUnitTest : true ,
86- Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterCreationWait" , 1 , 0 }))},
100+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterCreationWait" , 1 , 0 , 20000 }))},
87101 Steps : []resource.TestStep {
88102 {
89103 Config : testUnitClusterWaitConfig ("some_driver" , "TestClusterCreationWait" ),
@@ -315,7 +329,7 @@ func TestClusterCreation_HyperV(t *testing.T) {
315329func mockUpdate (props mockClusterClientProperties ) schema.ConfigureContextFunc {
316330 ctrl := gomock .NewController (props .t )
317331
318- mockClusterClient := getBaseMockClient (ctrl , props .name , props .haNodes , props .workerNodes )
332+ mockClusterClient := getBaseMockClient (ctrl , props .name , props .haNodes , props .workerNodes , props . diskSize )
319333
320334 gomock .InOrder (
321335 mockClusterClient .EXPECT ().
@@ -352,7 +366,7 @@ func mockUpdate(props mockClusterClientProperties) schema.ConfigureContextFunc {
352366func mockSuccess (props mockClusterClientProperties ) schema.ConfigureContextFunc {
353367 ctrl := gomock .NewController (props .t )
354368
355- mockClusterClient := getBaseMockClient (ctrl , props .name , props .haNodes , props .workerNodes )
369+ mockClusterClient := getBaseMockClient (ctrl , props .name , props .haNodes , props .workerNodes , props . diskSize )
356370
357371 mockClusterClient .EXPECT ().
358372 GetAddons ().
@@ -370,7 +384,7 @@ func mockSuccess(props mockClusterClientProperties) schema.ConfigureContextFunc
370384 return configureContext
371385}
372386
373- func getBaseMockClient (ctrl * gomock.Controller , clusterName string , haNodes int , workerNodes int ) * lib.MockClusterClient {
387+ func getBaseMockClient (ctrl * gomock.Controller , clusterName string , haNodes int , workerNodes int , diskSize int ) * lib.MockClusterClient {
374388 mockClusterClient := lib .NewMockClusterClient (ctrl )
375389
376390 os .Mkdir ("test_output" , 0755 )
@@ -420,7 +434,7 @@ func getBaseMockClient(ctrl *gomock.Controller, clusterName string, haNodes int,
420434 Network : clusterSchema ["network" ].Default .(string ),
421435 Memory : 4096 ,
422436 CPUs : 2 ,
423- DiskSize : 20000 ,
437+ DiskSize : diskSize ,
424438 Driver : "some_driver" ,
425439 ListenAddress : clusterSchema ["listen_address" ].Default .(string ),
426440 HyperkitVpnKitSock : clusterSchema ["hyperkit_vpnkit_sock" ].Default .(string ),
@@ -535,6 +549,17 @@ func testUnitClusterConfig(driver string, clusterName string) string {
535549 ` , driver , clusterName )
536550}
537551
552+ func testUnitClusterDiskConfig (driver string , clusterName string ) string {
553+ return fmt .Sprintf (`
554+ resource "minikube_cluster" "new" {
555+ driver = "%s"
556+ cluster_name = "%s"
557+
558+ disk_size = "20g"
559+ }
560+ ` , driver , clusterName )
561+ }
562+
538563func testUnitClusterHAConfig (driver string , clusterName string ) string {
539564 return fmt .Sprintf (`
540565 resource "minikube_cluster" "new" {
0 commit comments