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

(#223) display diff for nested arrays of objects #224

Open

Conversation

@masterzen
Copy link
Contributor

@masterzen masterzen commented May 14, 2020

Overview

This pull request fixes #223.

When using octocatalog-diff with puppet resources with deep nested datastructures such as nested arrays of objects, octocatalog-diff would not display diffs when array elements are modified, added or removed.

In fact, it turns out dig_out_key doesn't descend into arrays index that hashdiff can produce, like for instance:
testtype::test::parameters::testparam::another-one::an-array[0]::env

dig_out_key would stop at an-array because it doesn't know that's and array index it should try to descend into.

This patch adds the functionality for dig_out_key to follow array indices and descend into those nested structures.

Checklist

  • Make sure that all of the tests pass, and fix any that don't. Just run rake in your checkout directory, or review the CI job triggered whenever you push to a pull request.
  • Make sure that there is 100% test coverage by running rake coverage:spec or ignoring untestable sections of code with # :nocov comments. If you need help getting to 100% coverage please ask; however, don't just submit code with no tests.
  • If you have added a new command line option, we would greatly appreciate a corresponding integration test that exercises it from start to finish. This is optional but recommended.
  • If you have added any new gem dependencies, make sure those gems are licensed under the MIT or Apache 2.0 license. We cannot add any dependencies on gems licensed under GPL.
  • If you have added any new gem dependencies, make sure you've checked in a copy of the .gem file into the vendor/cache directory.

/cc #223

@masterzen masterzen force-pushed the masterzen:bugfix/223-display-diff-for-nested-arrays-of-objects branch from 6fa1e51 to 0f46be9 May 14, 2020
When using octocatalog-diff with puppet resources with deep
nested datastructures such as nested arrays of objects, octocatalog-
diff would not display diffs when array elements are modified,added or removed.

In fact, it turns out `dig_out_key` doesn't descend into arrays index
that hashdiff can produce, like for instance:
testtype::test::parameters::testparam::another-one::an-array[0]::env

`dig_out_key` would stop at `an-array` because it doesn't know that's
and array index it should try to descend into.

This patch adds the functionality for `dig_out_key` to follow array
index and descend into those nested structure.
@masterzen masterzen force-pushed the masterzen:bugfix/223-display-diff-for-nested-arrays-of-objects branch from 0f46be9 to e4c3660 May 14, 2020
@ahayworth ahayworth closed this Dec 15, 2020
@ahayworth ahayworth reopened this Dec 15, 2020
ahayworth added 3 commits Dec 15, 2020
…of-objects
…of-objects
…of-objects
Copy link
Contributor

@ahayworth ahayworth left a comment

Could you add a few more test cases? I'm thinking specifically of cases where the arrays are not just one element apart, but when they differ more significantly.

@masterzen
Copy link
Contributor Author

@masterzen masterzen commented Dec 16, 2020

@ahayworth , I'll do my best to add a few more tests.

…of-objects
@github github deleted a comment Dec 17, 2020
@github github deleted a comment Dec 17, 2020
@github github deleted a comment Dec 17, 2020
@github github deleted a comment Dec 17, 2020
@github github deleted a comment Dec 17, 2020
@github github deleted a comment Dec 17, 2020
@ahayworth ahayworth added this to the 2.0.0 milestone Dec 17, 2020
…of-objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.