btcd icon indicating copy to clipboard operation
btcd copied to clipboard

netsync: Tests for SyncManager.

Open jimpo opened this issue 7 years ago • 3 comments

This is far from full coverage, but it provides some basic coverage and a starting place to add more checks. It doesn't make sense to fully test the current implementation, but I hope to flesh out this test suite as I work on the headers-first sync.

I think it would be worthwhile to pull a bunch of the code from common_test.go (both here and from other packages) into a package that can be shared by the tests of other packages. For example, some of the peer setup with the pipe connections was stolen from peer_test.go.

jimpo avatar Sep 01 '17 23:09 jimpo

I think they're worthwhile since I suspect the RPC integration tests, aside from the fact they're not very comprehensive currently, would not really be able to do a good job of exercising all of the possible corner cases. I'm also thinking this could come in very handy when moving to parallel sync.

You could certainly create multiple nodes and link them up in various ways to make sure they end up all in agreement with the RPC integration tests (and that is definitely something that would be nice to have), but I think it would be really difficult for it to test a lot of the negative conditions such as misbehaving peers that intentionally don't answer after advertising they have inventory, purposely sending blocks at insanely slow speeds (like 1 byte per second), etc.

Having unit-style tests with mock peers will allow all sorts of chicanery to be thrown at the sync code which I believe will really help improve its robustness in the face of bad actors.

davecgh avatar Sep 01 '17 23:09 davecgh

Handled all comments that don't have an explicit reply.

jimpo avatar Jan 29 '18 05:01 jimpo

@jcvernaleo (as per #1530)

  • Low priority
  • Enhancement
  • Outdated (very)

jakesylvestre avatar Mar 04 '20 14:03 jakesylvestre