-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: restrict custom normalizations to BigQueryDataTransferConfig
- Loading branch information
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,10 +175,12 @@ func normalizeKRMObject(t *testing.T, u *unstructured.Unstructured, project test | |
visitor.replacePaths[".status.observedState.cloudResource.serviceAccountID"] = "bqcx-${projectNumber}[email protected]" | ||
|
||
// Specific to BigQueryDataTransferConfig | ||
visitor.replacePaths[".status.observedState.nextRunTime"] = "1970-01-01T00:00:00Z" | ||
visitor.replacePaths[".status.observedState.ownerInfo.email"] = "[email protected]" | ||
visitor.replacePaths[".status.observedState.userID"] = "0000000000000000000" | ||
visitor.removePaths.Insert(".status.observedState.state") // data transfer run state, which depends on timing | ||
if u.GetKind() == "BigQueryDataTransferConfig" { | ||
visitor.replacePaths[".status.observedState.nextRunTime"] = "1970-01-01T00:00:00Z" | ||
visitor.replacePaths[".status.observedState.ownerInfo.email"] = "[email protected]" | ||
visitor.replacePaths[".status.observedState.userID"] = "0000000000000000000" | ||
visitor.removePaths.Insert(".status.observedState.state") // data transfer run state, which depends on timing | ||
} | ||
|
||
// TODO: This should not be needed, we want to avoid churning the kube objects | ||
visitor.sortSlices.Insert(".spec.access") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -768,7 +768,12 @@ func runScenario(ctx context.Context, t *testing.T, testPause bool, fixture reso | |
addReplacement("nextRunTime", "2024-04-01T12:34:56.123456Z") | ||
addReplacement("ownerInfo.email", "[email protected]") | ||
addReplacement("userId", "0000000000000000000") | ||
jsonMutators = append(jsonMutators, func(obj map[string]any) { // special handling because the field includes dot | ||
jsonMutators = append(jsonMutators, func(obj map[string]any) { | ||
if _, found, err := unstructured.NestedString(obj, "destinationDatasetId"); err != nil || !found { | ||
// This is a hack to only run this mutator for BigQueryDataTransferConfig objects. | ||
return | ||
} | ||
// special handling because the field includes dot | ||
if _, found, _ := unstructured.NestedString(obj, "params", "connector.authentication.oauth.clientId"); found { | ||
if err := unstructured.SetNestedField(obj, "client-id", "params", "connector.authentication.oauth.clientId"); err != nil { | ||
t.Fatal(err) | ||
|