Skip to content

Commit

Permalink
Merge pull request #4522 from hashicorp/b-azure-acceptance-tests
Browse files Browse the repository at this point in the history
provider/azure: Fix up acctest destroy checks
  • Loading branch information
jen20 committed Jan 6, 2016
2 parents a8d2ad3 + 42a3800 commit d3f8e1f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin/providers/azure/resource_azure_dns_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/management"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand Down Expand Up @@ -98,6 +99,10 @@ func testAccCheckAzureDnsServerDestroy(s *terraform.State) error {

netConf, err := vnetClient.GetVirtualNetworkConfiguration()
if err != nil {
// This is desirable - if there is no network config there can't be any DNS Servers
if management.IsResourceNotFoundError(err) {
continue
}
return fmt.Errorf("Error retrieving networking configuration from Azure: %s", err)
}

Expand Down
5 changes: 5 additions & 0 deletions builtin/providers/azure/resource_azure_local_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/management"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand Down Expand Up @@ -109,6 +110,10 @@ func testAccAzureLocalNetworkConnectionDestroyed(s *terraform.State) error {

netConf, err := vnetClient.GetVirtualNetworkConfiguration()
if err != nil {
// This is desirable - if there is no network config there can be no gateways
if management.IsResourceNotFoundError(err) {
continue
}
return err
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/management"
"github.com/Azure/azure-sdk-for-go/management/virtualnetwork"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down Expand Up @@ -185,6 +186,10 @@ func testAccCheckAzureVirtualNetworkDestroy(s *terraform.State) error {

nc, err := vnetClient.GetVirtualNetworkConfiguration()
if err != nil {
if management.IsResourceNotFoundError(err) {
// This is desirable - no configuration = no networks
continue
}
return fmt.Errorf("Error retrieving Virtual Network Configuration: %s", err)
}

Expand Down

0 comments on commit d3f8e1f

Please sign in to comment.