This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(pubsub): topicCIDs should be topicIDs * fix(pubsub): msg.from field is base64 encoding of peer id * fix: oops * chore: update deps * write interop test setup for richard * fix: allow go daemon flags to be specified * test: pubsub interop with go (WIP) * chore: fix linting * fix more linting * fix interop tests
- Loading branch information
1 parent
cafa52b
commit 9de6f4c
Showing
5 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ require('./repo') | |
require('./exchange-files') | ||
require('./circuit-relay') | ||
require('./kad-dht') | ||
require('./pubsub') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
const series = require('async/series') | ||
const parallel = require('async/parallel') | ||
|
||
const GODaemon = require('../utils/interop-daemon-spawner/go') | ||
const JSDaemon = require('../utils/interop-daemon-spawner/js') | ||
|
||
describe('pubsub', () => { | ||
let jsD | ||
let goD | ||
let jsId | ||
let goId | ||
|
||
before(function (done) { | ||
this.timeout(50 * 1000) | ||
|
||
goD = new GODaemon({ | ||
disposable: true, | ||
init: true, | ||
flags: ['--enable-pubsub-experiment'] | ||
}) | ||
jsD = new JSDaemon() | ||
|
||
parallel([ | ||
(cb) => goD.start(cb), | ||
(cb) => jsD.start(cb) | ||
], (done)) | ||
}) | ||
|
||
after((done) => { | ||
series([ | ||
(cb) => goD.stop(cb), | ||
(cb) => jsD.stop(cb) | ||
], done) | ||
}) | ||
|
||
it('make connections', (done) => { | ||
parallel([ | ||
(cb) => jsD.api.id(cb), | ||
(cb) => goD.api.id(cb) | ||
], (err, ids) => { | ||
expect(err).to.not.exist() | ||
|
||
jsId = ids[0].ID | ||
goId = ids[0].ID | ||
|
||
console.log('jsId:', jsId) | ||
console.log('goId:', goId) | ||
|
||
parallel([ | ||
(cb) => jsD.api.swarm.connect(ids[1].addresses[0], cb), | ||
(cb) => goD.api.swarm.connect(ids[0].addresses[0], cb) | ||
], done) | ||
}) | ||
}) | ||
|
||
it.skip('publish from JS, subscribe on Go', (done) => { | ||
// TODO write this test | ||
}) | ||
|
||
it.skip('publish from Go, subscribe on JS', (done) => { | ||
const topic = 'pubsub-go-js' | ||
const data = Buffer.from('hello world') | ||
|
||
function checkMessage () { | ||
console.log('check message', arguments) | ||
} | ||
|
||
series([ | ||
cb => jsD.api.pubsub.subscribe(topic, checkMessage, cb), | ||
cb => goD.api.pubsub.publish(topic, data, cb) | ||
], done) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters