Skip to content

Commit

Permalink
Merge pull request #2093 from yuwenma/stricter-test-resourceID-special
Browse files Browse the repository at this point in the history
fix: add TODO to the mockgcp TagKey resourceID
  • Loading branch information
google-oss-prow[bot] authored Jun 21, 2024
2 parents ba54916 + 43f02b5 commit 71cb90c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ metadata:
spec:
description: For keyname resources.
parent: organizations/123450001
resourceID: "1718837800003546533"
resourceID: ${uniqueId}
shortName: keyname${uniqueId}
status:
conditions:
Expand All @@ -25,7 +25,7 @@ status:
status: "True"
type: Ready
createTime: "1970-01-01T00:00:00Z"
name: "1718837800003546533"
name: ${uniqueId}
namespacedName: 123450001/keyname${uniqueId}
observedGeneration: 2
updateTime: "1970-01-01T00:00:00Z"
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ metadata:
spec:
description: For keyname resources.
parent: projects/${projectId}
resourceID: "1718837823777494893"
resourceID: ${uniqueId}
shortName: keyname${uniqueId}
status:
conditions:
Expand All @@ -25,7 +25,7 @@ status:
status: "True"
type: Ready
createTime: "1970-01-01T00:00:00Z"
name: "1718837823777494893"
name: ${uniqueId}
namespacedName: ${projectId}/keyname${uniqueId}
observedGeneration: 2
updateTime: "1970-01-01T00:00:00Z"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
description: For valuename resources.
parentRef:
name: tagstagkey-${uniqueId}
resourceID: "1718837846427802079"
resourceID: ${uniqueId}
shortName: valuename
status:
conditions:
Expand All @@ -26,6 +26,6 @@ status:
status: "True"
type: Ready
createTime: "1970-01-01T00:00:00Z"
name: "1718837846427802079"
name: ${uniqueId}
observedGeneration: 2
updateTime: "1970-01-01T00:00:00Z"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
description: For valuename resources.
parentRef:
name: tagstagkey-${uniqueId}
resourceID: "1718837870725566645"
resourceID: ${uniqueId}
shortName: valuename
status:
conditions:
Expand All @@ -26,7 +26,7 @@ status:
status: "True"
type: Ready
createTime: "1970-01-01T00:00:00Z"
name: "1718837870725566645"
name: ${uniqueId}
namespacedName: ${projectId}/keyname${uniqueId}/valuename
observedGeneration: 2
updateTime: "1970-01-01T00:00:00Z"
10 changes: 10 additions & 0 deletions tests/e2e/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ func normalizeKRMObject(u *unstructured.Unstructured, project testgcp.GCPProject
name, _, _ = unstructured.NestedString(u.Object, "status", "name")
}
tokens := strings.Split(name, "/")
if len(tokens) == 1 {
switch u.GetKind() {
case "TagsTagKey", "TagsTagValue":
// TODO: The mock TagKey server returns the correct format `tagKeys/{number}`, but the golden object `status.name`
// only has {number}. Need to triage the tf/dcl controller.
visitor.stringTransforms = append(visitor.stringTransforms, func(path string, s string) string {
return strings.ReplaceAll(s, name, "${uniqueId}")
})
}
}
if len(tokens) > 2 {
typeName := tokens[len(tokens)-2]
id := tokens[len(tokens)-1]
Expand Down

0 comments on commit 71cb90c

Please sign in to comment.