Skip to content

Commit

Permalink
fix: acc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrauschenbusch committed May 29, 2020
1 parent c615a63 commit 4aee0c4
Showing 1 changed file with 72 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,30 @@ func TestAccAzureRMEventGridEventSubscription_advancedFilter(t *testing.T) {
Config: testAccAzureRMEventGridEventSubscription_advancedFilter(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMEventGridEventSubscriptionExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_less_than.0.key", "data.filesite"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_less_than.0.value", "42.0"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_begins_with.0.key", "topic"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_begins_with.0.value", "topic_prefix"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.bool_equals.0.key", "subject"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.bool_equals.0.value", "true"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_greater_than.0.key", "data.metadataVersion"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_greater_than.0.value", "1"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_greater_than_or_equals.0.key", "data.contentLength"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_greater_than_or_equals.0.value", "42"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_less_than.0.key", "data.contentLength"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_less_than.0.value", "42.1"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_less_than_or_equals.0.key", "data.metadataVersion"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_less_than_or_equals.0.value", "2"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_in.0.key", "data.contentLength"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_in.0.values.0", "0"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_not_in.0.key", "data.contentLength"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.number_not_in.0.values.0", "5"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_begins_with.0.key", "subject"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_begins_with.0.values.0", "foo"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_ends_with.0.key", "subject"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_ends_with.0.values.0", "bar"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_contains.0.key", "data.contentType"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_contains.0.values.0", "application"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_in.0.key", "data.blobType"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_in.0.values.0", "Block"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_not_in.0.key", "data.blobType"),
resource.TestCheckResourceAttr(data.ResourceName, "advanced_filter.0.string_not_in.0.values.0", "Page"),
),
},
data.ImportStep(),
Expand Down Expand Up @@ -565,46 +585,89 @@ func testAccAzureRMEventGridEventSubscription_advancedFilter(data acceptance.Tes
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
name = "acctestRG-eg-%d"
location = "%s"
}
resource "azurerm_storage_account" "test" {
name = "acctestacc%s"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
account_tier = "Standard"
account_replication_type = "LRS"
tags = {
environment = "staging"
}
}
resource "azurerm_storage_queue" "test" {
name = "mysamplequeue-%d"
resource_group_name = "${azurerm_resource_group.test.name}"
storage_account_name = "${azurerm_storage_account.test.name}"
}
resource "azurerm_eventgrid_event_subscription" "test" {
name = "acctesteg-%d"
scope = "${azurerm_storage_account.test.id}"
storage_queue_endpoint {
storage_account_id = "${azurerm_storage_account.test.id}"
queue_name = "${azurerm_storage_queue.test.name}"
}
advanced_filter {
number_less_than {
bool_equals {
key = "subject"
value = true
}
number_greater_than {
key = "data.metadataVersion"
value = 1
}
number_greater_than_or_equals {
key = "data.contentLength"
value = 42.0
}
number_less_than {
key = "data.contentLength"
value = 42.1
}
number_less_than_or_equals {
key = "data.metadataVersion"
value = 2
}
number_in {
key = "data.contentLength"
values = [1, 1, 2, 3, 5]
values = [0, 1, 1, 2, 3]
}
number_not_in {
key = "data.contentLength"
values = [5, 8, 13, 21, 34]
}
string_begins_with {
key = "subject"
values = ["foo"]
}
string_ends_with {
key = "subject"
values = ["bar"]
}
string_contains {
key = "data.contentType"
values = ["application", "octet-stream"]
}
string_in {
key = "data.blobType"
values = ["Page", "Block"]
values = ["Block"]
}
string_not_in {
key = "data.blobType"
values = ["Page"]
}
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger)
}

0 comments on commit 4aee0c4

Please sign in to comment.