From f836ea50d5287a285dcae6f712c61ac234c1b977 Mon Sep 17 00:00:00 2001
From: achingbrain <alex@achingbrain.net>
Date: Wed, 18 Sep 2019 07:08:09 +0100
Subject: [PATCH 1/2] Upgrade to js-IPFS v0.38.x-rc

There's a new release of js-IPFS around the corner, one of the things it
does is turn on pubsub by default so needs a little code tweaking to work.

This PR contains the changes required to get orbit-db working with the
latest release candidate.
---
 package.json             | 3 ++-
 test/utils/config.js     | 9 ---------
 test/utils/start-ipfs.js | 2 +-
 test/utils/test-apis.js  | 5 ++++-
 4 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/package.json b/package.json
index 4856690..8803bb9 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,8 @@
     "datastore-level": "0.10.0",
     "fs-extra": "^7.0.1",
     "go-ipfs-dep": "aphelionz/npm-go-ipfs-dep",
-    "ipfs": "~0.36.4",
+    "ipfs": "0.38.0-rc.4",
+    "ipfs-http-client": "^37.0.1",
     "ipfs-repo": "~0.26.6",
     "ipfsd-ctl": "~0.42.3",
     "localstorage-level-migration": "next",
diff --git a/test/utils/config.js b/test/utils/config.js
index f3fabc9..a2e890a 100644
--- a/test/utils/config.js
+++ b/test/utils/config.js
@@ -3,9 +3,6 @@ module.exports = {
   dbname: 'orbit-db-tests',
   defaultIpfsConfig: {
     start: true,
-    EXPERIMENTAL: {
-      pubsub: true
-    },
     config: {
       Addresses: {
         API: '/ip4/127.0.0.1/tcp/0',
@@ -25,9 +22,6 @@ module.exports = {
     }
   },
   daemon1: {
-    EXPERIMENTAL: {
-      pubsub: true
-    },
     config: {
       Addresses: {
         API: '/ip4/127.0.0.1/tcp/0',
@@ -47,9 +41,6 @@ module.exports = {
     },
   },
   daemon2: {
-    EXPERIMENTAL: {
-      pubsub: true
-    },
     config: {
       Addresses: {
         API: '/ip4/127.0.0.1/tcp/0',
diff --git a/test/utils/start-ipfs.js b/test/utils/start-ipfs.js
index f0f21a6..3488b4b 100644
--- a/test/utils/start-ipfs.js
+++ b/test/utils/start-ipfs.js
@@ -15,7 +15,7 @@ const startIpfs = (type, config = {}) => {
     }
 
     // If we're starting a process, pass command line arguments to it
-    if (!config.args) {
+    if (!config.args && type.includes('go')) {
       config.args = ['--enable-pubsub-experiment']
     }
 
diff --git a/test/utils/test-apis.js b/test/utils/test-apis.js
index 0eafd8d..8ea47e8 100644
--- a/test/utils/test-apis.js
+++ b/test/utils/test-apis.js
@@ -1,4 +1,5 @@
 const IPFS = require('ipfs')
+const IPFSHTTPClient = require('ipfs-http-client')
 
 /**
  * IPFS daemons to run the tests with.
@@ -8,14 +9,16 @@ const IPFS = require('ipfs')
 // https://github.com/ipfs/js-ipfsd-ctl#ipfsfactory---const-f--ipfsfactorycreateoptions
 let jsIpfs = {
   'js-ipfs': {
-    type: 'proc', 
+    type: 'proc',
     exec: IPFS,
+    IpfsClient: IPFSHTTPClient,
   }
 }
 
 const goIpfs = {
   'go-ipfs': {
     type: 'go',
+    IpfsClient: IPFSHTTPClient,
   }
 }
 

From 52b1aa341c30453f3808a7642c54c83b1ba6e4ac Mon Sep 17 00:00:00 2001
From: achingbrain <alex@achingbrain.net>
Date: Mon, 30 Sep 2019 13:57:48 +0100
Subject: [PATCH 2/2] Do not pass ipfs-http-client to ipfsd-ctl as it is not
 necessary

---
 test/utils/test-apis.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/utils/test-apis.js b/test/utils/test-apis.js
index 8ea47e8..0c94447 100644
--- a/test/utils/test-apis.js
+++ b/test/utils/test-apis.js
@@ -11,7 +11,6 @@ let jsIpfs = {
   'js-ipfs': {
     type: 'proc',
     exec: IPFS,
-    IpfsClient: IPFSHTTPClient,
   }
 }