From 384985a3d397ee2d666882a7d4bb0c3b3f013283 Mon Sep 17 00:00:00 2001 From: jbhusson <jonah@elixxir.io> Date: Mon, 27 Jun 2022 12:18:46 -0400 Subject: [PATCH] Fix tests --- broadcast/asymmetric_test.go | 11 ++++++++--- broadcast/symmetric_test.go | 8 +++++++- cmd/broadcast.go | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/broadcast/asymmetric_test.go b/broadcast/asymmetric_test.go index 88aa2219d..776879127 100644 --- a/broadcast/asymmetric_test.go +++ b/broadcast/asymmetric_test.go @@ -56,11 +56,16 @@ func Test_asymmetricClient_Smoke(t *testing.T) { cbChan <- payload } - s, err := NewBroadcastChannel(channel, cb, newMockCmix(cMixHandler), rngGen, Param{Method: Asymmetric}) + s, err := NewBroadcastChannel(channel, newMockCmix(cMixHandler), rngGen) if err != nil { t.Errorf("Failed to create broadcast channel: %+v", err) } + err = s.RegisterListener(cb, Asymmetric) + if err != nil { + t.Errorf("Failed to register listener: %+v", err) + } + cbChans[i] = cbChan clients[i] = s @@ -73,7 +78,7 @@ func Test_asymmetricClient_Smoke(t *testing.T) { // Send broadcast from each client for i := range clients { - payload := make([]byte, clients[i].MaxPayloadSize()) + payload := make([]byte, clients[i].MaxAsymmetricPayloadSize()) copy(payload, fmt.Sprintf("Hello from client %d of %d.", i, len(clients))) @@ -112,7 +117,7 @@ func Test_asymmetricClient_Smoke(t *testing.T) { clients[i].Stop() } - payload := make([]byte, clients[0].MaxPayloadSize()) + payload := make([]byte, clients[0].MaxAsymmetricPayloadSize()) copy(payload, "This message should not get through.") // Start waiting on channels and error if anything is received diff --git a/broadcast/symmetric_test.go b/broadcast/symmetric_test.go index de76da504..2eb26d29e 100644 --- a/broadcast/symmetric_test.go +++ b/broadcast/symmetric_test.go @@ -63,10 +63,16 @@ func Test_symmetricClient_Smoke(t *testing.T) { cbChan <- payload } - s, err := NewBroadcastChannel(channel, cb, newMockCmix(cMixHandler), rngGen, Param{Method: Symmetric}) + s, err := NewBroadcastChannel(channel, newMockCmix(cMixHandler), rngGen) if err != nil { t.Errorf("Failed to create broadcast channel: %+v", err) } + + err = s.RegisterListener(cb, Symmetric) + if err != nil { + t.Errorf("Failed to register listener: %+v", err) + } + cbChans[i] = cbChan clients[i] = s diff --git a/cmd/broadcast.go b/cmd/broadcast.go index 3d0a11de1..2249f87d0 100644 --- a/cmd/broadcast.go +++ b/cmd/broadcast.go @@ -124,7 +124,7 @@ var broadcastCmd = &cobra.Command{ // Load key if needed if pk == nil && keyPath != "" { - jww.DEBUG.Printf("Attempting to load private key at %s") + jww.DEBUG.Printf("Attempting to load private key at %s", keyPath) if ep, err := utils.ExpandPath(keyPath); err == nil { keyBytes, err := utils.ReadFile(ep) if err != nil { -- GitLab