Skip to content

Commit f0e52f4

Browse files
authored
Merge pull request #1593 from vmware/fix-project-test
Fix project test
2 parents 25aa9f7 + b4b578c commit f0e52f4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

nsxt/resource_nsxt_policy_project_test.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,15 @@ resource "nsxt_policy_project" "test" {
483483
`
484484

485485
func getBasicAttrMap(createFlow, includeT0GW bool) map[string]string {
486-
var attrMap map[string]string
486+
attrMap := make(map[string]string)
487+
baseMap := accTestPolicyProjectUpdateAttributes
487488
if createFlow {
488-
attrMap = accTestPolicyProjectCreateAttributes
489-
} else {
490-
// do not pass short_id on update
491-
attrMap = make(map[string]string)
492-
attrMap["DisplayName"] = accTestPolicyProjectUpdateAttributes["DisplayName"]
493-
attrMap["Description"] = accTestPolicyProjectUpdateAttributes["Description"]
489+
baseMap = accTestPolicyProjectCreateAttributes
490+
//do not pass short_id on update
491+
attrMap["ShortId"] = baseMap["ShortId"]
494492
}
493+
attrMap["DisplayName"] = baseMap["DisplayName"]
494+
attrMap["Description"] = baseMap["Description"]
495495
if includeT0GW {
496496
attrMap["T0GwPath"] = "data.nsxt_policy_tier0_gateway.test.path"
497497
}
@@ -502,7 +502,7 @@ func getBasicAttrMap(createFlow, includeT0GW bool) map[string]string {
502502
func testAccNsxtPolicyProjectTemplate410(createFlow, includeT0GW bool) string {
503503
attrMap := getBasicAttrMap(createFlow, includeT0GW)
504504
buffer := new(bytes.Buffer)
505-
tmpl, err := template.New("testAaccNsxtPolicyProject").Parse(templateData)
505+
tmpl, err := template.New("testAccNsxtPolicyProjectTemplate410").Parse(templateData)
506506
if err != nil {
507507
panic(err)
508508
}
@@ -520,7 +520,7 @@ func testAccNsxtPolicyProjectTemplate411(createFlow, includeT0GW, includeExterna
520520
}
521521
attrMap["SetIpBlockVisibility"] = "true"
522522
buffer := new(bytes.Buffer)
523-
tmpl, err := template.New("testAaccNsxtPolicyProject").Parse(templateData)
523+
tmpl, err := template.New("testAccNsxtPolicyProjectTemplate411").Parse(templateData)
524524
if err != nil {
525525
panic(err)
526526
}
@@ -539,7 +539,7 @@ func testAccNsxtPolicyProjectTemplate420(createFlow, includeT0GW, includeExterna
539539
attrMap["SetIpBlockVisibility"] = "true"
540540
attrMap["ActivateDefaultDfwRules"] = strconv.FormatBool(activateDefaultDfwRules)
541541
buffer := new(bytes.Buffer)
542-
tmpl, err := template.New("testAaccNsxtPolicyProject").Parse(templateData)
542+
tmpl, err := template.New("testAccNsxtPolicyProjectTemplate420").Parse(templateData)
543543
if err != nil {
544544
panic(err)
545545
}
@@ -559,7 +559,7 @@ func testAccNsxtPolicyProjectTemplate900(createFlow, includeT0GW, includeExterna
559559
attrMap["ActivateDefaultDfwRules"] = strconv.FormatBool(activateDefaultDfwRules)
560560
attrMap["ExternalTGWConnectionPath"] = "nsxt_policy_gateway_connection.test_gw_conn.path"
561561
buffer := new(bytes.Buffer)
562-
tmpl, err := template.New("testAaccNsxtPolicyProject").Parse(templateData)
562+
tmpl, err := template.New("testAccNsxtPolicyProjectTemplate900").Parse(templateData)
563563
if err != nil {
564564
panic(err)
565565
}

0 commit comments

Comments
 (0)