Skip to content

Commit df7ad26

Browse files
akinrosslhercot
authored andcommitted
[ignore] fix tests for legacy attributes in resource_aci_access_port_block_test and resource_aci_access_port_selector_test
1 parent 6082ccf commit df7ad26

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

gen/generator.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,19 @@ var templateFuncs = template.FuncMap{
161161
"getLegacyAttributeVersion": GetLegacyAttributeVersion,
162162
"getLegacyAttributeVersionInTest": GetLegacyAttributeVersionInTest,
163163
"excludeClassFromTesting": ExcludeClassFromTesting,
164+
"getLegacyParentDn": GetLegacyParentDn,
165+
}
166+
167+
func GetLegacyParentDn(parentClassName string, testVars []interface{}) string {
168+
parentClassName = Decapitalize(parentClassName)
169+
for _, parent := range testVars {
170+
if className, ok := parent.(map[interface{}]interface{})["class_name"]; ok && className.(string) == parentClassName {
171+
if parentDn, ok := parent.(map[interface{}]interface{})["parent_dn"]; ok {
172+
return parentDn.(string)
173+
}
174+
}
175+
}
176+
return "Not Found"
164177
}
165178

166179
func GetChildClassNames(model Model, childClassNames []string) []string {

gen/templates/resource_test.go.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2378,7 +2378,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas
23782378
{{- if isInterfaceSlice $value}}{{$list_value := index $value 0}}
23792379
{{$key}} = {{if isReference $list_value}}{{$value}}{{else}}["{{$list_value}}"]{{end}}
23802380
{{- else}}
2381-
{{$key}} = {{if isReference $value}}{{$value}}{{else}}"{{$value}}"{{end}}
2381+
{{$key}} = {{getLegacyParentDn $parentClassName $.parents}}
23822382
{{- end}}
23832383
{{- else}}
23842384
{{- if isInterfaceSlice $value}}{{$list_value := index $value 0}}

internal/provider/resource_aci_access_port_block_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/provider/resource_aci_access_port_selector_test.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)