From 8fd48dab7d221fe20ef2c34bf6a7bbcb1833060a Mon Sep 17 00:00:00 2001 From: IuliaBlindu <35154453+IuliaBlindu@users.noreply.github.com> Date: Wed, 21 Jul 2021 17:57:57 +0300 Subject: [PATCH] Fix/tests v6 (#61) changed k8s_version from tests to 1.20.8 --- ionoscloud/data_source_k8s_cluster_test.go | 10 +++++----- ionoscloud/data_source_k8s_node_pool_test.go | 10 +++++----- ionoscloud/resource_k8s_cluster_test.go | 4 ++-- ionoscloud/resource_k8s_node_pool.go | 12 ++++++------ ionoscloud/resource_k8s_node_pool_test.go | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ionoscloud/data_source_k8s_cluster_test.go b/ionoscloud/data_source_k8s_cluster_test.go index 3371c03bc..b38e82058 100644 --- a/ionoscloud/data_source_k8s_cluster_test.go +++ b/ionoscloud/data_source_k8s_cluster_test.go @@ -22,7 +22,7 @@ func TestAccDataSourceK8sCluster_matchId(t *testing.T) { Config: testAccDataSourceProfitBricksK8sClusterMatchId, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "name", "test_cluster"), - resource.TestCheckResourceAttr("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "k8s_version", "1.20.6"), + resource.TestCheckResourceAttr("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "k8s_version", "1.20.8"), resource.TestCheckResourceAttrSet("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "kube_config"), ), }, @@ -44,7 +44,7 @@ func TestAccDataSourceK8sCluster_matchName(t *testing.T) { Config: testAccDataSourceProfitBricksK8sClusterMatchName, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "name", "test_cluster"), - resource.TestCheckResourceAttr("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "k8s_version", "1.20.6"), + resource.TestCheckResourceAttr("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "k8s_version", "1.20.8"), resource.TestCheckResourceAttrSet("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "kube_config"), resource.TestCheckResourceAttrSet("data.ionoscloud_k8s_cluster.test_ds_k8s_cluster", "id"), ), @@ -57,14 +57,14 @@ func TestAccDataSourceK8sCluster_matchName(t *testing.T) { const testAccDataSourceProfitBricksK8sClusterCreateResources = ` resource "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" { name = "test_cluster" - k8s_version = "1.20.6" + k8s_version = "1.20.8" } ` const testAccDataSourceProfitBricksK8sClusterMatchId = ` resource "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" { name = "test_cluster" - k8s_version = "1.20.6" + k8s_version = "1.20.8" } data "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" { @@ -75,7 +75,7 @@ data "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" { const testAccDataSourceProfitBricksK8sClusterMatchName = ` resource "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" { name = "test_cluster" - k8s_version = "1.20.6" + k8s_version = "1.20.8" } data "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" { diff --git a/ionoscloud/data_source_k8s_node_pool_test.go b/ionoscloud/data_source_k8s_node_pool_test.go index ae872db79..fb9b9f0d0 100644 --- a/ionoscloud/data_source_k8s_node_pool_test.go +++ b/ionoscloud/data_source_k8s_node_pool_test.go @@ -22,7 +22,7 @@ func TestAccDataSourceK8sNodePool_matchId(t *testing.T) { Config: testAccDataSourceProfitBricksK8sNodePoolMatchId, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.ionoscloud_k8s_node_pool.test_ds_k8s_node_pool", "name", "test_nodepool"), - resource.TestCheckResourceAttr("data.ionoscloud_k8s_node_pool.test_ds_k8s_node_pool", "k8s_version", "1.20.6"), + resource.TestCheckResourceAttr("data.ionoscloud_k8s_node_pool.test_ds_k8s_node_pool", "k8s_version", "1.20.8"), ), }, }, @@ -43,7 +43,7 @@ func TestAccDataSourceK8sNodePool_matchName(t *testing.T) { Config: testAccDataSourceProfitBricksK8sNodePoolMatchName, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.ionoscloud_k8s_node_pool.test_ds_k8s_node_pool", "name", "test_nodepool"), - resource.TestCheckResourceAttr("data.ionoscloud_k8s_node_pool.test_ds_k8s_node_pool", "k8s_version", "1.20.6"), + resource.TestCheckResourceAttr("data.ionoscloud_k8s_node_pool.test_ds_k8s_node_pool", "k8s_version", "1.20.8"), resource.TestCheckResourceAttrSet("data.ionoscloud_k8s_node_pool.test_ds_k8s_node_pool", "id"), ), }, @@ -75,7 +75,7 @@ resource "ionoscloud_k8s_node_pool" "test_ds_k8s_node_pool" { availability_zone = "AUTO" storage_type = "HDD" storage_size = 15 - k8s_version = "1.20.6" + k8s_version = "1.20.8" } ` @@ -102,7 +102,7 @@ resource "ionoscloud_k8s_node_pool" "test_ds_k8s_node_pool" { availability_zone = "AUTO" storage_type = "HDD" storage_size = 15 - k8s_version = "1.20.6" + k8s_version = "1.20.8" # public_ips = [ "158.222.102.239", "158.222.102.241", "158.222.102.242" ] # public_ips = [ ] # public_ips = [ ] @@ -137,7 +137,7 @@ resource "ionoscloud_k8s_node_pool" "test_ds_k8s_node_pool" { availability_zone = "AUTO" storage_type = "HDD" storage_size = 15 - k8s_version = "1.20.6" + k8s_version = "1.20.8" # public_ips = [ "158.222.102.239", "158.222.102.241", "158.222.102.242" ] # public_ips = [ ] # public_ips = [ ] diff --git a/ionoscloud/resource_k8s_cluster_test.go b/ionoscloud/resource_k8s_cluster_test.go index 2acaa1c55..4e4057bd0 100644 --- a/ionoscloud/resource_k8s_cluster_test.go +++ b/ionoscloud/resource_k8s_cluster_test.go @@ -147,7 +147,7 @@ func testAccCheckk8sClusterExists(n string, k8sCluster *ionoscloud.KubernetesClu const testAccCheckk8sClusterConfigBasic = ` resource "ionoscloud_k8s_cluster" "example" { name = "%s" - k8s_version = "1.20.6" + k8s_version = "1.20.8" maintenance_window { day_of_the_week = "Sunday" time = "09:00:00Z" @@ -157,7 +157,7 @@ resource "ionoscloud_k8s_cluster" "example" { const testAccCheckk8sClusterConfigUpdate = ` resource "ionoscloud_k8s_cluster" "example" { name = "updated" - k8s_version = "1.20.6" + k8s_version = "1.20.8" maintenance_window { day_of_the_week = "Monday" time = "10:30:00Z" diff --git a/ionoscloud/resource_k8s_node_pool.go b/ionoscloud/resource_k8s_node_pool.go index 29215877f..5543af930 100644 --- a/ionoscloud/resource_k8s_node_pool.go +++ b/ionoscloud/resource_k8s_node_pool.go @@ -540,8 +540,8 @@ func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta i nodePoolLans := make([]interface{}, 0) if k8sNodepool.Properties.Lans != nil && len(*k8sNodepool.Properties.Lans) > 0 { - nodePoolLans = make([]interface{}, len(*k8sNodepool.Properties.Lans)) - for lanIndex, nodePoolLan := range *k8sNodepool.Properties.Lans { + nodePoolLans = make([]interface{}, 0) + for _, nodePoolLan := range *k8sNodepool.Properties.Lans { lanEntry := make(map[string]interface{}) if nodePoolLan.Id != nil { @@ -554,8 +554,8 @@ func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta i nodePoolRoutes := make([]interface{}, 0) if nodePoolLan.Routes != nil && len(*nodePoolLan.Routes) > 0 { - nodePoolRoutes = make([]interface{}, len(*nodePoolLan.Routes)) - for routeIndex, nodePoolRoute := range *nodePoolLan.Routes { + nodePoolRoutes = make([]interface{}, 0) + for _, nodePoolRoute := range *nodePoolLan.Routes { routeEntry := make(map[string]string) if nodePoolRoute.Network != nil { routeEntry["network"] = *nodePoolRoute.Network @@ -563,7 +563,7 @@ func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta i if nodePoolRoute.GatewayIp != nil { routeEntry["gateway_ip"] = *nodePoolRoute.GatewayIp } - nodePoolRoutes[routeIndex] = routeEntry + nodePoolRoutes = append(nodePoolRoutes, routeEntry) } } @@ -571,7 +571,7 @@ func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta i lanEntry["routes"] = nodePoolRoutes } - nodePoolLans[lanIndex] = lanEntry + nodePoolLans = append(nodePoolLans, lanEntry) } } diff --git a/ionoscloud/resource_k8s_node_pool_test.go b/ionoscloud/resource_k8s_node_pool_test.go index cdb6dbddd..684e068b6 100644 --- a/ionoscloud/resource_k8s_node_pool_test.go +++ b/ionoscloud/resource_k8s_node_pool_test.go @@ -204,7 +204,7 @@ resource "ionoscloud_datacenter" "terraform_acctest" { resource "ionoscloud_k8s_cluster" "terraform_acctest" { name = "terraform_acctest2" - k8s_version = "1.20.6" + k8s_version = "1.20.8" maintenance_window { day_of_the_week = "Monday" time = "09:00:00Z" @@ -239,7 +239,7 @@ resource "ionoscloud_datacenter" "terraform_acctest" { resource "ionoscloud_k8s_cluster" "terraform_acctest" { name = "terraform_acctest2" - k8s_version = "1.20.6" + k8s_version = "1.20.8" maintenance_window { day_of_the_week = "Monday" time = "09:00:00Z" @@ -284,7 +284,7 @@ resource "ionoscloud_lan" "terraform_acctest" { resource "ionoscloud_k8s_cluster" "terraform_acctest" { name = "terraform_acctest_lan" - k8s_version = "1.20.6" + k8s_version = "1.20.8" maintenance_window { day_of_the_week = "Monday" time = "09:00:00Z" @@ -324,7 +324,7 @@ resource "ionoscloud_lan" "terraform_acctest" { resource "ionoscloud_k8s_cluster" "terraform_acctest" { name = "terraform_acctest_lan" - k8s_version = "1.20.6" + k8s_version = "1.20.8" maintenance_window { day_of_the_week = "Monday" time = "09:00:00Z"