Skip to content

Commit

Permalink
Fix test TestAccDataprocClusterLabelsMigration_withRemoval (#9245) (#…
Browse files Browse the repository at this point in the history
…6515)

[upstream:7e230fd4fdc8986472f2cdf9b335c3f00d974783]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 16, 2023
1 parent 0a91001 commit c625277
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 51 deletions.
3 changes: 3 additions & 0 deletions .changelog/9245.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
Original file line number Diff line number Diff line change
Expand Up @@ -163,54 +163,3 @@ func TestAccDataprocClusterLabelsMigration_withUpdate(t *testing.T) {
},
})
}

// This test fails in the nightly test. The reason to keep it is that
// it could tell if the new model is broken later.
func TestAccDataprocClusterLabelsMigration_withRemoval(t *testing.T) {
acctest.SkipIfVcr(t)
t.Parallel()

rnd := acctest.RandString(t, 10)
var cluster dataproc.Cluster
oldVersion := map[string]resource.ExternalProvider{
"google": {
VersionConstraint: "4.65.0", // a version that doesn't separate user defined labels and system labels
Source: "registry.terraform.io/hashicorp/google",
},
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
CheckDestroy: testAccCheckDataprocClusterDestroy(t),
Steps: []resource.TestStep{
{
Config: testAccDataprocCluster_withLabels(rnd),
ExternalProviders: oldVersion,
},
{
Config: testAccDataprocCluster_withoutLabels(rnd),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Check: resource.ComposeTestCheckFunc(
testAccCheckDataprocClusterExists(t, "google_dataproc_cluster.with_labels", &cluster),

resource.TestCheckNoResourceAttr("google_dataproc_cluster.with_labels", "labels.%"),
// GCP adds three and goog-dataproc-autozone is added internally, so expect 4.
resource.TestCheckResourceAttr("google_dataproc_cluster.with_labels", "effective_labels.%", "4"),
),
},
{
Config: testAccDataprocCluster_withLabels(rnd),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Check: resource.ComposeTestCheckFunc(
testAccCheckDataprocClusterExists(t, "google_dataproc_cluster.with_labels", &cluster),

resource.TestCheckResourceAttr("google_dataproc_cluster.with_labels", "labels.%", "1"),
resource.TestCheckResourceAttr("google_dataproc_cluster.with_labels", "labels.key1", "value1"),
// We only provide one, but GCP adds three and goog-dataproc-autozone is added internally, so expect 5.
resource.TestCheckResourceAttr("google_dataproc_cluster.with_labels", "effective_labels.%", "5"),
resource.TestCheckResourceAttr("google_dataproc_cluster.with_labels", "effective_labels.key1", "value1"),
),
},
},
})
}

0 comments on commit c625277

Please sign in to comment.