Skip to content

Commit

Permalink
Extend testAccAzureRMIotHub_customRoutes test
Browse files Browse the repository at this point in the history
Also check whether EventHub endpoint works
  • Loading branch information
Maksymilian Boguń committed Mar 8, 2019
1 parent a4e479e commit 010901f
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion azurerm/resource_arm_iothub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ func TestAccAzureRMIotHub_customRoutes(t *testing.T) {
Config: testAccAzureRMIotHub_customRoutes(rInt, rStr, testLocation()),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMIotHubExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "endpoint.#", "2"),
resource.TestCheckResourceAttr(resourceName, "endpoint.0.type", "AzureIotHub.StorageContainer"),
resource.TestCheckResourceAttr(resourceName, "endpoint.1.type", "AzureIotHub.IoTHub"),
resource.TestCheckResourceAttr(resourceName, "route.#", "2"),
),
},
{
Expand Down Expand Up @@ -289,6 +293,29 @@ resource "azurerm_storage_container" "test" {
container_access_type = "private"
}
resource "azurerm_eventhub_namespace" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
name = "acctest-%d"
sku = "Basic"
}
resource "azurerm_eventhub" "test" {
name = "acctest"
resource_group_name = "${azurerm_resource_group.test.name}"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
partition_count = 2
message_retention = 1
}
resource "azurerm_eventhub_authorization_rule" "test" {
resource_group_name = "${azurerm_resource_group.test.name}"
namespace_name = "${azurerm_eventhub_namespace.test.name}"
eventhub_name = "${azurerm_eventhub.test.name}"
name = "acctest"
send = true
}
resource "azurerm_iothub" "test" {
name = "acctestIoTHub-%d"
resource_group_name = "${azurerm_resource_group.test.name}"
Expand All @@ -311,6 +338,12 @@ resource "azurerm_iothub" "test" {
file_name_format = "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}"
}
endpoint {
type = "AzureIotHub.EventHub"
connection_string = "${azurerm_eventhub_authorization_rule.test.primary_connection_string}"
name = "export2"
}
route {
name = "export"
source = "DeviceMessages"
Expand All @@ -319,11 +352,19 @@ resource "azurerm_iothub" "test" {
enabled = true
}
route {
name = "export2"
source = "DeviceMessages"
condition = "true"
endpoint_names = ["export2"]
enabled = true
}
tags {
"purpose" = "testing"
}
}
`, rInt, location, rStr, rInt)
`, rInt, location, rStr, rInt, rInt)
}

func testAccAzureRMIotHub_fallbackRoute(rInt int, location string) string {
Expand Down

0 comments on commit 010901f

Please sign in to comment.