Skip to content

Commit

Permalink
add update test step
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmdarroch committed Jun 21, 2021
1 parent 5ec41d8 commit 2756d9b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions internal/provider/resource_vault_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ resource "hcp_vault_cluster" "test" {
tier = "dev"
}
data "hcp_vault_cluster" "test" {
cluster_id = hcp_vault_cluster.test.cluster_id
}
`

var testAccUpdatedVaultClusterConfig = `
resource "hcp_hvn" "test" {
hvn_id = "test-hvn"
cloud_provider = "aws"
region = "us-west-2"
}
resource "hcp_vault_cluster" "test" {
cluster_id = "test-vault-cluster"
hvn_id = hcp_hvn.test.hvn_id
tier = "dev"
public_endpoint = true
}
data "hcp_vault_cluster" "test" {
cluster_id = hcp_vault_cluster.test.cluster_id
}
Expand Down Expand Up @@ -126,6 +145,18 @@ func TestAccVaultCluster(t *testing.T) {
resource.TestCheckResourceAttrPair(vaultClusterResourceName, "created_at", vaultClusterDataSourceName, "created_at"),
),
},
// This step verifies the successful update of updatable fields.
{
Config: testConfig(testAccUpdatedVaultClusterConfig),
Check: resource.ComposeTestCheckFunc(
testAccCheckVaultClusterExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "public_endpoint", "true"),
resource.TestCheckResourceAttrSet(resourceName, "vault_public_endpoint_url"),
testAccCheckFullURL(resourceName, "vault_public_endpoint_url", "8200"),
resource.TestCheckResourceAttrSet(resourceName, "vault_private_endpoint_url"),
testAccCheckFullURL(resourceName, "vault_private_endpoint_url", "8200"),
),
},
},
})
}
Expand Down

0 comments on commit 2756d9b

Please sign in to comment.