From 940b95aad73f01fb76c319308ba7ea1a6a8a9e0d Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 15 Jun 2018 18:34:11 -0700 Subject: [PATCH] lnwire: update testing.Quick tests to alternate between encoding types --- lnwire/lnwire_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lnwire/lnwire_test.go b/lnwire/lnwire_test.go index 0633e6b0..f1311c62 100644 --- a/lnwire/lnwire_test.go +++ b/lnwire/lnwire_test.go @@ -651,9 +651,14 @@ func TestLightningWireProtocol(t *testing.T) { v[0] = reflect.ValueOf(req) }, MsgQueryShortChanIDs: func(v []reflect.Value, r *rand.Rand) { - req := QueryShortChanIDs{ - // TODO(roasbeef): later alternate encoding types - EncodingType: EncodingSortedPlain, + req := QueryShortChanIDs{} + + // With a 50/50 change, we'll either use zlib encoding, + // or regular encoding. + if r.Int31()%2 == 0 { + req.EncodingType = EncodingSortedZlib + } else { + req.EncodingType = EncodingSortedPlain } if _, err := rand.Read(req.ChainHash[:]); err != nil { @@ -687,8 +692,13 @@ func TestLightningWireProtocol(t *testing.T) { req.Complete = uint8(r.Int31n(2)) - // TODO(roasbeef): later alternate encoding types - req.EncodingType = EncodingSortedPlain + // With a 50/50 change, we'll either use zlib encoding, + // or regular encoding. + if r.Int31()%2 == 0 { + req.EncodingType = EncodingSortedZlib + } else { + req.EncodingType = EncodingSortedPlain + } numChanIDs := rand.Int31n(5000)