Skip to content

Commit

Permalink
bugfix: set format of json-serialized eventhub output of a SA job
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksymilian Boguń committed Apr 26, 2019
1 parent 9c065c3 commit 0d8cb5f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions azurerm/helpers/azure/stream_analytics_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func ExpandStreamAnalyticsOutputSerialization(input []interface{}) (streamanalyt
Type: streamanalytics.TypeJSON,
JSONSerializationProperties: &streamanalytics.JSONSerializationProperties{
Encoding: streamanalytics.Encoding(encoding),
Format: streamanalytics.JSONOutputSerializationFormat(format),
},
}, nil
}
Expand Down
52 changes: 52 additions & 0 deletions azurerm/resource_arm_stream_analytics_output_eventhub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,35 @@ func TestAccAzureRMStreamAnalyticsOutputEventHub_json(t *testing.T) {
})
}

func TestAccAzureRMStreamAnalyticsOutputEventHub_jsonArrayFormat(t *testing.T) {
resourceName := "azurerm_stream_analytics_output_eventhub.test"
ri := tf.AccRandTimeInt()
location := testLocation()

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMStreamAnalyticsOutputEventHubDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMStreamAnalyticsOutputEventHub_jsonArrayFormat(ri, location),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMStreamAnalyticsOutputEventHubExists(resourceName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
// not returned from the API
"shared_access_policy_key",
},
},
},
})
}

func TestAccAzureRMStreamAnalyticsOutputEventHub_update(t *testing.T) {
resourceName := "azurerm_stream_analytics_output_eventhub.test"
ri := tf.AccRandTimeInt()
Expand Down Expand Up @@ -280,6 +309,29 @@ resource "azurerm_stream_analytics_output_eventhub" "test" {
`, template, rInt)
}

func testAccAzureRMStreamAnalyticsOutputEventHub_jsonArrayFormat(rInt int, location string) string {
template := testAccAzureRMStreamAnalyticsOutputEventHub_template(rInt, location)
return fmt.Sprintf(`
%s
resource "azurerm_stream_analytics_output_eventhub" "test" {
name = "acctestinput-%d"
stream_analytics_job_name = "${azurerm_stream_analytics_job.test.name}"
resource_group_name = "${azurerm_stream_analytics_job.test.resource_group_name}"
eventhub_name = "${azurerm_eventhub.test.name}"
servicebus_namespace = "${azurerm_eventhub_namespace.test.name}"
shared_access_policy_key = "${azurerm_eventhub_namespace.test.default_primary_key}"
shared_access_policy_name = "RootManageSharedAccessKey"
serialization {
type = "Json"
encoding = "UTF8"
format = "Array"
}
}
`, template, rInt)
}

func testAccAzureRMStreamAnalyticsOutputEventHub_updated(rInt int, location string) string {
template := testAccAzureRMStreamAnalyticsOutputEventHub_template(rInt, location)
return fmt.Sprintf(`
Expand Down

0 comments on commit 0d8cb5f

Please sign in to comment.