From 4c2120d9f020bf4ee3d64acf32baf05990a6d0d5 Mon Sep 17 00:00:00 2001 From: Frederic Berot-Armand Date: Thu, 10 Nov 2022 10:28:32 +0000 Subject: [PATCH] Fix nic test --- outscale/resource_outscale_nic_test.go | 28 ++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/outscale/resource_outscale_nic_test.go b/outscale/resource_outscale_nic_test.go index bf6238a52..b8f74cbe8 100644 --- a/outscale/resource_outscale_nic_test.go +++ b/outscale/resource_outscale_nic_test.go @@ -19,27 +19,30 @@ func TestAccOutscaleOAPIENI_basic(t *testing.T) { t.Parallel() var conf oscgo.Nic subregion := os.Getenv("OUTSCALE_REGION") + resourceName := "outscale_nic.outscale_nic" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "outscale_nic.outscale_nic", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckOutscaleOAPINICDestroy, Steps: []resource.TestStep{ { Config: testAccOutscaleOAPIENIConfig(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleOAPIENIExists(resourceName, &conf), testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), - resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "2"), + resource.TestCheckResourceAttr(resourceName, "primary_private_ip.#", "1"), + resource.TestCheckResourceAttr(resourceName, "secondary_private_ips.#", "1"), ), }, { Config: testAccOutscaleOAPIENIConfigUpdate(subregion), Check: resource.ComposeTestCheckFunc( - testAccCheckOutscaleOAPIENIExists("outscale_nic.outscale_nic", &conf), + testAccCheckOutscaleOAPIENIExists(resourceName, &conf), testAccCheckOutscaleOAPIENIAttributes(&conf, subregion), - resource.TestCheckResourceAttr("outscale_nic.outscale_nic", "private_ips.#", "3"), + resource.TestCheckResourceAttr(resourceName, "primary_private_ip.#", "1"), + resource.TestCheckResourceAttr(resourceName, "secondary_private_ips.#", "2"), ), }, }, @@ -130,13 +133,11 @@ func testAccOutscaleOAPIENIConfig(subregion string) string { subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" security_group_ids = ["${outscale_security_group.outscale_sg.security_group_id}"] - private_ips { - is_primary = true + primary_private_ip { private_ip = "10.0.0.23" } - private_ips { - is_primary = false + secondary_private_ips { private_ip = "10.0.0.46" } } @@ -169,18 +170,15 @@ func testAccOutscaleOAPIENIConfigUpdate(subregion string) string { subnet_id = "${outscale_subnet.outscale_subnet.subnet_id}" security_group_ids = ["${outscale_security_group.outscale_sg.security_group_id}"] - private_ips { - is_primary = true + primary_private_ip { private_ip = "10.0.0.23" } - private_ips { - is_primary = false + secondary_private_ips { private_ip = "10.0.0.46" } - private_ips { - is_primary = false + secondary_private_ips { private_ip = "10.0.0.69" } }