Skip to content
Snippets Groups Projects
Commit 6613bf11 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Fix tests

parent 16425ac7
No related branches found
No related tags found
2 merge requests!510Release,!428built the system to sequentually pick up old ephemerals, breaks interfaces and tests
......@@ -11,6 +11,13 @@ import (
"bytes"
"crypto/ed25519"
"encoding/binary"
"math/rand"
"reflect"
"sort"
"strconv"
"testing"
"time"
"gitlab.com/elixxir/client/broadcast"
clientCmix "gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/message"
......@@ -24,12 +31,6 @@ import (
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"math/rand"
"reflect"
"sort"
"strconv"
"testing"
"time"
)
// Tests that manager.store stores the channel list in the ekv.
......@@ -143,9 +144,19 @@ func Test_manager_loadChannels(t *testing.T) {
t.Errorf("Channel %s does not exist.", &chID)
}
if !reflect.DeepEqual(ch.broadcast, loadedCh.broadcast) {
expected := ch.broadcast.Get()
received := loadedCh.broadcast.Get()
// NOTE: Times don't compare properly after
// marshalling due to the monotonic counter
if expected.Created.Equal(received.Created) {
expected.Created = received.Created
}
if !reflect.DeepEqual(expected, received) {
t.Errorf("Channel %s does not match loaded channel."+
"\nexpected: %+v\nreceived: %+v", &chID, ch.broadcast, loadedCh.broadcast)
"\nexpected: %+v\nreceived: %+v", &chID,
expected, received)
}
}
}
......@@ -507,9 +518,17 @@ func Test_loadJoinedChannel(t *testing.T) {
t.Errorf("Failed to load joinedChannel: %+v", err)
}
if !reflect.DeepEqual(ch, loadedJc.broadcast.Get()) {
expected := *ch
received := *loadedJc.broadcast.Get()
// NOTE: Times don't compare properly after marshalling due to the
// monotonic counter
if expected.Created.Equal(received.Created) {
expected.Created = received.Created
}
if !reflect.DeepEqual(expected, received) {
t.Errorf("Loaded joinedChannel does not match original."+
"\nexpected: %+v\nreceived: %+v", ch, loadedJc.broadcast.Get())
"\nexpected: %+v\nreceived: %+v", expected, received)
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment