@@ -290,7 +290,46 @@ resource "ovh_cloud_project_kube_nodepool" "pool" {
290
290
291
291
`
292
292
293
- func TestAccCloudProjectKubeNodePool (t * testing.T ) {
293
+ var testAccCloudProjectKubeNodePoolConfigWithoutMaxMin = `
294
+ resource "ovh_cloud_project_kube" "cluster" {
295
+ service_name = "%s"
296
+ name = "%s"
297
+ region = "%s"
298
+ version = "%s"
299
+ }
300
+
301
+ resource "ovh_cloud_project_kube_nodepool" "pool" {
302
+ service_name = ovh_cloud_project_kube.cluster.service_name
303
+ kube_id = ovh_cloud_project_kube.cluster.id
304
+ name = ovh_cloud_project_kube.cluster.name
305
+ flavor_name = "b2-7"
306
+ desired_nodes = 1
307
+ template {
308
+ metadata {
309
+ annotations = {
310
+ a1 = "av1"
311
+ }
312
+ finalizers = ["finalizer.extensions/v1beta1"]
313
+ labels = {
314
+ l1 = "lv1"
315
+ }
316
+ }
317
+ spec {
318
+ unschedulable = false
319
+ taints = [
320
+ {
321
+ effect = "PreferNoSchedule"
322
+ key = "t1"
323
+ value = "tv1"
324
+ }
325
+ ]
326
+ }
327
+ }
328
+ }
329
+
330
+ `
331
+
332
+ func TestAccCloudProjectKubeNodePoolRessource (t * testing.T ) {
294
333
name := acctest .RandomWithPrefix (test_prefix )
295
334
region := os .Getenv ("OVH_CLOUD_PROJECT_KUBE_REGION_TEST" )
296
335
version := os .Getenv ("OVH_CLOUD_PROJECT_KUBE_VERSION_TEST" )
@@ -316,7 +355,13 @@ func TestAccCloudProjectKubeNodePool(t *testing.T) {
316
355
region ,
317
356
version ,
318
357
)
319
-
358
+ configWithoutMaxMinNodes := fmt .Sprintf (
359
+ testAccCloudProjectKubeNodePoolConfigWithoutMaxMin ,
360
+ os .Getenv ("OVH_CLOUD_PROJECT_SERVICE_TEST" ),
361
+ name ,
362
+ region ,
363
+ version ,
364
+ )
320
365
resource .Test (t , resource.TestCase {
321
366
PreCheck : func () {
322
367
testAccPreCheckCloud (t )
@@ -325,6 +370,29 @@ func TestAccCloudProjectKubeNodePool(t *testing.T) {
325
370
},
326
371
Providers : testAccProviders ,
327
372
Steps : []resource.TestStep {
373
+ {
374
+ Config : configWithoutMaxMinNodes ,
375
+ Check : resource .ComposeTestCheckFunc (
376
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube.cluster" , "region" , region ),
377
+ resource .TestCheckResourceAttrSet ("ovh_cloud_project_kube.cluster" , "kubeconfig" ),
378
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube.cluster" , "name" , name ),
379
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube.cluster" , "version" , version ),
380
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "name" , name ),
381
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "flavor_name" , "b2-7" ),
382
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "desired_nodes" , "1" ),
383
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "min_nodes" , "0" ),
384
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "max_nodes" , "100" ),
385
+
386
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.metadata.0.annotations.a1" , "av1" ),
387
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.metadata.0.finalizers.0" , "finalizer.extensions/v1beta1" ),
388
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.metadata.0.labels.l1" , "lv1" ),
389
+
390
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.spec.0.taints.0.effect" , "PreferNoSchedule" ),
391
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.spec.0.taints.0.key" , "t1" ),
392
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.spec.0.taints.0.value" , "tv1" ),
393
+ resource .TestCheckResourceAttr ("ovh_cloud_project_kube_nodepool.pool" , "template.0.spec.0.unschedulable" , "false" ),
394
+ ),
395
+ },
328
396
{
329
397
Config : config ,
330
398
Check : resource .ComposeTestCheckFunc (
0 commit comments