peers separate
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc
2024-05-28 16:47:04 +02:00
parent c1883f1524
commit e674a0cb33
11 changed files with 164 additions and 79 deletions

View File

@ -14,11 +14,15 @@ func TestStoreMessage(t *testing.T) {
id := createId()
var um meowlib.UserMessage
um.Data = []byte("blabla")
err := StoreMessage(id.Peers[0], &um, []string{}, GetConfig().memoryPassword)
peers, err := id.Peers.GetPeers()
if err != nil {
log.Fatal(err)
}
messages, err := GetMessagesHistory(id.Peers[0], 0, 0, 10, GetConfig().memoryPassword)
err = StoreMessage(peers[0], &um, []string{}, GetConfig().memoryPassword)
if err != nil {
log.Fatal(err)
}
messages, err := GetMessagesHistory(peers[0], 0, 0, 10, GetConfig().memoryPassword)
if err != nil {
log.Fatal(err)
}
@ -42,8 +46,9 @@ func TestStoreMessage(t *testing.T) {
func TestManyStoreMessage(t *testing.T) {
id := createId()
peers, err := id.Peers.GetPeers()
// test with zero messages
messages, err := GetMessagesHistory(id.Peers[0], 0, 0, 10, GetConfig().memoryPassword)
messages, err := GetMessagesHistory(peers[0], 0, 0, 10, GetConfig().memoryPassword)
if err != nil {
log.Fatal(err)
}
@ -51,12 +56,12 @@ func TestManyStoreMessage(t *testing.T) {
for i := 1; i < 100; i++ {
var um meowlib.UserMessage
um.Data = []byte(randomLenString(20, 200))
err := StoreMessage(id.Peers[0], &um, []string{}, GetConfig().memoryPassword)
err := StoreMessage(peers[0], &um, []string{}, GetConfig().memoryPassword)
if err != nil {
log.Fatal(err)
}
}
messages, err = GetMessagesHistory(id.Peers[0], 0, 0, 10, GetConfig().memoryPassword)
messages, err = GetMessagesHistory(peers[0], 0, 0, 10, GetConfig().memoryPassword)
if err != nil {
log.Fatal(err)
}