Skip to content

Commit

Permalink
Add migration tests framework and migration package tests
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
  • Loading branch information
ulucinar committed Dec 13, 2022
1 parent 4b0a674 commit 81c9dbe
Show file tree
Hide file tree
Showing 20 changed files with 1,394 additions and 20 deletions.
6 changes: 3 additions & 3 deletions pkg/migration/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
// included in the `skipFieldPaths` and it must manually be handled in the
// conversion function.
func CopyInto(source any, target any, targetGVK schema.GroupVersionKind, skipFieldPaths ...string) (any, error) {
u := ToUnstructured(source)
u := ToSanitizedUnstructured(source)
paved := fieldpath.Pave(u.Object)
skipFieldPaths = append(skipFieldPaths, "apiVersion", "kind")
for _, p := range skipFieldPaths {
Expand Down Expand Up @@ -75,11 +75,11 @@ func sanitizeResource(m map[string]any) map[string]any {
return m
}

// ToUnstructured converts the specified managed resource to an
// ToSanitizedUnstructured converts the specified managed resource to an
// unstructured.Unstructured. Before the converted object is
// returned, it's sanitized by removing certain fields
// (like status, metadata.creationTimestamp).
func ToUnstructured(mg any) unstructured.Unstructured {
func ToSanitizedUnstructured(mg any) unstructured.Unstructured {
m, err := runtime.DefaultUnstructuredConverter.ToUnstructured(mg)
if err != nil {
panic(errors.Wrap(err, errToUnstructured))
Expand Down
Loading

0 comments on commit 81c9dbe

Please sign in to comment.