Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Config Set: Test isolation / validation #2902

Closed
travisperson opened this issue Jul 2, 2018 · 3 comments
Closed

Config Set: Test isolation / validation #2902

travisperson opened this issue Jul 2, 2018 · 3 comments
Assignees
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature kind/resolved-in-helia

Comments

@travisperson
Copy link
Member

Currently .config.set should fail on non valid value is the only test that does not run in isolation (from js-ipfs-api under go-ipfs v0.4.15 🎉)

However, I don't believe it's really testing what we want it to be testing. It appears it's trying to produce an error by passing an invalid type, similar to the non valid key test above it.

https://github.com/ipfs/interface-ipfs-core/blob/ef910266b36c89fe21f9821f86bdb9955d60b468/js/src/config/set.js#L75-L87

The issue is that a Buffer does not raise this error, as typeof <Buffer> is object. It also passes JSON serialization. The only reason this test passed was because the daemon it self rejected the type due to being set by a prior test.

https://github.com/ipfs/interface-ipfs-core/blob/ef910266b36c89fe21f9821f86bdb9955d60b468/js/src/config/set.js#L32-L41

I don't believe this is what is expected to be under test though.

  • In here I think we need to update the assertions to expect something more specific.
  • js-ipfs-api probably needs to reject buffers.
@alanshaw
Copy link
Member

The only reason this test passed was because the daemon it self rejected the type due to being set by a prior test.

I'm not sure I understand - it was rejected because the value already existed for the key?

@travisperson
Copy link
Member Author

travisperson commented Jul 18, 2018

Not just because it existed, but due to the types mismatch. The config value Fruit was previously set as a string banana in the first test. When a value comes into that is not a string (jsonified buffer object), the go-ipfs daemon rejected the value because of type mismatch.

https://github.com/ipfs/go-ipfs/blob/07feeec9c4f40f59efb57d7e16739a35b4c42d5b/repo/fsrepo/fsrepo.go#L642

@achingbrain achingbrain transferred this issue from ipfs-inactive/interface-js-ipfs-core Mar 10, 2020
@achingbrain achingbrain added exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue labels Mar 10, 2020
@SgtPooki SgtPooki self-assigned this May 17, 2023
@SgtPooki
Copy link
Member

js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterwards (see #4336).

This issue is most likely resolved in Helia, please try it out!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature kind/resolved-in-helia
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants