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

feat: support --raw-leaves and --cid-base #1454

Merged
merged 1 commit into from
Jul 25, 2018
Merged

Conversation

achingbrain
Copy link
Member

Updates to the latest version of js-ipfs-mfs to properly support the --raw-leaves argument and allow formatting CIDs in base32 when doing ls and stat mfs operations.

@ghost ghost assigned achingbrain Jul 19, 2018
@ghost ghost added the status/in-progress In progress label Jul 19, 2018
achingbrain added a commit to ipfs-inactive/interface-js-ipfs-core that referenced this pull request Jul 19, 2018
Documents the new options added by ipfs/js-ipfs#1454 as well as the missing `long` option from `files.ls`
@achingbrain
Copy link
Member Author

Documented in ipfs-inactive/interface-js-ipfs-core#334

achingbrain added a commit to ipfs-inactive/interface-js-ipfs-core that referenced this pull request Jul 19, 2018
Documents the new options added by ipfs/js-ipfs#1454 as well as the missing `long` option from `files.ls`
@alanshaw alanshaw mentioned this pull request Jul 20, 2018
23 tasks
@alanshaw
Copy link
Member

@achingbrain I think these out of date tests are causing the failures:

js-ipfs/test/cli/files.js

Lines 208 to 258 in f4344b0

// Temporarily expect to fail as raw-leaves not yet implemented.
//
// When cid-version=1 then raw-leaves MUST be present and false.
//
// This is because raw-leaves is not yet implemented in js-ipfs,
// and go-ipfs changes the value of raw-leaves to true when
// cid-version > 0 unless explicitly set to false.
//
// This retains feature parity without having to implement raw-leaves.
it('add with cid-version=1', function () {
this.timeout(30 * 1000)
return new Promise((resolve, reject) => {
ipfs('add src/init-files/init-docs/readme --cid-version=1')
.then(() => reject(new Error('Raw leaves not expected to be implemented')))
.catch((err) => {
expect(err).to.exist()
resolve()
})
})
})
// TODO: this test is failing, @alanshaw?
it.skip('add with cid-version=1 and raw-leaves=false', () => {
return ipfs('add src/init-files/init-docs/readme --cid-version=1 --raw-leaves=false').then((out) => {
expect(out)
.to.eql('added zdj7WWeQ43G6JJvLWQWZpyHuAMq6uYWRjkBXFad11vE2LHhQ7 readme\n')
})
})
// Temporarily expect to fail as raw-leaves not yet implemented
//
// When cid-version=1 then raw-leaves MUST be present and false.
//
// This is because raw-leaves is not yet implemented in js-ipfs,
// and go-ipfs changes the value of raw-leaves to true when
// cid-version > 0 unless explicitly set to false.
//
// This retains feature parity without having to implement raw-leaves.
it('add with cid-version=1 and raw-leaves=true', function () {
this.timeout(30 * 1000)
return new Promise((resolve, reject) => {
ipfs('add src/init-files/init-docs/readme --cid-version=1 --raw-leaves=true')
.then(() => reject(new Error('Raw leaves not expected to be implemented')))
.catch((err) => {
expect(err).to.exist()
resolve()
})
})
})

@achingbrain
Copy link
Member Author

achingbrain commented Jul 23, 2018

CI is full of yarn/npm fail:

error Received malformed response from registry for undefined. The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Error: Received malformed response from registry for undefined. The registry may be down.
    at MessageError.ExtendableBuiltin (/tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:243:66)
    at new MessageError (/tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:272:123)
    at Function.<anonymous> (/tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:52175:15)
    at Generator.next (<anonymous>)
    at step (/tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:98:30)
    at /tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:116:14
    at new Promise (<anonymous>)
    at new F (/tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:23451:28)
    at Function.<anonymous> (/tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:95:12)
    at Function.findVersionInRegistryResponse (/tmp/jenkins/workspace/IPFS_js-ipfs_PR-1454-LVUG5VEDDMITOKZKGN2KSE7SOUUVN4UCYDGEUJ27TDHOH7PM53CQ/node_modules/yarn/lib/cli.js:52217:19)

script returned exit code 1

But you are right those tests should fail. For me locally they pass because an error is returned while executing the command, but the error is not the one expected and the tests don't assert anything past 'there should be an error' so they pass where they should fail.

I've updated them to expect success and not failure conditions.

@achingbrain achingbrain force-pushed the support-raw-leaves branch 3 times, most recently from a7d3d37 to cb9982d Compare July 24, 2018 12:05
Also updates pinning to support CIDv1
@parkan
Copy link
Contributor

parkan commented Jul 24, 2018

seeing green CI, can we get this merged and we'll improve coverage after the summit?

@alanshaw alanshaw merged commit 1f63e8c into master Jul 25, 2018
@ghost ghost removed the status/in-progress In progress label Jul 25, 2018
@alanshaw alanshaw deleted the support-raw-leaves branch July 25, 2018 15:50
alanshaw pushed a commit to ipfs-inactive/interface-js-ipfs-core that referenced this pull request Jul 28, 2018
Documents the new options added by ipfs/js-ipfs#1454 as well as the missing `long` option from `files.ls`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants