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

Cannot run test:interop #2700

Closed
ggarri opened this issue Dec 31, 2019 · 6 comments
Closed

Cannot run test:interop #2700

ggarri opened this issue Dec 31, 2019 · 6 comments

Comments

@ggarri
Copy link
Contributor

ggarri commented Dec 31, 2019

  • Version:
    js-ipfs version: 0.40.0-
    Repo version: 7
    System version: x64/linux
    Node.js version: v11.15.0
  • Platform: Linux 4.15.0-72-generic jsipfs block http-api and cli #81-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: webui

Type: Bug

Severity: Low

Description:

Ipfs interop test cannot be executed due to a dependency mismatch multicodec. After a quick research I realized the package ipfs-bitswap:~0.26.2 is using an outdated version of multicodec:~0.5.7 which removed the file multicodec/src/name-table. There is an open PR to sort this issue.

Steps to reproduce the error:

  • Fetch master branch
  • npm install
  • Execute test:interop as follow:
  js-ipfs git:(master) npm run test:interop

> ipfs@0.40.0 test:interop /home/ggarrido/projects/js-ipfs
> IPFS_JS_EXEC=$PWD/src/cli/bin.js ipfs-interop


> ipfs-interop@0.1.1 test /home/ggarrido/projects/js-ipfs/node_modules/ipfs-interop
> cross-env IPFS_REUSEPORT=false aegir test

superagent: Enable experimental feature http2
Test Node.js
Warning: Cannot find any files matching pattern "test/**/*.spec.js"
superagent: Enable experimental feature http2
/home/ggarrido/projects/js-ipfs/node_modules/mocha/node_modules/yargs/yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'multicodec/src/name-table'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/home/ggarrido/projects/js-ipfs/node_modules/ipfs/node_modules/ipfs-bitswap/src/types/message/index.js:10:19)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)

How to sort it out

IMHO there are two alternatives:

  • Wait for js-ipfs-bitswap the latest PR to come through (8 days old today)
  • Downgrade multicodec to version 0.5.6 before required file was removed
@achingbrain
Copy link
Member

Interop tests are running ok in CI - is this still a problem for you?

@ggarri
Copy link
Contributor Author

ggarri commented Jan 14, 2020

I ferched the latest version of js-ipfs:master and removed and install the node_modules and now I am getting the following error, not sure what I do wrong:

npm run test:interop

> ipfs@0.40.0 test:interop /home/ggarrido/projects/js-ipfs
> IPFS_JS_EXEC=$PWD/src/cli/bin.js ipfs-interop


> ipfs-interop@0.2.1 test /home/ggarrido/projects/js-ipfs/node_modules/ipfs-interop
> cross-env IPFS_REUSEPORT=false aegir test

Test Node.js
Warning: Cannot find any files matching pattern "test/**/*.spec.js"
/home/ggarrido/projects/js-ipfs/node_modules/mocha/node_modules/yargs/yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'ipfs'

@alanshaw
Copy link
Member

alanshaw commented Feb 4, 2020

This should now be working. At least it's working for me now that master is (temporarily) depending on ipfs/interop#96.

Please shout if not true and we'll reopen!

@alanshaw alanshaw closed this as completed Feb 4, 2020
@ggarri
Copy link
Contributor Author

ggarri commented Feb 6, 2020

Hi @alanshaw , now I get same issue I reported at the beginning of the issue

➜  js-ipfs git:(master) npm run test:interop          

> ipfs@0.40.0 test:interop /home/ggarrido/projects/js-ipfs
> IPFS_JS_EXEC=$PWD/src/cli/bin.js ipfs-interop


> ipfs-interop@0.1.1 test /home/ggarrido/projects/js-ipfs/node_modules/ipfs-interop
> cross-env IPFS_REUSEPORT=false aegir test

superagent: Enable experimental feature http2
Test Node.js
Warning: Cannot find any files matching pattern "test/**/*.spec.js"
superagent: Enable experimental feature http2
/home/ggarrido/projects/js-ipfs/node_modules/mocha/node_modules/yargs/yargs.js:1163
      else throw err
           ^

Error: Cannot find module 'multicodec/src/name-table'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)

@ggarri
Copy link
Contributor Author

ggarri commented Feb 6, 2020

As far as I can see you need first to upgrade the version of dep ipfs-bitswap to v0.27.0 fix already fixed the issue above

https://github.com/ipfs/js-ipfs-bitswap/blob/v0.27.0/src/types/message/index.js

Thee issue still persist after the upgrade due to the package ipfs-interop has a circular dependency to ipfs, and that is deriving the in the usage of an old version of it. On top of that master branch is using a very old version of ipfs-interop which I think it should be upgrade too.

I tried removing the local ipfs-bitswap dependency of ipfs@v0.38.0 required by ipfs-interop and the test runs correctly:

$> rm -rf ~/projects/js-ipfs/node_modules/ipfs/node_modules/ipfs-bitswap

Therefore IMO the way to proceed to fix this issue would be:

  1. Upgrade the dependency ipfs-bitswap to v0.27.0 and release a new ipfs version
  2. Then upgrade ipfs-interop project using latest version ipfs@v0.40.1 and create a new version of ipfs-interop@0.2.2
  3. Update local ipfs project dependency to ipfs-interop@0.2.2

@alanshaw
Copy link
Member

alanshaw commented Feb 7, 2020

@ggarri please pull master, remove your node_modules and package-lock.json and reinstall. ipfs-bitswap is already v0.27 - https://github.com/ipfs/js-ipfs/blob/master/package.json#L98

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants