Skip to content

Commit 2a7a6c2

Browse files
authored
HVT-6147: Fix and enable vault acceptance tests (#1218)
* enable vault acceptance tests * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * change audit log config * change audit log config * removed empty plan * bug fix for check audit https resrource attr * . * adding changelog
1 parent 49fc6b7 commit 2a7a6c2

File tree

4 files changed

+46
-45
lines changed

4 files changed

+46
-45
lines changed

.changelog/1218.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:improvement
2+
Enabling failing HCP Vault Dedicates GHA pipeline tests with fix.
3+
```

internal/providersdkv2/resource_vault_cluster.go

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,55 +1336,55 @@ func flattenObservabilityConfig(config *vaultmodels.HashicorpCloudVault20201125O
13361336
configMap["cloudwatch_secret_access_key"] = config["cloudwatch_secret_access_key"].(string)
13371337
}
13381338
}
1339+
}
1340+
1341+
if elasticsearch := config.Elasticsearch; elasticsearch != nil {
1342+
configMap["elasticsearch_endpoint"] = elasticsearch.Endpoint
1343+
configMap["elasticsearch_dataset"] = elasticsearch.Dataset
1344+
configMap["elasticsearch_user"] = elasticsearch.User
1345+
1346+
// Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1347+
if elasticsearch.Password != "redacted" {
1348+
configMap["elasticsearch_password"] = elasticsearch.Password
1349+
} else {
1350+
if configParam, ok := d.GetOk(propertyName); ok && len(configParam.([]interface{})) > 0 {
1351+
config := configParam.([]interface{})[0].(map[string]interface{})
1352+
configMap["elasticsearch_password"] = config["elasticsearch_password"].(string)
1353+
}
1354+
}
1355+
}
13391356

1340-
if elasticsearch := config.Elasticsearch; elasticsearch != nil {
1341-
configMap["elasticsearch_endpoint"] = elasticsearch.Endpoint
1342-
configMap["elasticsearch_dataset"] = elasticsearch.Dataset
1343-
configMap["elasticsearch_user"] = elasticsearch.User
1357+
if http := config.HTTP; http != nil {
1358+
configMap["http_headers"] = http.Headers
1359+
configMap["http_codec"] = http.Codec
1360+
configMap["http_compression"] = http.Compression
1361+
configMap["http_method"] = http.Method
1362+
configMap["http_payload_prefix"] = http.PayloadPrefix
1363+
configMap["http_payload_suffix"] = http.PayloadSuffix
1364+
configMap["http_uri"] = http.URI
1365+
1366+
if http.Basic != nil {
1367+
configMap["http_basic_user"] = http.Basic.User
13441368

13451369
// Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1346-
if elasticsearch.Password != "redacted" {
1347-
configMap["elasticsearch_password"] = elasticsearch.Password
1370+
if http.Basic.Password != "redacted" {
1371+
configMap["http_basic_password"] = http.Basic.Password
13481372
} else {
13491373
if configParam, ok := d.GetOk(propertyName); ok && len(configParam.([]interface{})) > 0 {
13501374
config := configParam.([]interface{})[0].(map[string]interface{})
1351-
configMap["elasticsearch_password"] = config["elasticsearch_password"].(string)
1375+
configMap["http_basic_password"] = config["http_basic_password"].(string)
13521376
}
13531377
}
13541378
}
13551379

1356-
if http := config.HTTP; http != nil {
1357-
configMap["http_headers"] = http.Headers
1358-
configMap["http_codec"] = http.Codec
1359-
configMap["http_compression"] = http.Compression
1360-
configMap["http_method"] = http.Method
1361-
configMap["http_payload_prefix"] = http.PayloadPrefix
1362-
configMap["http_payload_suffix"] = http.PayloadSuffix
1363-
configMap["http_uri"] = http.URI
1364-
1365-
if http.Basic != nil {
1366-
configMap["http_basic_user"] = http.Basic.User
1367-
1368-
// Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1369-
if http.Basic.Password != "redacted" {
1370-
configMap["http_basic_password"] = http.Basic.Password
1371-
} else {
1372-
if configParam, ok := d.GetOk(propertyName); ok && len(configParam.([]interface{})) > 0 {
1373-
config := configParam.([]interface{})[0].(map[string]interface{})
1374-
configMap["http_basic_password"] = config["http_basic_password"].(string)
1375-
}
1376-
}
1377-
}
1378-
1379-
if http.Bearer != nil {
1380-
// Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1381-
if http.Bearer.Token != "redacted" {
1382-
configMap["http_bearer_token"] = http.Bearer.Token
1383-
} else {
1384-
if configParam, ok := d.GetOk(propertyName); ok && len(configParam.([]interface{})) > 0 {
1385-
config := configParam.([]interface{})[0].(map[string]interface{})
1386-
configMap["http_bearer_token"] = config["http_bearer_token"].(string)
1387-
}
1380+
if http.Bearer != nil {
1381+
// Since the API return this sensitive fields as redacted, we don't update it on the config in this situations
1382+
if http.Bearer.Token != "redacted" {
1383+
configMap["http_bearer_token"] = http.Bearer.Token
1384+
} else {
1385+
if configParam, ok := d.GetOk(propertyName); ok && len(configParam.([]interface{})) > 0 {
1386+
config := configParam.([]interface{})[0].(map[string]interface{})
1387+
configMap["http_bearer_token"] = config["http_bearer_token"].(string)
13881388
}
13891389
}
13901390
}

internal/providersdkv2/resource_vault_cluster_perf_replication_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ func setTestAccPerformanceReplicationE2E(t *testing.T, tfCode string, in *inputT
5050
}
5151

5252
func TestAcc_Vault_PerformanceReplication_ValidationsAws(t *testing.T) {
53-
t.Skip("Error:http is not enabled as an observability provider")
5453
t.Parallel()
5554

5655
awsPerfReplicationTestInput := &inputT{
@@ -62,7 +61,7 @@ func TestAcc_Vault_PerformanceReplication_ValidationsAws(t *testing.T) {
6261
Region: awsRegion,
6362
Tier: "PLUS_SMALL",
6463
UpdateTier1: "PLUS_MEDIUM",
65-
UpdateTier2: "DEV",
64+
UpdateTier2: "STANDARD_SMALL",
6665
Secondary: &inputT{
6766
HvnName: addTimestampSuffix("test-perf-hvn-2-"),
6867
HvnCidr: "172.24.16.0/20",
@@ -186,6 +185,7 @@ func performanceReplicationSteps(t *testing.T, in *inputT) []resource.TestStep {
186185
},
187186
{
188187
// add an http audit log provider
188+
// enabled LD flag hcpv-observability-http for int env
189189
Config: testConfig(setTestAccPerformanceReplicationE2E(t, `
190190
resource "hcp_vault_cluster" "c1" {
191191
cluster_id = "{{ .VaultClusterName }}"

internal/providersdkv2/resource_vault_cluster_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ func TestAcc_Vault_ClusterAzure(t *testing.T) {
7373
// This includes tests against both the resource, the corresponding datasource, and the dependent admin token resource
7474
// to shorten testing time.
7575
func TestAcc_Vault_ClusterAWS(t *testing.T) {
76-
t.Skip("resource_vault_cluster_test.go:94: Step 7/7 error: Check failed: Check 3/14 error: hcp_vault_cluster.test: Attribute 'public_endpoint' expected 'false', got 'true'")
77-
7876
awsTestInput := inputT{
7977
VaultClusterName: addTimestampSuffix("test-vault-aws-"),
8078
HvnName: testAccUniqueNameWithPrefix("vault-hvn-aws"),
@@ -342,10 +340,10 @@ func updateTierNetworkAndRemoveObservability(t *testing.T, in *inputT) resource.
342340
newIn.PublicEndpoint = "false"
343341
newIn.ProxyEndpoint = "DISABLED"
344342
return resource.TestStep{
345-
Config: testConfig(setTestAccVaultClusterConfig(t, updatedVaultClusterTierPublicProxyAndMVU, newIn, newIn.UpdateTier2)),
343+
Config: testConfig(setTestAccVaultClusterConfig(t, updatedVaultClusterTierPublicProxyAndMVU, newIn, newIn.UpdateTier1)),
346344
Check: resource.ComposeTestCheckFunc(
347345
testAccCheckVaultClusterExists(in.VaultClusterResourceName),
348-
resource.TestCheckResourceAttr(in.VaultClusterResourceName, "tier", in.UpdateTier2),
346+
resource.TestCheckResourceAttr(in.VaultClusterResourceName, "tier", in.UpdateTier1),
349347
resource.TestCheckResourceAttr(in.VaultClusterResourceName, "public_endpoint", "false"),
350348
resource.TestCheckResourceAttr(in.VaultClusterResourceName, "proxy_endpoint", "DISABLED"),
351349
resource.TestCheckResourceAttrSet(in.VaultClusterResourceName, "vault_public_endpoint_url"),

0 commit comments

Comments
 (0)