Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acceptance Test Fixes #546

Merged
merged 4 commits into from Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion azurerm/resource_arm_route_table_test.go
Expand Up @@ -52,7 +52,7 @@ func TestAccAzureRMRouteTable_removeRoute(t *testing.T) {
resourceName := "azurerm_route_table.test"
ri := acctest.RandInt()
config := testAccAzureRMRouteTable_singleRoute(ri, testLocation())
updatedConfig := testAccAzureRMRouteTable_basic(ri, testLocation())
updatedConfig := testAccAzureRMRouteTable_singleRouteRemoved(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down Expand Up @@ -287,6 +287,22 @@ resource "azurerm_route_table" "test" {
`, rInt, location, rInt)
}

func testAccAzureRMRouteTable_singleRouteRemoved(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}

resource "azurerm_route_table" "test" {
name = "acctestrt%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
route = []
}
`, rInt, location, rInt)
}

func testAccAzureRMRouteTable_multipleRoutes(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
Expand Down
3 changes: 0 additions & 3 deletions azurerm/resource_arm_route_test.go
Expand Up @@ -25,7 +25,6 @@ func TestAccAzureRMRoute_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMRouteExists("azurerm_route.test"),
),
ExpectNonEmptyPlan: true,
},
},
})
Expand Down Expand Up @@ -68,15 +67,13 @@ func TestAccAzureRMRoute_multipleRoutes(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMRouteExists("azurerm_route.test"),
),
ExpectNonEmptyPlan: true,
},

{
Config: postConfig,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMRouteExists("azurerm_route.test1"),
),
ExpectNonEmptyPlan: true,
},
},
})
Expand Down
7 changes: 4 additions & 3 deletions azurerm/resource_arm_servicebus_namespace.go
Expand Up @@ -3,7 +3,6 @@ package azurerm
import (
"fmt"
"log"
"net/http"
"strings"

"github.com/Azure/azure-sdk-for-go/arm/servicebus"
Expand Down Expand Up @@ -188,8 +187,10 @@ func resourceArmServiceBusNamespaceDelete(d *schema.ResourceData, meta interface
resp := <-deleteResp
err = <-error

if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("Error issuing Azure ARM delete request of ServiceBus Namespace '%s': %+v", name, err)
if err != nil {
if !utils.ResponseWasNotFound(resp) {
return fmt.Errorf("Error issuing Azure ARM delete request of ServiceBus Namespace %q: %+v", name, err)
}
}

return nil
Expand Down
9 changes: 7 additions & 2 deletions azurerm/resource_arm_servicebus_queue.go
Expand Up @@ -236,7 +236,12 @@ func resourceArmServiceBusQueueDelete(d *schema.ResourceData, meta interface{})
namespaceName := id.Path["namespaces"]
name := id.Path["queues"]

_, err = client.Delete(resGroup, namespaceName, name)
resp, err := client.Delete(resGroup, namespaceName, name)
if err != nil {
if !utils.ResponseWasNotFound(resp) {
return err
}
}

return err
return nil
}
1 change: 1 addition & 0 deletions azurerm/resource_arm_servicebus_topic_test.go
Expand Up @@ -363,6 +363,7 @@ resource "azurerm_servicebus_namespace" "test" {
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "premium"
capacity = 1
}

resource "azurerm_servicebus_topic" "test" {
Expand Down