-
Notifications
You must be signed in to change notification settings - Fork 124
Get tests passing with pin core changes #63
Conversation
Hey @diasdavid , I wanted to revisit this since the datastore is available now. I see the timeout has been increased, do you have any comments on the other points I mentioned above? I assume this PR will need to be merged before any updates I make to the pinning code can be, since it won't pass the tests otherwise. |
src/pin.js
Outdated
expect(pinset).to.not.be.empty() | ||
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.
The recursive ls test is run after the recursive pin has been removed, but expects pinset not to be empty.
I believe you fixed this with this change
Could you double check this? From what
Yes yes yes :D All of that, we should make sure to catch all of the edge cases, pinning is one of the most sensitive things as it can result in data loss if it presents the wrong information to the user. |
@AdamStone I pulled and run your updated tests against js-ipfs-api and:
Could you check too? Do you know how to test this yourself? You can npm link interface-ipfs-core to js-ipfs-api and then run
|
Thanks, I didn't know that trick. I'm seeing the same errors. The js-ipfs tests were passing with these changes but I didn't try js-ipfs-api. I'll try to figure out what's going on. |
@diasdavid It looks like in addition to the file added in the |
@diasdavid I'm running into a problem if I try to make the tests more specific. Basically,
I implemented the pinning core methods to follow the It seems like to get everything passing, one of the following should happen:
There's a similar issue with the CLI tests, because the ON tests go through the http api and the OFF tests call the core methods directly. So in the handler functions, results may appear in both formats. Can you advise which direction to go with this, before I change anything further? |
I updated this PR as well as ipfs/js-ipfs#107 and ipfs-inactive/js-ipfs-http-client#602 to get the various API interfaces working together correctly while following the intended specs. I also made the tests more specific, looking for particular hashes instead of just checking whether results are empty or not. This avoids the problem where js-ipfs-api tests include additional pins due to the starter content besides those that are added during the test. Note that the indirect pin test is commented out because the test file has no links, so there are no indirect pins associated with it, but checking that it's empty breaks the js-ipfs-api due to the starter content including indirect pins. The test seems fairly meaningless in any case unless the test file being pinned includes a link. |
@diasdavid I ran into a few issues with the tests when trying to get the pin core interface updated to this spec:
add
test is checking for a hash string result where the API indicates it should be an object with a hash propertyls
test is run after the recursive pin has been removed, but expects pinset not to be empty.ls
test is also run after the recursive pin has been removed, but in any case the recursively pinned object has no links, so the indirect pinset is always empty.For now I just made small adjustments to get them passing, but I think the pinned object should have at least one link, if not a more complex tree, for a nontrivial test of indirect pins. I also wonder if scenarios like 'rejects direct pin if already recursively pinned' and 'rejects recursive pin if child object is not stored' shouldn't be tested, as well as persistence of the pinset through the datastore. Probably the particular datastore mechanism will change since currently it's not consistent with go-ipfs, but maybe we should at least test that it roundtrips? Most of the complexity in the pinning code is involved with this functionality.