-
Notifications
You must be signed in to change notification settings - Fork 359
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
Reftest: add more exhaustive pin command test #6135
Conversation
tests/reftests/pin.test
Outdated
### : Test opam pin remove <pkg>.<version> | ||
### opam pin remove --no-action bar.dev | ||
Ok, bar is no longer pinned to file://${BASEDIR}/bar (version dev) | ||
### :XI:c: Test opam pin remove <pkg>.<version> |
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.
Should this test & remove --all
one be in its proper section above ?
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 think it's fine here
tests/reftests/pin.test
Outdated
### opam pin add --no-action bar.dev ./bar | ||
### opam pin remove --no-action nip2.dev | ||
[NOTE] nip2 is not pinned. | ||
### :XI:d: Test opam pin remove --all |
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 kept this test here, "as is": be the most similar to previous one with several kind of pins, etc. I don't know if it is intended or not?
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'm not sure to understand what you mean here
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.
Is it intended to have different kind of pins to remove ? or it was the case because the current switch had already several kind of pins?
tests/reftests/pin.test
Outdated
### opam pin add ./nip-empty2 | ||
Package nip-empty2 does not exist, create as a NEW package? [y/n] y | ||
nip-empty2 is now pinned to file://${BASEDIR}/nip-empty2 (version dev) | ||
|
||
The following actions will be performed: | ||
=== install 1 package | ||
- install nip-empty2 dev (pinned) | ||
|
||
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> | ||
-> retrieved nip-empty2.dev (file://${BASEDIR}/nip-empty2) | ||
-> installed nip-empty2.dev | ||
Done. |
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.
Is it a bug?
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.
the fact that linting is not done if the name of the package is not specified? yeah probably although it doesn't seem critical
### opam install ./nip-fo | ||
[NOTE] Ignoring uncommitted changes in ${BASEDIR}/nip-fo (`--working-dir' not specified or specified with no argument). | ||
[nip-fo.dev2] synchronised (git+file://${BASEDIR}/nip-fo#master) | ||
The following actions will be performed: | ||
=== recompile 1 package | ||
- recompile nip-fo dev2 (pinned) | ||
|
||
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> | ||
-> removed nip-fo.dev2 | ||
-> installed nip-fo.dev2 | ||
Done. | ||
### opam show nip-fo --field=version | ||
dev2 |
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.
Is it a bug?
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.
yes it is a known bug, i've seen it several times but i can't find the issue that i used to redirect people to when they got that issue
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.
#5567 (comment) maybe?
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.
LGTM aside from those two things and the first commit message
Done. | ||
### opam pin edit nip-path | ||
[WARNING] The opam file didn't pass validation: | ||
warning 59: url doesn't contain a checksum |
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.
This will be fixed with #6218
tests/reftests/pin.test
Outdated
### opam switch create removal --empty | ||
### opam pin ./nip --no-action | ||
nip is now pinned to file://${BASEDIR}/nip (version ved) | ||
### opam pin remove --no-action nip.dev |
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.
This command is duplicated with the nip.wrong-version test below
### opam pin remove --no-action nip.dev |
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.
In fact, it is
### opam pin remove --no-action nip.ved
The logic
- test with a good version of pinned packages
- test with a wrong version of pinned packages
- test with a not pinned package
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.
it's not. It was:
- remove good version of pkg1
- remove wrong version of pkg2
Thus we should simplify into:
- remove wrong version of pkg1
- remove good version of pkg1
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.
In the original test i agree it was : remove good version then remove wrong version. I've updated the test to add also removal of unpinned one.
"The logic" i was talking about is on the wanted final test (my modif), not the original.
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 don't think the extra test makes sense and i don't think we should add new tests here. The commit changing this part is here just to add separation not adding extra tests. It's already complicated to review changes in the reftests as it is.
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.
In the final form (not yet pushed, i'm still debugging cygwin), i've separated the addition of unpinned package test in first commit like that the second commit only contains the switch change.
tests/reftests/pin.test
Outdated
### opam pin remove --no-action nip.wrong-version | ||
[ERROR] nip is pinned but not to version wrong-version. Skipping. | ||
# Return code 2 # | ||
### opam pin remove --no-action nip2.dev |
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.
The version of nip is ved not dev. The test is different from originally intended
### opam pin remove --no-action nip2.dev | |
### opam pin remove --no-action nip.ved |
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.
cf above
tests/reftests/pin.test
Outdated
### opam pin ./nip --no-action | ||
[NOTE] Package nip is already pinned to file://${BASEDIR}/nip (version ved). | ||
nip is now pinned to file://${BASEDIR}/nip (version ved) |
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.
this is not needed since the pinned package hasn't been removed
### opam pin ./nip --no-action | |
[NOTE] Package nip is already pinned to file://${BASEDIR}/nip (version ved). | |
nip is now pinned to file://${BASEDIR}/nip (version ved) |
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.
cf above
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'm personally not a huge fan of editing the testsuite. I would've preferred to have a new file or to rename the old one if you prefer, but changing it is hard to review and can potentially break test-cases (the opam pin remove <pkg>.<version>
section was a good example). In my opinion our testsuite should be append-only whenever possible in the future.
In any case i won't block this. It looks fine as far as i could review.
Thanks!
Updated with the news test in their own file,like that the legacy remains untouched. I just updated the comments and added a test case for |
### # shell on Cygwin ads a trialing `\r` in the middle of the string | ||
### sh -c 'opam pin add $(opam pin scan ./lot_of_pkgs --normalise | grep path | sed "s/\\r//g") ' | unordered |
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.
What about:
### # shell on Cygwin ads a trialing `\r` in the middle of the string | |
### sh -c 'opam pin add $(opam pin scan ./lot_of_pkgs --normalise | grep path | sed "s/\\r//g") ' | unordered | |
### sh -c 'opam pin scan ./lot_of_pkgs --normalise | xargs opam pin add' |
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.
it doesn't work neither. If there is at least 2 packages, the \r
issue is present
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.
interesting
Thanks a lot! |
This is separated in 2 commits for readability/review:
I don't know if I added a test for each case (exhaustiveness).
Backported for 2.3 in #6229
Queued on #6219Unqueued it