Skip to content

Commit

Permalink
RHOAIENG-17634: chore(odh-nbc/tests): implement diff minimization for…
Browse files Browse the repository at this point in the history
… k8s objects diffs (#503)

* RHOAIENG-17634: chore(odh-nbc/tests): implement diff minimization for k8s objects diffs

This is a followup to the refactoring before.

The minimal diffs are computed by taking the `actual` value,
making a deep copy of it, applying the differences between
`actual` and `expected` to the deep copy, and calling the comparison function repeatedly.

* fixup a bug where I tried to set invalid values

* fixup robustness by adding a fallback cmp.Diff

* review suggestion, always print the full diff first, followed by minimized diff

this way we always have all the info when test fails, but it's still not difficult
to find the minimized diff for initial diagnostics, because it's the most obvious thing at the bottom

* review suggestion, fix typo in components/odh-notebook-controller/controllers/matchers_test.go

Co-authored-by: Andy Stoneberg <[email protected]>

---------

Co-authored-by: Andy Stoneberg <[email protected]>
  • Loading branch information
2 people authored and shalberd committed Feb 3, 2025
1 parent 6a6d103 commit 064640e
Showing 1 changed file with 358 additions and 13 deletions.
Loading

0 comments on commit 064640e

Please sign in to comment.