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

refactor: use aegir #155

Merged
merged 12 commits into from
Apr 22, 2016
Merged

refactor: use aegir #155

merged 12 commits into from
Apr 22, 2016

Conversation

dignifiedquire
Copy link
Member

Depends on a fresh release of js-ipfs-repo that includes ipfs/js-ipfs-repo#44

@jbenet jbenet added the status/in-progress In progress label Apr 20, 2016
@daviddias
Copy link
Member

This is weird (on circle-ci), mind checking it?

20 04 2016 11:32:11.438:WARN [preprocess]: Can not load "webpack", it is not registered!
  Perhaps you are missing some plugin?
20 04 2016 11:32:11.447:WARN [reporter]: Can not load "mocha-own", it is not registered!
  Perhaps you are missing some plugin?

@dignifiedquire
Copy link
Member Author

@diasdavid pretty sure that is circle ci cache again :(

But: https://circleci.com/gh/ipfs/js-ipfs/73 the node tests are failing (and I see that locally as well) but no idea why and pointers?

@daviddias
Copy link
Member

I suspect something changed on ipfs-repo that is making it looking for the wrong filename

@daviddias
Copy link
Member

Yeah, everything was working till this commit 509b4dd and only after the new js-ipfs-blocks was merged, the thing broke.

@daviddias
Copy link
Member

❤️

@dignifiedquire
Copy link
Member Author

dignifiedquire commented Apr 21, 2016

✅ Browser Tests
✅ Node Core Tests
✅ Node HTTP API Tests

Getting close finally just missing something on the cli tests:

  • when running them without the other tests all pass except the object tests
  • when running only the object tests they suddenly pass
  • when running them in conjunction with the other tests all online versions fail while the offline versions pass

ping @diasdavid to lend me his brain and eyes :)

@daviddias
Copy link
Member

daviddias commented Apr 22, 2016

On a fresh clone and fresh npm install

  • core tests Node.js
  • core tests on the Browser -> aegir exists, doesn't even fire karma
  • http-api tests (also added the npm script)
  • cli tests, fail with one of the errors being:
      Uncaught AssertionError: expected 'error\tENOENT: no such file or directory, open \'/tmp/ipfs-test-467147/config\'' to equal 'ipfs version 0.4.0-dev'
      + expected - actual

Which suggests that it is trying to use a different repo than what it should.

@daviddias
Copy link
Member

One more hint, note how the cli tests, the http-api tries to read from the http repo instead of the cli repo

  cli
    --all
      block
        api offline
          ✓ put (353ms)
          ✓ get (342ms)
          ✓ stat (342ms)
          ✓ rm (345ms)
        api running
Starting at /Users/ground-control/code/protocol-labs/_ipfs/js/js-ipfs/test/repo-tests-run-cli
Finished loading
Swarm listening on /ip4/0.0.0.0/tcp/57472
API is listening on: http://127.0.0.1:6001
Gateway (readonly) is listening on: http://127.0.0.1:57473
Debug: internal, implementation, error
    Error: Uncaught error: ENOENT: no such file or directory, open '/Users/ground-control/code/protocol-labs/_ipfs/js/js-ipfs/test/repo-tests-run-http/blocks/1220a948/1220a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447.data'
    at Error (native)
Debug: internal, implementation, error
    AssertionError: expected 'error\t[object Object]' to equal 'QmZjTnYw2TFhn9Nn7tjmPSoTBoY7YRkwPzwSrSbabY24Kp'
    at /Users/ground-control/code/protocol-labs/_ipfs/js/js-ipfs/test/cli-tests/test-block.js:90:17
    at ChildProcess.<anonymous> (/Users/ground-control/code/protocol-labs/_ipfs/js/js-ipfs/node_modules/nexpect/lib/nexpect.js:304:9)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

@@ -16,6 +18,10 @@ exports.start = (repo, callback) => {
repo = undefined
}

if (typeof repo === 'string') {
repo = new IPFSRepo(repo, {stores: fsbs})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the cli is spawning a httpAPI by feeding a string and not a repo object, we need to convert it to become a repo object so that IPFS core can consume it (if we only had a type system!)

@daviddias
Copy link
Member

Now it is only the bug that the repo that should be being used is the -cli, but when the daemon is running, it is insisting to use the -http and since that folder doesn't exist anymore (and it is the basePath), it fails to read or write

->  /Users/ground-control/code/protocol-labs/_ipfs/js/js-ipfs/test/repo-tests-run-cli
Starting at /Users/ground-control/code/protocol-labs/_ipfs/js/js-ipfs/test/repo-tests-run-cli
# should be using the repo above
Finished loading
Swarm listening on /ip4/0.0.0.0/tcp/57946
API is listening on: http://127.0.0.1:6001
Gateway (readonly) is listening on: http://127.0.0.1:57947
Debug: internal, implementation, error
    Error: Uncaught error: ENOENT: no such file or directory, open '/Users/ground-control/code/protocol-labs/_ipfs/js/js-ipfs/test/repo-tests-run-http/blocks/1220a948/1220a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447.data'
# is trying to get the -http
``

return nexpect.spawn(
'node',
[path.join(__dirname, '../../src/cli/bin.js')].concat(args),
{env}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not setting properly the IPFS_PATH for the spawned process (if you print it from https://github.com/ipfs/js-ipfs/blob/master/src/cli/utils.js#L46-L48) you will see it is undefined.

This is causing the cli process to fallback to default dir, finding that the API might be accessible through 8080, dialling to another API instead of the one generated for their tests.

@daviddias
Copy link
Member

Circle is not happy, but seems travis is. LGTM :)

@dignifiedquire
Copy link
Member Author

Circle is never happy

@daviddias daviddias merged commit 5aacf1c into master Apr 22, 2016
@daviddias daviddias deleted the aegir branch April 22, 2016 12:49
@jbenet jbenet removed the status/in-progress In progress label Apr 22, 2016
@dignifiedquire
Copy link
Member Author

🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉

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

Successfully merging this pull request may close these issues.

3 participants