Skip to content

Commit

Permalink
Fix nic test
Browse files Browse the repository at this point in the history
  • Loading branch information
FredericBerot-Armand committed Nov 10, 2022
1 parent 36a8ffe commit 4c2120d
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions outscale/resource_outscale_nic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
},
Expand Down Expand Up @@ -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"
}
}
Expand Down Expand Up @@ -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"
}
}
Expand Down

0 comments on commit 4c2120d

Please sign in to comment.