go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

rewrite identify tests, remove mocknet package

Open marten-seemann opened this issue 2 years ago • 8 comments

The identify tests were the last consumer of the mocknet package (which in turn is the last consumer of go-libp2p-testing/net package). By rewriting those tests, we can get rid of mocknet, and we won't have to migrate go-libp2p-testing/net here.

marten-seemann avatar May 15 '22 12:05 marten-seemann

there might be downstream dependents.

The only one in libp2p I can find is go-libp2p-kad-dht/ext_test.go. They'll have to find a way to deal with this. This code has caused us so much pain, it's time to get rid of it.

There's more in ipfs (bitswap and go-ipfs).

marten-seemann avatar May 15 '22 12:05 marten-seemann

I agree this library is annoying, but it's all we have for large integration tests with many nodes.

If we just "remove" it here and tell upstream to "deal" with it, I guarantee they'll "deal" with it by not upgrading libp2p.

How about just not using it here? I'd also like to note that it's not all that useful for libp2p itself, because libp2p generally has no need for large-scale mock tests (it mostly needs to test things on the transport level). However, for the dht, bitswap, etc., the ability to mock is really useful.

Stebalien avatar May 15 '22 19:05 Stebalien

I’d argue that it shouldn’t live within libp2p then (or at least not go-libp2p). How about moving it to a separate repo?

marten-seemann avatar May 15 '22 19:05 marten-seemann

I’d argue that it shouldn’t live within libp2p then (or at least not go-libp2p). How about moving it to a separate repo?

That seems reasonable. Can we just move it to go-libp2p-testing?

Stebalien avatar May 15 '22 20:05 Stebalien

We can. The original plan was to deprecate go-libp2p-testing, but we can just shift packages around: all the muxer and transport tests go here, and the mocknet tests go there.

marten-seemann avatar May 15 '22 20:05 marten-seemann

mocknet is helpful for @celestiaorg. We mock away OS networking in our protocols tests using it.

Moving it out seems inconsistent with the latest efforts to consolidate everything in one root go-libp2p repo. OOC, what problems was mocknet causing, and why is it annoying to the point where it needs to be invisible from people exploring the repo? Is there a plan to keep testing pkgs outside of the repo?

Wondertan avatar May 16 '22 08:05 Wondertan

I've not reviewed this code yet, but at a high level my thoughts are:

  1. If this is a tool we are exposing to end users to be able to test large scale mock tests, then it makes sense that this should live in the go-libp2p repo and get tested/updated alongside everything else and for the same reasons we are consolidating everything else.
  2. If we want to deprecate this tool (mocknet), then I think we need a viable alternative for folks that is tested and lives in go-libp2p.

I'm not opposed to deprecating this and providing something similar/simpler that can support the original use case. But I think something like this is useful.

MarcoPolo avatar May 19 '22 18:05 MarcoPolo

2022-09-09 conversation: we'll get the changes in to the tests so that go-libp2p doesn't use mocknet. It's a separate item/discussion on what to do with mocknet.

BigLep avatar Sep 09 '22 16:09 BigLep

I rebased this PR and removed the commit that removes the mocknet package.

marten-seemann avatar Oct 12 '22 13:10 marten-seemann