Commit Graph

126 Commits

Author SHA1 Message Date
ljedrz
5bcb3d92b4 chore: isolate the creation of the go-ipfs node
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-09-01 14:07:59 +02:00
ljedrz
2ee99d282d feat: improve the go-interop DHT tests
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-09-01 14:07:59 +02:00
ljedrz
211d7224bd feat: make test nodes use the test kad protocol
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-09-01 14:07:59 +02:00
ljedrz
7a0e02b913 feat: enable DHT interop tests with a go-ipfs node
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-09-01 14:07:59 +02:00
ljedrz
b5471f1f98 feat: improve the DHT tests
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-28 14:54:18 +02:00
ljedrz
d91976ffb3 fix: directly use Cid in Ipfs::{get_providers, provide}
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-26 11:24:29 +02:00
ljedrz
d84d64cdc9 feat: implement /dht/query (i.e. get_closest_peers)
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-21 13:23:47 +02:00
ljedrz
6d2cdb71f2 test: check the DHT provide and get_providers functionalities
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-21 12:51:35 +02:00
ljedrz
cb534f9a4d feat: improve the find_peer_dht test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-20 12:38:08 +02:00
ljedrz
e397a0a213 feat: introduce Ipfs::find_peer
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-19 15:59:26 +02:00
ljedrz
39d6459d6e fix: fix the kademlia bootstrapping test (post-Multiaddr-wrapper fallout)
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-19 11:54:54 +02:00
ljedrz
4599fff709 feat: introduce a custom error for the Multiaddr wrappers
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-18 15:59:51 +02:00
ljedrz
6e8dff0bb7 feat: utilize the new Multiaddr wrappers 2020-08-17 15:51:26 +02:00
ljedrz
2c4fbe8c1b fix: remove Ipfs::peer_id, add a connection test, dont add Protocol::P2p in IpfsEvents
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-17 09:01:49 +02:00
ljedrz
993b80d2d1 fix: disallow Multiaddrs without the P2p protocol
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-14 16:19:56 +02:00
ljedrz
a070ca13d0 fix: make the retrying loop in wantlist_cancellation less busy
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-13 18:00:28 +02:00
ljedrz
c930f651fd test: make async tests use only 1 thread
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-13 16:16:20 +02:00
ljedrz
398aa58877 chore: import reordering with cargo fmt
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-13 16:15:45 +02:00
ljedrz
8be75f7a4a feat: change the async executor to tokio
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-13 16:15:14 +02:00
ljedrz
50dd210719 test: tweak two node connection tests
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-12 12:04:15 +02:00
ljedrz
a0b777d542 fix: ignore connect_two_nodes_by_peer_id, add relevant comments
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-12 11:13:00 +02:00
ljedrz
58a966a24a feat: test duplicate connection attempts
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-12 10:04:04 +02:00
Joonas Koivunen
c95a9bb862 fix: first drop mutex guard, then assert
the assert while holding the guard poisons the mutex and that causes
drop to panic because of the poisoned mutex, by design; see last
commit. by shortening the scope of the mutex guard we should once again
see more clear build failures :)
2020-08-11 13:51:17 +03:00
Joonas Koivunen
9e695e02cb fix: go back to std::sync::Mutex
Turns out #174 was wrong, as the alternative required sprinkling
block_on which made the whole thing worse. we shouldn't risk a deadlock
with the mutex as we are not (can not) holding it across awaits.

unwrap as we are not expecting subscriptions to panic and poison the
mutex.
2020-08-11 13:03:45 +03:00
bors[bot]
70bccd8873
Merge #280
280: Patch a Bitswap leak r=koivunej a=ljedrz

We currently don't properly clean up after a connection to a `Bitswap` peer is closed, which leads to leaking `Ledger`s; funnily enough, it seems that just uncommenting a pre-existing line solves the issue. In addition, add a relevant test.

Co-authored-by: ljedrz <ljedrz@gmail.com>
2020-08-06 15:08:27 +00:00
Joonas Koivunen
3e2554aa47 fix: add timeouts to connect_two tests
gha windows was stuck on this. it's not nice since we cannot see any
testing output before the run is cancelled.
2020-08-06 17:20:47 +03:00
ljedrz
2dfabdf66a fix: patch a Bitswap leak and test it
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-06 16:02:04 +02:00
bors[bot]
b99288b7b1
Merge #290
290: Some maintenance r=koivunej a=ljedrz

Some maintenance work so as not to conflict too much with the pending PRs:
- depend on cid instead of libipld where only Cid is used
- update the `domain` dep (big `Cargo.lock` wins)

cc #75 

