@@ -326,6 +326,54 @@ func TestClusterCreation_HyperV(t *testing.T) {
326326 })
327327}
328328
329+ func TestClusterNoLimitMemory (t * testing.T ) {
330+ resource .Test (t , resource.TestCase {
331+ IsUnitTest : true ,
332+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterNoLimitMemory" , 1 , 0 , 20000 }))},
333+ Steps : []resource.TestStep {
334+ {
335+ Config : testUnitClusterNoLimitMemoryConfig ("some_driver" , "TestClusterNoLimitMemory" ),
336+ },
337+ },
338+ })
339+ }
340+
341+ func TestClusterMaxMemory (t * testing.T ) {
342+ resource .Test (t , resource.TestCase {
343+ IsUnitTest : true ,
344+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterMaxMemory" , 1 , 0 , 20000 }))},
345+ Steps : []resource.TestStep {
346+ {
347+ Config : testUnitClusterMaxMemoryConfig ("some_driver" , "TestClusterMaxMemory" ),
348+ },
349+ },
350+ })
351+ }
352+
353+ func TestClusterNoLimitCPU (t * testing.T ) {
354+ resource .Test (t , resource.TestCase {
355+ IsUnitTest : true ,
356+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterNoLimitCPU" , 1 , 0 , 20000 }))},
357+ Steps : []resource.TestStep {
358+ {
359+ Config : testUnitClusterNoLimitCPUConfig ("some_driver" , "TestClusterNoLimitCPU" ),
360+ },
361+ },
362+ })
363+ }
364+
365+ func TestClusterMaxCPU (t * testing.T ) {
366+ resource .Test (t , resource.TestCase {
367+ IsUnitTest : true ,
368+ Providers : map [string ]* schema.Provider {"minikube" : NewProvider (mockSuccess (mockClusterClientProperties {t , "TestClusterMaxCPU" , 1 , 0 , 20000 }))},
369+ Steps : []resource.TestStep {
370+ {
371+ Config : testUnitClusterMaxCPUConfig ("some_driver" , "TestClusterMaxCPU" ),
372+ },
373+ },
374+ })
375+ }
376+
329377func mockUpdate (props mockClusterClientProperties ) schema.ConfigureContextFunc {
330378 ctrl := gomock .NewController (props .t )
331379
@@ -827,3 +875,43 @@ func testPropertyExists(n string, id string) resource.TestCheckFunc {
827875 return nil
828876 }
829877}
878+
879+ func testUnitClusterNoLimitMemoryConfig (driver string , clusterName string ) string {
880+ return fmt .Sprintf (`
881+ resource "minikube_cluster" "new" {
882+ driver = "%s"
883+ cluster_name = "%s"
884+ memory = "NoLimit"
885+ }
886+ ` , driver , clusterName )
887+ }
888+
889+ func testUnitClusterMaxMemoryConfig (driver string , clusterName string ) string {
890+ return fmt .Sprintf (`
891+ resource "minikube_cluster" "new" {
892+ driver = "%s"
893+ cluster_name = "%s"
894+ memory = "Max"
895+ }
896+ ` , driver , clusterName )
897+ }
898+
899+ func testUnitClusterNoLimitCPUConfig (driver string , clusterName string ) string {
900+ return fmt .Sprintf (`
901+ resource "minikube_cluster" "new" {
902+ driver = "%s"
903+ cluster_name = "%s"
904+ cpus = -1
905+ }
906+ ` , driver , clusterName )
907+ }
908+
909+ func testUnitClusterMaxCPUConfig (driver string , clusterName string ) string {
910+ return fmt .Sprintf (`
911+ resource "minikube_cluster" "new" {
912+ driver = "%s"
913+ cluster_name = "%s"
914+ cpus = 0
915+ }
916+ ` , driver , clusterName )
917+ }
0 commit comments