-
Notifications
You must be signed in to change notification settings - Fork 167
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
Find Importers: Add missing break
in relative paths logic
#785
Find Importers: Add missing break
in relative paths logic
#785
Conversation
Jsonnet is weird with relative paths Given two envs in their own folder. The two following imports in `env1/main.jsonnet will work`: `../env2/main.jsonnet` and `../../env2/main.jsonnet`, so we have to try all of them The logic does so in a loop. Without a `break`, the logic worked when the match was found on the first case (and correct one) but failed on the second
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to add a test case to validate this scenario?
Re-requesting review. I changed the logic and added a test. Jsonnet does match relative paths deeper than expected but it's only one level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have cherry-picked the test (without the changes to pkg/jsonnet/find_importers.go
) on top of main
, and the test PASSes, but it should fail, right?
Yeah, because there was another logic error 🤦. The But you're right, I think this requires a test that used to fail but now passes. I know how to do one. Let me do that now |
I added a test that does fail on the previous code, but now passes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure that I was not doing the partial cherry-picks locally to run the tests, I validated them with #786, which fails, as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks for the comments @jvrplmlmn! It helped find another bug and greatly improve the tests |
Jsonnet is weird with relative paths
Given two envs in their own folder. The two following imports in
env1/main.jsonnet will work
:../env2/main.jsonnet
and../../env2/main.jsonnet
, so we have to try all of themThe logic does so in a loop. Without a
break
, the logic worked when the match was found on the first case (and correct one) but failed on the second