Co-authored-by: ljedrz <ljedrz@gmail.com>
2020-08-06 13:23:45 +00:00
ljedrz
f5f6790062 chore: depend on cid instead of libipld where only Cid is used
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-06 11:38:27 +02:00
ljedrz
7759ee0e32 fix: ignore a flaky kad test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-06 10:48:06 +02:00
ljedrz
38b39747bb feat: introduce the means to connect by PeerId
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-08-03 14:24:01 +02:00
ljedrz
dc48504d1c chore: add a comment to the bitswap stress test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-31 16:42:50 +02:00
ljedrz
0d74cea3df feat: add a bitswap stress test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-31 15:52:56 +02:00
ljedrz
e820e7a5e8 feat: keep a node's Span instead of its name
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-30 17:32:25 +02:00
ljedrz
0abe1b4aa4 refactor: improve node init in some tests
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-30 15:59:14 +02:00
ljedrz
e0d43ed861 feat: more logs
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-30 15:21:03 +02:00
ljedrz
0140c673b8 feat: attach tracing to nodes
Co-authored-by: Joonas Koivunen <joonas@equilibrium.co>
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-30 14:53:38 +02:00
Joonas Koivunen
7b71137eb8 fix: cleanup also the Pending related subs
earlier commit already included cleanup for the Ready and Cancelled
cases and this will do the same for Pending cases. the end result
doesn't change but as is apparent from the test changes: a single
Some(0) becomes None. however this does remove leaking and potential
bugs when a previously completed subscription would be reused.
2020-07-30 11:10:20 +03:00
ljedrz
a284c1f841 feat: replace log with tracing
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-29 14:50:00 +02:00
ljedrz
a4be9cddd6 refactor: change the ipfs.docs Cid to the logo one
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-28 09:58:40 +02:00
ljedrz
d0908104a3 fix: don't initialize the global test logger twice
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-28 09:58:40 +02:00
ljedrz
e98e86b188 fix: set up the kad protocol in the content discovery test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-28 09:58:40 +02:00
ljedrz
49390676bf feat: rename the variables in the kad test, add a new content discovery one
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-28 09:58:40 +02:00
ljedrz
10974f8918 feat: enable content discovery features
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-28 09:58:40 +02:00
Caio
e42b88c6a6 Use async macro for tests 2020-07-27 13:00:40 -03:00
ljedrz
ff1765ba10 fix: remove unused params in Node::new and IpfsOptions::inmemory_with_generated_keys
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-22 15:35:25 +02:00
ljedrz
3bb0a65e04 feat: add and test peer discovery
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-22 12:00:56 +02:00
ljedrz
856c41f8dc fix: async-ify and simplify bounded_retry
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-21 11:26:42 +02:00
ljedrz
4b60684f73 refactor: use the Node object in the wantlist cancellation test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-20 15:56:09 +02:00
ljedrz
9e013101a3 fix: increase some wantlist test timeouts
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-20 15:30:09 +02:00
ljedrz
6a646d73d6 feat: test wantlist/subscriptions coop
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-20 15:30:09 +02:00
Joonas Koivunen
5356915d79 test: ignore flaky test
not a complete solution to the issue but no need to have these nagging
unnecessary test failures when we have the issue #194 for the problem
class.
2020-07-16 11:56:03 +03:00
ljedrz
1b1ab37fd2 feat: extend the wantlist cancellation test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-15 16:02:33 +02:00
ljedrz
415a7e9cf8 fix: make the wantlist cancellation test work on separate tasks
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-14 13:58:30 +02:00
ljedrz
3d564526e8 fix: make wantlist conformance tests pass
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-14 11:43:11 +02:00
ljedrz
8ef92259e7 feat: improve the wantlist cancellation test
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-13 15:43:42 +02:00
ljedrz
7cbf65a373 fix: use Cid v0 for subscriptions
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-13 15:43:42 +02:00
ljedrz
a9f763cf97 feat: cancel Blocks from the wantlist when all their Subscriptions die
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-07-13 15:43:42 +02:00
ljedrz
01f58dd541 fix: cargo fmt
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-26 16:13:37 +02:00
ljedrz
2603532027 refactor: make pubsub methods move their params
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-06-26 15:11:05 +02:00
Joonas Koivunen
05451911b3 test: add timeout to exchange_block
this has been hanging on CI sometimes, 10s is more than enough for this
operation under the heaviest load.
2020-06-18 00:45:29 +03:00
Joonas Koivunen
e7408bad82
fix: flaky adding two same ip ephemerals (#177)
* fix: flaky adding two same ip ephemerals
* refactor: handle clippy warning
* refactor: grammar and simplify counting to or
2020-06-08 12:42:03 +03:00
Joonas Koivunen
7799d888f6
Upgrade libp2p 0.19.0 (#169)
* chore: upgrade the libp2p to 0.18.(0|1)
* refactor: fix most of the swarm with todos

mainly leaving the multiple connections case to panic.

* feat: add ability to configure listening addr

the original random listening address is still in place.

* add test case for the panic with two connections

* fix: allow multiple connections in p2p/swarm
* doc: Connection and the any connecting address
* chore: cleanup libp2p patching examples

* refactor: rename SwarmApi::stats

perhaps roundtrip_times is more readable.

* chore: upgrade to libp2p 0.19

* fix: awaiting for binding new listening addresses

the initial implementation didn't actually wait for anything other than
asking the swarm to start listening, but now the await will complete
only after a listening address has actually been bound. this required
some nasty matching on the multiaddr protocol parts which will hopefully
ever be used by test code but ... it works now, at least a bit better.

* fix test on macos, fix unspecified addr handling
2020-05-19 17:26:57 +03:00
Joonas Koivunen
1ea02418a5 refactor: get rid of clippy warnings 2020-04-16 16:40:40 +03:00
Joonas Koivunen
97b5817381 refactor: remove unnecessary mut refs
unsure why this isn't picked up by clippy.
2020-04-15 09:54:53 -04:00
Joonas Koivunen
5e3afef59c refactor: remove obsolete test comment 2020-04-02 13:04:00 +03:00
Joonas Koivunen
c1b1626399 chore: cargo fmt 2020-04-02 13:04:00 +03:00
Joonas Koivunen
85bd2cd705 add: salvaged exchange_block
This is from davids non-mergeable branch.

Co-authored-by: David Craven <david@craven.ch>
2020-04-02 13:04:00 +03:00
Joonas Koivunen
b6dbd64ca4 refactor: remove warning 2020-03-28 19:45:18 -04:00
Joonas Koivunen
305e152aec fix: flaky test by cloning instead of try_unwrap 2020-03-28 19:45:18 -04:00
Joonas Koivunen
6cbf679644
Add pubsub http (#120)
* add: pubsub http api
* add: get shoveling and subscription complications going

currently the missing piece is seeing locally sent messages in the
subscribed streams, then maybe creating a more complicated API for
subscribing which will require a single task for shoveling into the
responses.

* chore: lower timeout to pass the tests

Should probably have another drop sender here.

* fix: close stream on first error

tokio::sync::broadcast will continue after telling how many items were
lost, which seems likely with the small buffer and quickly firing more
than the buffer elements.

* fix: raise the buffer size for subscribe responses
* feat: use custom rust-libp2p to pass tests

the v0.16.2-with-floodsub-opts includes "subscribers see locally
published messages" which is needed for the conformance tests to pass.
this has been PR'd as https://github.com/libp2p/rust-libp2p/pull/1520.

* fix: pubsub test after changing the floodsub impl
2020-03-25 21:42:06 +02:00
Joonas Koivunen
ae89f4aa3d
Add pubsub api (#118)
* add: simple pubsub api

the api is quite horrible with `ipfs::Ipfs::pubsub_*` methods but it
works. `ipfs::Ipfs` provides subscribing to a topic at most once, the
old subscription needs to be unsubscribed with `pubsub_unsubscribe`
before a new one can be started.

message publishing happens via the `Floodsub::publish_any` api which
allows publishing into not subscribed topics.

there are also apis for getting the known peers optionally per topic and
listing the active subscriptions.

subscriptions can be dropped by the user but the subscription will not
be cleaned up until a message comes in... this is perhaps something to
be looked at.

* add: simple pubsub tests
* fix: impl unsubscribing via drop
* doc: add missing public doc comment
* doc: add and adjust
* refactor: clippy warnings
* fix: dont unsub on drop after stream ended

this happens only once the sender has been dropped by unsubscribing (or
later via bounded channel becoming full).

* doc: update comments on pubsub
* fix: poll swarm fully

there was an issue where swarm wasn't being polled to the end for which
I hastly created https://github.com/libp2p/rust-libp2p/issues/1516. in
later investigation it turned out that the ipfs::p2p::pubsub was
returning `Poll::Pending` too soon. alternative to the loops would be to
wake the task up where previously `Poll::Pending` was returned.

the issue manifested because of the polling order and the changes made
to the swarm after polling it. the changes created new events which
needed to be dispatched which in turn means the swarm needs to be polled
again or a wakeup be scheduled. adding those wakeups would make the
tasks more co-operative with the same tasks running on the executor.

also reverts the changes made in
290fcfa3ad to ipfs::p2p::swarm where
std::task::Waker was recorded and notified on changes. adding the waker
helped in that particular case but not in general.

* fix: remove rare panic in valid situation
* refactor: remove extra logging
2020-03-25 20:52:41 +02:00
Joonas Koivunen
512c34a8d5 chore: cargo fmt 2020-03-22 16:43:55 +02:00
Joonas Koivunen
4829f0133e refactor: minor cleanup in tests and swarm 2020-03-22 16:42:47 +02:00
Joonas Koivunen
90bf986b24 wip: use println instead of log in test 2020-03-22 15:44:35 +02:00
Joonas Koivunen
cd7a416528 add: test case for connecting two nodes
this currently fails because the identify query is executed before
network of swarm is ready, or is even polled the first time.
2020-03-22 15:00:12 +02:00