Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add TODO to the mockgcp TagKey resourceID #2093

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -115,6 +115,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`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is wrong, I think resourceID is "just the name".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(So we may not need the TODO)

// 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
Loading