GithubHelp home page GithubHelp logo

mcamou / js-ipfs-preload-tester Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alanshaw/js-ipfs-preload-tester

0.0 1.0 0.0 1.02 MB

Sanity check a preload server is working as expected.

License: MIT License

JavaScript 100.00%

js-ipfs-preload-tester's Introduction

js-ipfs-preload-tester

Sanity check a preload server is working as expected.

This tester starts two IPFS nodes connected to the same preload node. One node is running in the browser and one node is running in Node.js. This ensures they cannot discover each other or connect to each other locally. The browser node adds some data and the Node.js node retrieves the data. Since these nodes are not connected the data MUST come via the preload node.

Install

Clone this repo, install dependences and run the test:

git clone https://github.com/alanshaw/js-ipfs-preload-tester.git
cd js-ipfs-preload-tester
npm install
npm start

Usage

Sanity check a preload server is working as expected.

Usage: ipfs-preload-tester [options...]

Options:
  -d, --data            Data to use in the test
  -a, --api-addr        Multiaddr of preloader HTTP API
  -b, --bootstrap-addr  Multiaddr of preloader node, including peer ID
  -v, --version         Print version number and exit.
  -h, --help            Print this message and exit.
  -u, --usage           Print this message and exit.

The optional CLI args --api-addr and --bootstrap-addr allow you to specify the preload node to connect to.

Expect to see output like this for a successful run:

$ npm start -- --api-addr=/dns4/node1.preload.ipfs.io/https --bootstrap-addr=/dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6

> [email protected] start /Users/alan/Code/pl/ipfs/js-ipfs-preload-tester
> node bin "--api-addr=/dns4/node1.preload.ipfs.io/https" "--bootstrap-addr=/dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6"

๐ŸŒŽ Using preloader API Address: /dns4/node1.preload.ipfs.io/https
๐Ÿฅพ Using preloader Bootstrap Address: /dns4/node1.preload.ipfs.io/tcp/443/wss/p2p/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6
๐Ÿ’พ Data that will be used in the test: "Test content created on Wed Jan 29 2020 12:33:50 GMT+0000 (Greenwich Mean Time)"
๐Ÿƒโ€โ™€๏ธ Running the test...
Swarm listening on /ip4/127.0.0.1/tcp/4002
Swarm listening on /ip4/192.168.1.209/tcp/4002
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws
Test execution time: 2.268s
๐Ÿฅณ This preloader is working as expected

Note, you can use the DEBUG environment variable to get more logging:

$ DEBUG=ipfs-preload-test* npm start

> [email protected] start /Users/alan/Code/pl/ipfs/js-ipfs-preload-tester
> node bin

๐ŸŒŽ Using preloader API Address: /dns4/node0.preload.ipfs.io/https
(Use --api-addr arg to change)
๐Ÿฅพ Using preloader Bootstrap Address: /dns4/node0.preload.ipfs.io/tcp/443/wss/p2p/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic
(Use --bootstrap-addr arg to change)
๐Ÿ’พ Data that will be used in the test: "Test content created on Wed Jan 29 2020 12:38:10 GMT+0000 (Greenwich Mean Time)"
๐Ÿƒโ€โ™€๏ธ Running the test...
  ipfs-preload-tester:runner Creating server for browser... +0ms
  ipfs-preload-tester:runner Listening on http://localhost:55235 +2ms
  ipfs-preload-tester:runner:browser Invalid asm.js: Unexpected token +0ms
  ipfs-preload-tester:runner:browser Using preloader API Address: /dns4/node0.preload.ipfs.io/https +238ms
  ipfs-preload-tester:runner:browser Using preloader Bootstrap Address: /dns4/node0.preload.ipfs.io/tcp/443/wss/p2p/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic +0ms
  ipfs-preload-tester:runner:browser Creating in browser IPFS node... +0ms
  ipfs-preload-tester:runner:browser Swarm listening on /p2p-circuit/ipfs/QmUCvZY66rJn5pFBmfnPNfjTm86ZupRpUdBitzzFJQNoR1 +470ms
  ipfs-preload-tester:runner:browser Adding data: "Test content created on Wed Jan 29 2020 12:38:10 GMT+0000 (Greenwich Mean Time)" +30ms
  ipfs-preload-tester:runner Received CID from browser node: QmZKxxcFteTgMBH2kzJe3GMrMhRbj6QYPLhmHuiUU3v9mM +1s
  ipfs-preload-tester:runner Creating in process IPFS node... +0ms
Swarm listening on /ip4/127.0.0.1/tcp/4002
Swarm listening on /ip4/192.168.1.209/tcp/4002
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws
  ipfs-preload-tester:runner Retrieving data for QmZKxxcFteTgMBH2kzJe3GMrMhRbj6QYPLhmHuiUU3v9mM... +248ms
  ipfs-preload-tester:runner Got a chunk "Test content created on Wed Jan 29 2020 12:38:10 GMT+0000 (Greenwich Mean Time)" +758ms
Test execution time: 2.418s
๐Ÿฅณ This preloader is working as expected

js-ipfs-preload-tester's People

Contributors

alanshaw avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.