Skip to content

Commit

Permalink
chore: add more information to error
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomatavelli-f3 committed Sep 12, 2024
1 parent eed39e0 commit f984e75
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions drpv4/resource_drp_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,41 @@ func TestAccResourceSubnet(t *testing.T) {
{
Config: `
resource "drp_subnet" "test" {
name = "test#"
name = "test1"
description = "test subnet"
subnet = "192.168.0.0/24"
active_start = "192.168.0.1"
active_end = "192.168.0.255"
}
`,
ExpectError: regexp.MustCompile("Invalid Name `test#`"),
ExpectNonEmptyPlan: true,
ExpectError: regexp.MustCompile("Not Found"),
PreConfig: func() {
t.Log("Removing subnet using DRP API to test terraform error handling")
client := testAccProvider.Meta().(*Config)
r, err := client.session.ListModel("subnets")
if err != nil {
t.Fatal("failed to list subnets")
}
t.Logf("got response: %v", r)

_, err = client.session.DeleteModel("subnets", "test1")
if err != nil {
t.Fatalf("failed to remove subnet using DRP API: %v", err)
}
},
},
{
Config: `
resource "drp_subnet" "test" {
name = "test1"
name = "test#"
description = "test subnet"
subnet = "192.168.0.0/24"
active_start = "192.168.0.1"
active_end = "192.168.0.255"
}
`,
ExpectNonEmptyPlan: true,
ExpectError: regexp.MustCompile("Not Found"),
PreConfig: func() {
client := testAccProvider.Meta().(*Config)
client.session.DeleteModel("subnets", "test1")
},
ExpectError: regexp.MustCompile("Invalid Name `test#`"),
},
},
})
Expand Down

0 comments on commit f984e75

Please # to comment.