Merge pull request #4522 from hashicorp/b-azure-acceptance-tests
provider/azure: Fix up acctest destroy checks
This commit is contained in:
commit
d3f8e1f8e3
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/Azure/azure-sdk-for-go/management"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
|
@ -98,6 +99,10 @@ func testAccCheckAzureDnsServerDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
netConf, err := vnetClient.GetVirtualNetworkConfiguration()
|
netConf, err := vnetClient.GetVirtualNetworkConfiguration()
|
||||||
if err != nil {
|
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)
|
return fmt.Errorf("Error retrieving networking configuration from Azure: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/Azure/azure-sdk-for-go/management"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
|
@ -109,6 +110,10 @@ func testAccAzureLocalNetworkConnectionDestroyed(s *terraform.State) error {
|
||||||
|
|
||||||
netConf, err := vnetClient.GetVirtualNetworkConfiguration()
|
netConf, err := vnetClient.GetVirtualNetworkConfiguration()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// This is desirable - if there is no network config there can be no gateways
|
||||||
|
if management.IsResourceNotFoundError(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/Azure/azure-sdk-for-go/management"
|
||||||
"github.com/Azure/azure-sdk-for-go/management/virtualnetwork"
|
"github.com/Azure/azure-sdk-for-go/management/virtualnetwork"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
@ -185,6 +186,10 @@ func testAccCheckAzureVirtualNetworkDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
nc, err := vnetClient.GetVirtualNetworkConfiguration()
|
nc, err := vnetClient.GetVirtualNetworkConfiguration()
|
||||||
if err != nil {
|
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)
|
return fmt.Errorf("Error retrieving Virtual Network Configuration: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue