Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs-inactive/interface-js-ipfs-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.66.4
Choose a base ref
...
head repository: ipfs-inactive/interface-js-ipfs-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.67.0
Choose a head ref
  • 6 commits
  • 4 files changed
  • 3 contributors

Commits on Jun 1, 2018

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2cfe22d View commit details
  2. Merge pull request #289 from ipfs/fix-files-stat-toc-link

    docs: fix toc link for files.stat
    alanshaw authored Jun 1, 2018
    Copy the full SHA
    60c30fc View commit details

Commits on Jun 4, 2018

  1. test: augment dht tests (first pass) (#288)

    * test: augment dht tests, disable the ones that are wonky for go just for go
    
    * test: skip findprovs test in go until the issue has been fixed
    
    * test: remove .only
    daviddias authored Jun 4, 2018
    Copy the full SHA
    d5c28ae View commit details
  2. chore: update deps

    daviddias committed Jun 4, 2018
    Copy the full SHA
    ef3a86d View commit details
  3. chore: update contributors

    daviddias committed Jun 4, 2018
    Copy the full SHA
    c737f3e View commit details
  4. Copy the full SHA
    ad70c2c View commit details
Showing with 55 additions and 42 deletions.
  1. +5 −0 CHANGELOG.md
  2. +1 −1 SPEC/FILES.md
  3. +42 −34 js/src/dht.js
  4. +7 −7 package.json
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<a name="0.67.0"></a>
# [0.67.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.66.4...v0.67.0) (2018-06-04)



<a name="0.66.4"></a>
## [0.66.4](https://github.com/ipfs/interface-ipfs-core/compare/v0.66.3...v0.66.4) (2018-05-30)

2 changes: 1 addition & 1 deletion SPEC/FILES.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
* [lsPullStream](#lspullstream)
* [files.cp](#filescp)
* [files.mkdir](#filesmkdir)
* [files.stat](#filesmkdir)
* [files.stat](#filesstat)
* [files.rm](#filesrm)
* [files.read](#filesread)
* [files.readReadableStream](#filesreadreadablestream)
76 changes: 42 additions & 34 deletions js/src/dht.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ module.exports = (common) => {
describe('.dht', function () {
this.timeout(80 * 1000)

let withGo
let nodeA
let nodeB
let nodeC
@@ -47,7 +48,12 @@ module.exports = (common) => {
(cb) => nodeE.swarm.connect(nodeB.peerId.addresses[0], cb),
(cb) => nodeD.swarm.connect(nodeC.peerId.addresses[0], cb),
(cb) => nodeE.swarm.connect(nodeC.peerId.addresses[0], cb),
(cb) => nodeD.swarm.connect(nodeE.peerId.addresses[0], cb)
(cb) => nodeD.swarm.connect(nodeE.peerId.addresses[0], cb),
(cb) => nodeA.id((err, id) => {
expect(err).to.not.exist()
withGo = id.agentVersion.startsWith('go-ipfs')
cb()
})
], done)
})
})
@@ -63,14 +69,21 @@ module.exports = (common) => {
})
})

// TODO: fix - go-ipfs errors with Error: key was not found (type 6)
// https://github.com/ipfs/go-ipfs/issues/3862
it.skip('fetches value after it was put on another node', (done) => {
it('fetches value after it was put on another node', function (done) {
this.timeout(80 * 1000)

if (withGo) {
// go-ipfs errors with Error: key was not found (type 6)
// https://github.com/ipfs/go-ipfs/issues/3862
this.skip()
}

// TODO - this test needs to keep tryingl instead of the setTimeout
waterfall([
(cb) => nodeB.object.new('unixfs-dir', cb),
(node, cb) => setTimeout(() => cb(null, node), 1000),
(node, cb) => {
const multihash = node.toJSON().multihash
(dagNode, cb) => setTimeout(() => cb(null, dagNode), 20000),
(dagNode, cb) => {
const multihash = dagNode.toJSON().multihash

nodeA.dht.get(multihash, cb)
},
@@ -80,14 +93,6 @@ module.exports = (common) => {
}
], done)
})

it('Promises support', (done) => {
nodeA.dht.get('non-existing', { timeout: '100ms' })
.catch((err) => {
expect(err).to.exist()
done()
})
})
})

describe('.findpeer', () => {
@@ -100,9 +105,13 @@ module.exports = (common) => {
})
})

// TODO checking what is exactly go-ipfs returning
// https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090
it.skip('fails to find other peer, if peer doesnt exist()s', (done) => {
it('fails to find other peer, if peer does not exist', function (done) {
if (withGo) {
// TODO checking what is exactly go-ipfs returning
// https://github.com/ipfs/go-ipfs/issues/3862#issuecomment-294168090
this.skip()
}

nodeA.dht.findpeer('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ', (err, peer) => {
expect(err).to.not.exist()
expect(peer).to.be.equal(null)
@@ -177,37 +186,36 @@ module.exports = (common) => {
it.skip('recursive', () => {})
})

describe.skip('findprovs', () => {
it('basic', (done) => {
const cid = new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxxx')
describe('findprovs', () => {
it('provide from one node and find it through another node', function (done) {
if (withGo) {
// TODO go-ipfs endpoint doesn't conform with the others
// https://github.com/ipfs/go-ipfs/issues/5047
this.skip()
}

waterfall([
(cb) => nodeB.dht.provide(cid, cb),
(cb) => nodeC.dht.findprovs(cid, cb),
(cb) => nodeE.object.new('unixfs-dir', cb),
(dagNode, cb) => {
const cidV0 = new CID(dagNode.toJSON().multihash)
nodeE.dht.provide(cidV0, (err) => cb(err, cidV0))
},
(cidV0, cb) => nodeC.dht.findprovs(cidV0, cb),
(provs, cb) => {
expect(provs.map((p) => p.toB58String()))
.to.eql([nodeB.peerId.id])
.to.eql([nodeE.peerId.id])
cb()
}
], done)
})

it('Promises support', (done) => {
nodeB.dht.findprovs('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
.then((res) => {
expect(res).to.be.an('array')
done()
})
.catch((err) => done(err))
})
})

describe('.query', () => {
it('returns the other node in the query', function (done) {
const timeout = 150 * 1000
this.timeout(timeout)

// This test is flaky. DHT works best with >= 20 nodes. Therefore a
// This test is meh. DHT works best with >= 20 nodes. Therefore a
// failure might happen, but we don't want to report it as such.
// Hence skip the test before the timeout is reached
const timeoutId = setTimeout(function () {
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interface-ipfs-core",
"version": "0.66.4",
"version": "0.67.0",
"description": "A test suite and interface you can use to implement a IPFS core interface.",
"leadMaintainer": "Alan Shaw <alan@tableflip.io>",
"main": "js/src/index.js",
@@ -30,10 +30,10 @@
},
"homepage": "https://github.com/ipfs/interface-ipfs-core#readme",
"dependencies": {
"aegir": "^13.1.0",
"async": "^2.6.0",
"big.js": "^5.0.3",
"bl": "^1.2.2",
"aegir": "^14.0.0",
"async": "^2.6.1",
"big.js": "^5.1.2",
"bl": "^2.0.0",
"bs58": "^4.0.1",
"chai": "^4.1.2",
"cids": "~0.5.3",
@@ -49,10 +49,10 @@
"multiaddr": "^5.0.0",
"multibase": "~0.4.0",
"multihashes": "~0.4.13",
"multihashing-async": "~0.4.8",
"multihashing-async": "~0.5.1",
"peer-id": "~0.10.7",
"peer-info": "~0.14.1",
"pull-stream": "^3.6.7",
"pull-stream": "^3.6.8",
"pump": "^3.0.0"
},
"devDependencies": {},