Skip to content

Commit

Permalink
azurerm_synapse_spark_pool - spark_version now supports 3.0 #11972
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzkilcan authored May 26, 2021
1 parent e1d7c33 commit b25d722
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func resourceSynapseSparkPool() *pluginsdk.Resource {
Default: "2.4",
ValidateFunc: validation.StringInSlice([]string{
"2.4",
"3.0",
}, false),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestAccSynapseSparkPool_complete(t *testing.T) {

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data),
Config: r.complete(data, "2.4"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand All @@ -75,7 +75,52 @@ func TestAccSynapseSparkPool_update(t *testing.T) {
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
{
Config: r.complete(data),
Config: r.complete(data, "2.4"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
})
}

func TestAccSynapseSpark3Pool_complete(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_synapse_spark_pool", "test")
r := SynapseSparkPoolResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.complete(data, "3.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
// not returned by service
data.ImportStep("spark_events_folder", "spark_log_folder"),
})
}

func TestAccSynapseSpark3Pool_update(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_synapse_spark_pool", "test")
r := SynapseSparkPoolResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("spark_events_folder", "spark_log_folder"),
{
Config: r.complete(data, "3.0"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand Down Expand Up @@ -138,7 +183,7 @@ resource "azurerm_synapse_spark_pool" "import" {
`, config)
}

func (r SynapseSparkPoolResource) complete(data acceptance.TestData) string {
func (r SynapseSparkPoolResource) complete(data acceptance.TestData, sparkVersion string) string {
template := r.template(data)
return fmt.Sprintf(`
%s
Expand Down Expand Up @@ -168,13 +213,13 @@ EOF
spark_log_folder = "/logs"
spark_events_folder = "/events"
spark_version = "2.4"
spark_version = "%s"
tags = {
ENV = "Test"
}
}
`, template, data.RandomString)
`, template, data.RandomString, sparkVersion)
}

func (r SynapseSparkPoolResource) template(data acceptance.TestData) string {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/synapse_spark_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The following arguments are supported:

* `spark_events_folder` - (Optional) The Spark events folder. Defaults to `/events`.

* `spark_version` - (Optional) The Apache Spark version. Possible value is `2.4`. Defaults to `2.4`.
* `spark_version` - (Optional) The Apache Spark version. Possible values are `2.4` and `3.0`. Defaults to `2.4`.

* `tags` - (Optional) A mapping of tags which should be assigned to the Synapse Spark Pool.

Expand Down

0 comments on commit b25d722

Please sign in to comment.