Skip to content
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

Integration Testing Spec #336

Closed
bigs opened this issue May 31, 2018 · 5 comments
Closed

Integration Testing Spec #336

bigs opened this issue May 31, 2018 · 5 comments

Comments

@bigs
Copy link
Contributor

bigs commented May 31, 2018

Opening a new issue to start a discussion around integration testing for go-libp2p.

In order to test more complex behaviors of libp2p, it's clear we'll want some sort of test harness in place. In my view, there are two tiers of this that could use doing:

  • Micro: Mocked out interfaces all throughout libp2p such that we can create intra-process virtual topologies. In such a scheme, we'd want to describe connectivity in some sort of DSL (e.g. host A can connect to host B, not host C) and then initiate tests in which a test runner spawns the relevant hosts and attempts to complete some scenario (e.g. host A communicates with host C via relay after X round trips). Useful for debugging protocols, etc.
  • Macro: Cluster simulation infrastructure. Should be able to simulate very large clusters and record various telemetry. As much a benchmarking tool as a debugging tool! Useful for spotting performance regressions as well as emulating various attacks, etc.

I've got to run for now, but wanted to get this discussion started! I think both the micro and macro options are useful, so it's really just a matter of determining when we want to spec/implement.

@whyrusleeping @jbenet @mgoelzer

@Stebalien
Copy link
Member

FYI, this is a good place to start for micro tests: https://github.com/libp2p/go-libp2p/tree/master/p2p/net/mock (although we should still have some form of DSL).

@bigs
Copy link
Contributor Author

bigs commented Jun 7, 2018

@Stebalien Awesome, thanks. I did eventually wade my way into that folder. Maybe even just a configuration interpreter that creates networks based on that interface.

@Stebalien
Copy link
Member

Really, we could define those configurations using go datastructures instead of parsing a separate file. One can, e.g., write:

net := Make(TestNet{
  Nodes: []TestNode{
    {
      Name: "PeerA",
      ...
    },
  },
  Links: []Link{
    {
      From: "PeerA",
      To: "PeerB",
      DefaultUp: true,
      Latency: ...,
      ...
    }
  },
})

net.Link("PeerA").Down()

...

@bigs
Copy link
Contributor Author

bigs commented Jun 8, 2018

Yep! That sounds perfect

@bigs
Copy link
Contributor Author

bigs commented Jun 12, 2018

New home at protocol/research-grants#4

@bigs bigs closed this as completed Jun 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants