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

Commit

Permalink
chore: use same hashes as go
Browse files Browse the repository at this point in the history
ipfs-inactive/js-ipfs-unixfs-engine#214 changes the algorithm used when adding files to be more
consistent with the go implementation. This means some generated hashes will change.

This PR updates those hashes in our test suite.
  • Loading branch information
achingbrain committed May 30, 2018
1 parent 2e40fb8 commit f7ef615
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 37 deletions.
8 changes: 4 additions & 4 deletions test/cli/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
const expect = require('chai').expect
const runOnAndOff = require('../utils/on-and-off')
const file = 'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV'
const dir = 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2'
const dir = 'Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z'

describe('file ls', () => runOnAndOff((thing) => {
let ipfs

before(function () {
this.timeout(50 * 1000)
ipfs = thing.ipfs
return ipfs('files add -r test/fixtures/test-data/recursive-get-dir')
return ipfs('add -r test/fixtures/test-data/recursive-get-dir')
})

it('prints a filename', () => {
Expand All @@ -27,9 +27,9 @@ describe('file ls', () => runOnAndOff((thing) => {
return ipfs(`file ls ${dir}`)
.then((out) => expect(out).to.eql(
`This functionality is deprecated, and will be removed in future versions. If possible, please use 'ipfs ls' instead.\n` +
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9\n' +
'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT\n' +
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN\n' +
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz\n' +
'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv\n' +
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU\n' +
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV\n'
))
Expand Down
46 changes: 23 additions & 23 deletions test/cli/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ describe('files', () => runOnAndOff((thing) => {
'added QmeiTxVN4xAjxUzHzBqCpK3GaT3GeiLQeJRpYDXDfLeEmR recursive-get-dir/datastore/MANIFEST-000014',
'added QmQpc75sJGUv59dAwHF7vazBGV9o6C7z587Dp9nv7HYAps recursive-get-dir/datastore/LOG.old',
'added QmbFNLNr9at9eK5LrNyUdyE5cdLb5yaT9DkjXw7BK68kcM recursive-get-dir/datastore/LOG',
'added QmfJMCvenrj4SKKRc48DYPxwVdS44qCUCqqtbqhJuSTWXP recursive-get-dir/datastore/LOCK',
'added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH recursive-get-dir/datastore/LOCK',
'added QmVJi93Yj5RW3NuqqxonGz3jAXUYHrdQvWrURxg1TiLEuX recursive-get-dir/datastore/CURRENT',
'added QmcJ6TXPMPm6puSC9vpxuG57PyfGpr8bvTgkKU9SHHU5Uo recursive-get-dir/datastore/000010.ldb',
'added QmPFVLPmp9zv5Z5KUqLhe2EivAGccQW2r7M7jhVJGLZoZU recursive-get-dir/datastore/000005.ldb',
'added QmfExFwdFKspsY2q5WnhQjd1QDKnjpTQ4UkiHqqQxV7h67 recursive-get-dir/datastore/000002.ldb',
'added Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz recursive-get-dir/datastore',
'added QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv recursive-get-dir/datastore',
'added QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN recursive-get-dir/config',
'added QmbJgQa4XNBFvGQcLbWBNtvWZetbCUKiyAQNfePoTzwf9L recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data',
'added QmSCUPYy4CfFt9nA61J9v2DMfJygQAJjaUcRmygDbVME2D recursive-get-dir/blocks/CIQPD',
Expand All @@ -61,8 +61,8 @@ describe('files', () => runOnAndOff((thing) => {
'added Qmec4atiyfysPR8HU5gPfjKY1NpQDY2kmSeeadx8wLEBqY recursive-get-dir/blocks/CIQOM',
'added QmeBypQ2yE4t4Loybhby15DjkeLDXJKCcgMfxTXeFnHa8F recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data',
'added Qmd6s8LXAEjW7y9QbGSzeuewrRBYjJHmcazG3Hk7cJ74da recursive-get-dir/blocks/CIQOL',
'added QmfJMCvenrj4SKKRc48DYPxwVdS44qCUCqqtbqhJuSTWXP recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data',
'added QmdiJnDhn4Bb1odByw1BA5qpXssjxgttVz42tpEfo7HNUe recursive-get-dir/blocks/CIQOH',
'added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data',
'added QmTnaav9VTSVyLu8PvRzh4gJ8heF9rpdWzeDb7rMx5DkxV recursive-get-dir/blocks/CIQOH',
'added Qmc1nasezDdPyZiXB5VB6Aygzswcr6QkauzzXMeUGouHTN recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data',
'added QmeqJBkwmzsVR79HBKLW7AYhfAMxMaJs5dGHSgey5ezy7N recursive-get-dir/blocks/CIQMB',
'added QmaSjzSSRanYzRGPXQY6m5SWfSkkfcnzNkurJEQc4chPJx recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data',
Expand Down Expand Up @@ -113,8 +113,8 @@ describe('files', () => runOnAndOff((thing) => {
'added QmSCq2peGvGDXZKuX565UczxRpgzsiPPF3PgcJq9zDbByL recursive-get-dir/blocks/CIQDD',
'added QmdgaiKe1HFfhrZvLwTFCrXmgTojhSWuBvyFXUVc8KzJVc recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data',
'added QmYwUkwNwJN2cevwXKL48DRpbbjbdLWyyLANG3BKTtsTZ8 recursive-get-dir/blocks/CIQBE',
'added QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 recursive-get-dir/blocks',
'added QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2 recursive-get-dir'
'added QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT recursive-get-dir/blocks',
'added Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z recursive-get-dir'
]

before(() => {
Expand All @@ -124,7 +124,7 @@ describe('files', () => runOnAndOff((thing) => {
it('add with progress', function () {
this.timeout(30 * 1000)

return ipfs('files add -p src/init-files/init-docs/readme')
return ipfs('add -p src/init-files/init-docs/readme')
.then((out) => {
expect(out)
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme\n')
Expand All @@ -134,7 +134,7 @@ describe('files', () => runOnAndOff((thing) => {
it('add', function () {
this.timeout(30 * 1000)

return ipfs('files add src/init-files/init-docs/readme')
return ipfs('add src/init-files/init-docs/readme')
.then((out) => {
expect(out)
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme\n')
Expand All @@ -154,7 +154,7 @@ describe('files', () => runOnAndOff((thing) => {
it('add recursively test', function () {
this.timeout(60 * 1000)

return ipfs('files add -r test/fixtures/test-data/recursive-get-dir')
return ipfs('add -r test/fixtures/test-data/recursive-get-dir')
.then((out) => {
expect(out).to.eql(recursiveGetDirResults.join('\n') + '\n')
})
Expand All @@ -163,7 +163,7 @@ describe('files', () => runOnAndOff((thing) => {
it('add directory with trailing slash test', function () {
this.timeout(30 * 1000)

return ipfs('files add -r test/fixtures/test-data/recursive-get-dir/')
return ipfs('add -r test/fixtures/test-data/recursive-get-dir/')
.then((out) => {
expect(out).to.eql(recursiveGetDirResults.join('\n') + '\n')
})
Expand All @@ -177,7 +177,7 @@ describe('files', () => runOnAndOff((thing) => {
'added QmXJGoo27bg7ExNAtr9vRcivxDwcfHtkxatGno9HrUdR16 odd-name-[v0]'
]

return ipfs('files add -r test/fixtures/odd-name-[v0]')
return ipfs('add -r test/fixtures/odd-name-[v0]')
.then((out) => {
expect(out).to.eql(expected.join('\n') + '\n')
})
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('files', () => runOnAndOff((thing) => {
it('add --quiet', function () {
this.timeout(30 * 1000)

return ipfs('files add -q src/init-files/init-docs/readme')
return ipfs('add -q src/init-files/init-docs/readme')
.then((out) => {
expect(out)
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB\n')
Expand All @@ -268,7 +268,7 @@ describe('files', () => runOnAndOff((thing) => {
it('add --quieter', function () {
this.timeout(30 * 1000)

return ipfs('files add -Q -w test/fixtures/test-data/hello test/test-data/node.json')
return ipfs('add -Q -w test/fixtures/test-data/hello test/test-data/node.json')
.then((out) => {
expect(out)
.to.eql('QmYRMUVULBfj7WrdPESnwnyZmtayN6Sdrwh1nKcQ9QgQeZ\n')
Expand All @@ -278,15 +278,15 @@ describe('files', () => runOnAndOff((thing) => {
it('add --silent', function () {
this.timeout(30 * 1000)

return ipfs('files add --silent src/init-files/init-docs/readme')
return ipfs('add --silent src/init-files/init-docs/readme')
.then((out) => {
expect(out)
.to.eql('')
})
})

it('add --only-hash outputs correct hash', function () {
return ipfs('files add --only-hash src/init-files/init-docs/readme')
return ipfs('add --only-hash src/init-files/init-docs/readme')
.then(out =>
expect(out)
.to.eql('added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB readme\n')
Expand Down Expand Up @@ -330,7 +330,7 @@ describe('files', () => runOnAndOff((thing) => {
it('cat', function () {
this.timeout(30 * 1000)

return ipfs('files cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
return ipfs('cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
.then((out) => {
expect(out).to.eql(readme)
})
Expand All @@ -348,7 +348,7 @@ describe('files', () => runOnAndOff((thing) => {
it('cat part of a file using `count`', function () {
this.timeout(30 * 1000)

return ipfs('files cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --count 5')
return ipfs('cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --count 5')
.then((out) => {
expect(out).to.eql(readme.substring(21, 26))
})
Expand All @@ -357,7 +357,7 @@ describe('files', () => runOnAndOff((thing) => {
it('cat part of a file using `length`', function () {
this.timeout(30 * 1000)

return ipfs('files cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --length 5')
return ipfs('cat QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB --offset 21 --length 5')
.then((out) => {
expect(out).to.eql(readme.substring(21, 26))
})
Expand All @@ -374,7 +374,7 @@ describe('files', () => runOnAndOff((thing) => {
it('get', function () {
this.timeout(20 * 1000)

return ipfs('files get QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
return ipfs('get QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB')
.then((out) => {
expect(out)
.to.eql('Saving file(s) QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB\n')
Expand Down Expand Up @@ -406,16 +406,16 @@ describe('files', () => runOnAndOff((thing) => {
it('get recursively', function () {
this.timeout(20 * 1000)

const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
const outDir = path.join(process.cwd(), 'Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
rimraf(outDir)

return ipfs('files get QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
return ipfs('get Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
.then((out) => {
expect(out).to.eql(
'Saving file(s) QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2\n'
'Saving file(s) Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z\n'
)

const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
const outDir = path.join(process.cwd(), 'Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
const expectedDir = path.join(process.cwd(), 'test', 'fixtures', 'test-data', 'recursive-get-dir')

const compareResult = compareDir(outDir, expectedDir, {
Expand Down
2 changes: 1 addition & 1 deletion test/cli/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('init', function () {

// Test that the following was written when init-ing the repo
// jsipfs files cat /ipfs/QmfGBRT6BbWJd7yUc2uYdaUZJBbnEFvTqehPFoSMQ6wgdr/readme
let command = out.substring(out.indexOf('files cat'), out.length - 2 /* omit the newline char */)
let command = out.substring(out.indexOf('cat'), out.length - 2 /* omit the newline char */)
return ipfs(command)
}).then((out) => expect(out).to.equal(readme))
})
Expand Down
18 changes: 9 additions & 9 deletions test/cli/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ describe('ls', () => runOnAndOff((thing) => {

before(() => {
ipfs = thing.ipfs
return ipfs('files add -r test/fixtures/test-data/recursive-get-dir')
return ipfs('add -r test/fixtures/test-data/recursive-get-dir')
})

it('prints added files', function () {
this.timeout(20 * 1000)
return ipfs('ls QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2')
return ipfs('ls Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z')
.then((out) => {
expect(out).to.eql(
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 123530 blocks/\n' +
'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT 123530 blocks/\n' +
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN 3939 config\n' +
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz 5503 datastore/\n' +
'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv 5503 datastore/\n' +
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU 7397 init-docs/\n' +
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV 10 version\n'
)
Expand All @@ -38,13 +38,13 @@ describe('ls', () => runOnAndOff((thing) => {

it('adds a header, -v', function () {
this.timeout(20 * 1000)
return ipfs('ls /ipfs/QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2 -v')
return ipfs('ls /ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z -v')
.then((out) => {
expect(out).to.eql(
'Hash Size Name\n' +
'QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 123530 blocks/\n' +
'QmamKEPmEH9RUsqRQsfNf5evZQDQPYL9KXg1ADeT7mkHkT 123530 blocks/\n' +
'QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN 3939 config\n' +
'Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz 5503 datastore/\n' +
'QmUqyZtPmsRy1U5Mo8kz2BAMmk1hfJ7yW1KAFTMB2odsFv 5503 datastore/\n' +
'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU 7397 init-docs/\n' +
'QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV 10 version\n'
)
Expand All @@ -54,7 +54,7 @@ describe('ls', () => runOnAndOff((thing) => {
it('follows a path, <hash>/<subdir>', function () {
this.timeout(20 * 1000)

return ipfs('ls /ipfs/QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2/init-docs')
return ipfs('ls /ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs')
.then((out) => {
expect(out).to.eql(
'QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V 1688 about\n' +
Expand All @@ -73,7 +73,7 @@ describe('ls', () => runOnAndOff((thing) => {
this.slow(2000)
this.timeout(20 * 1000)

return ipfs('ls -r /ipfs/QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2/init-docs')
return ipfs('ls -r /ipfs/Qmaj2NmcyAXT8dFmZRRytE12wpcaHADzbChKToMEjBsj5Z/init-docs')
.then(out => {
expect(out).to.eql(
'QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V 1688 about\n' +
Expand Down

0 comments on commit f7ef615

Please sign in to comment.