-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use net/mocknet
in integration tests
#470
Conversation
@maybebtc is this LFCR ? |
771ef44
to
ac624da
Compare
if _, err := mn.LinkPeers(i, j); err != nil { | ||
return err | ||
} | ||
if err := mn.ConnectPeers(i, j); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's necessary to link peers, but not necessary to connect them, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maybebtc
Link
means that a connection is possible. (think physical link)Connect
means "open a connection". (think anet.Conn
)
So yeah, you dont have to link nodes together, if someone will try to find the node and Dial
as the result of some other actions in the test.
@jbenet RFCR please see questions on original post. |
We can add one for good practice. But no, it's just a struct.
Depends on what your code will do. If you code will open connections itself then no need to connect. if your code assumes that nodes have a live connection, then yes. (e.g. dht needs a few nodes bootstrapped (connected already) and from there it can open more connections by itself).
Mocknet itself doesnt need the keys itself. They're there because things outside using mocknet may assume they have public keys because a connection is open. So it depends on your test. (we could add a function if you want, but you'll have to either setup the nodes with things that behave like keys, make sure you dont use anything that expects keys to be there). |
ID() peer.ID | ||
PrivateKey() ci.PrivKey | ||
PublicKey() ci.PubKey | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename this to something other than Peer
. suggest just using PeerNetParams
directly. I just got done removing Peer
from the entire codebase. It will breed confusion and break things. Also, anything called Peer
shouldn't "contain" addresses. the ephemeral + indeterminate state of addresses is a source of so, so much pain. (peers can have many, can gain + lose them, might have different mappings depending on where two peers are in the network, might have complete information, might selectively expose addresses to some peers, etc etc etc.)
Why not just use PeerNetParams
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testutil.Peer
. The name is pretty clear.
Why not just use PeerNetParams ?
Don't want to tie down callsites to a concrete type that's subject to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Package names are not global. they are rebound locally.
tu.Peer
is no longer so clear. - it's
Peer
. please, i'm specifically requesting that we do not expose things namedPeer
anymore that represent an ipfs' peer's Identity, and purport to carry addresses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed 0172e4f
LGTM other than:
|
ac624da
to
f9a8040
Compare
so it'll be easier to create another implementation using the new mocknet
…ersion License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
…kpeernet under the hood License: MIT Signed-off-by: Brian Tiger Chow <[email protected]>
https://travis-ci.org/jbenet/go-ipfs/jobs/45000756 cc @whyrusleeping @jbenet lol this is starting to happen pretty often
@whyrusleeping @jbenet this is a WIP with the DHT. wip License: MIT Signed-off-by: Brian Tiger Chow <[email protected]> Conflicts: epictest/addcat_test.go exchange/bitswap/testnet/peernet.go exchange/bitswap/testutils.go routing/mock/centralized_server.go routing/mock/centralized_test.go routing/mock/interface.go fix(routing/mock) fill in function definition
pprof cannot be used reliably on OS X. This provides two make tasks to collect and analyze profiling data. To run profiling in a dockerized linux environment... ``` make // or `make collect` ``` To analyze results on host machine... ``` make analyze ``` @jbenet @whyrusleeping
It's now possible to produce the DHT issues without process orchestration. Test1KBInstantaneous fails @jbenet @whyrusleeping
f9a8040
to
9117906
Compare
9117906
to
0172e4f
Compare
👍 |
thanks! lgtm |
still has two TODOs
|
@maybebtc my key generation using |
(I do this in my branch |
@jbenet @whyrusleeping the test reproduces the docker network test failure. context deadline exceeded when adding and catting through a bootstrap node. ready for merge |
This looks good to me, the peer generation stuff gets some work in my branch, but as you said, we might want to merge this one first. |
refactor(epictest) Core refactor: extract repo fix move core
1784d1e
to
513c568
Compare
merging in NB: this triggers |
use `net/mocknet` in integration tests
…com/multiformats/go-multiaddr-0.2.1 build(deps): bump github.com/multiformats/go-multiaddr from 0.2.0 to 0.2.1
This PR adds the
net/mocknet
to the tests/benchmarks that perform the Add/Cat operation.@jbenet @whyrusleeping
TODOs:
mn.Close()
?mocknet
requirements? Would @whyrusleeping's parameterized version solve this problem?