Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
2b243d52
Commit
2b243d52
authored
2 years ago
by
benjamin
Browse files
Options
Downloads
Patches
Plain Diff
fixed tests
parent
ff40d501
No related branches found
No related tags found
4 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!402
modified sent code to hand random instead of nil ids to the layer below
,
!340
Project/channels
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
channels/manager.go
+1
-1
1 addition, 1 deletion
channels/manager.go
channels/sendTracker_test.go
+18
-6
18 additions, 6 deletions
channels/sendTracker_test.go
channels/send_test.go
+15
-5
15 additions, 5 deletions
channels/send_test.go
with
34 additions
and
12 deletions
channels/manager.go
+
1
−
1
View file @
2b243d52
...
@@ -143,7 +143,7 @@ func setupManager(identity cryptoChannel.PrivateIdentity, kv *versioned.KV,
...
@@ -143,7 +143,7 @@ func setupManager(identity cryptoChannel.PrivateIdentity, kv *versioned.KV,
m
.
events
=
initEvents
(
model
)
m
.
events
=
initEvents
(
model
)
m
.
st
=
loadSendTracker
(
net
,
kv
,
m
.
events
.
triggerEvent
,
m
.
st
=
loadSendTracker
(
net
,
kv
,
m
.
events
.
triggerEvent
,
m
.
events
.
triggerAdminEvent
,
model
.
UpdateSentStatus
)
m
.
events
.
triggerAdminEvent
,
model
.
UpdateSentStatus
,
rng
)
m
.
loadChannels
()
m
.
loadChannels
()
...
...
This diff is collapsed.
Click to expand it.
channels/sendTracker_test.go
+
18
−
6
View file @
2b243d52
...
@@ -7,8 +7,10 @@ import (
...
@@ -7,8 +7,10 @@ import (
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/client/storage/versioned"
cryptoChannel
"gitlab.com/elixxir/crypto/channel"
cryptoChannel
"gitlab.com/elixxir/crypto/channel"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/ekv"
"gitlab.com/elixxir/ekv"
"gitlab.com/elixxir/primitives/states"
"gitlab.com/elixxir/primitives/states"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/xx_network/primitives/netTime"
"gitlab.com/xx_network/primitives/netTime"
...
@@ -67,7 +69,9 @@ func TestSendTracker_MessageReceive(t *testing.T) {
...
@@ -67,7 +69,9 @@ func TestSendTracker_MessageReceive(t *testing.T) {
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
trigger
,
nil
,
updateStatus
)
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
trigger
,
nil
,
updateStatus
,
crng
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
process
:=
st
.
MessageReceive
(
mid
,
r
)
process
:=
st
.
MessageReceive
(
mid
,
r
)
...
@@ -140,7 +144,9 @@ func TestSendTracker_failedSend(t *testing.T) {
...
@@ -140,7 +144,9 @@ func TestSendTracker_failedSend(t *testing.T) {
triggerCh
<-
status
triggerCh
<-
status
}
}
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
nil
,
adminTrigger
,
updateStatus
)
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
nil
,
adminTrigger
,
updateStatus
,
crng
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
...
@@ -206,7 +212,9 @@ func TestSendTracker_send(t *testing.T) {
...
@@ -206,7 +212,9 @@ func TestSendTracker_send(t *testing.T) {
triggerCh
<-
true
triggerCh
<-
true
}
}
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
trigger
,
nil
,
updateStatus
)
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
trigger
,
nil
,
updateStatus
,
crng
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
...
@@ -265,7 +273,9 @@ func TestSendTracker_send(t *testing.T) {
...
@@ -265,7 +273,9 @@ func TestSendTracker_send(t *testing.T) {
func
TestSendTracker_load_store
(
t
*
testing
.
T
)
{
func
TestSendTracker_load_store
(
t
*
testing
.
T
)
{
kv
:=
versioned
.
NewKV
(
ekv
.
MakeMemstore
())
kv
:=
versioned
.
NewKV
(
ekv
.
MakeMemstore
())
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
nil
,
nil
,
nil
)
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
nil
,
nil
,
nil
,
crng
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
rid
:=
id
.
Round
(
2
)
rid
:=
id
.
Round
(
2
)
...
@@ -275,7 +285,7 @@ func TestSendTracker_load_store(t *testing.T) {
...
@@ -275,7 +285,7 @@ func TestSendTracker_load_store(t *testing.T) {
t
.
Fatalf
(
"Failed to store byRound: %+v"
,
err
)
t
.
Fatalf
(
"Failed to store byRound: %+v"
,
err
)
}
}
st2
:=
loadSendTracker
(
&
mockClient
{},
kv
,
nil
,
nil
,
nil
)
st2
:=
loadSendTracker
(
&
mockClient
{},
kv
,
nil
,
nil
,
nil
,
crng
)
if
len
(
st2
.
byRound
)
!=
len
(
st
.
byRound
)
{
if
len
(
st2
.
byRound
)
!=
len
(
st
.
byRound
)
{
t
.
Fatalf
(
"byRound was not properly loaded"
)
t
.
Fatalf
(
"byRound was not properly loaded"
)
}
}
...
@@ -294,7 +304,9 @@ func TestRoundResult_callback(t *testing.T) {
...
@@ -294,7 +304,9 @@ func TestRoundResult_callback(t *testing.T) {
return
0
,
nil
return
0
,
nil
}
}
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
trigger
,
nil
,
update
)
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
trigger
,
nil
,
update
,
crng
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
cid
:=
id
.
NewIdFromString
(
"channel"
,
id
.
User
,
t
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
mid
:=
cryptoChannel
.
MakeMessageID
([]
byte
(
"hello"
),
cid
)
...
...
This diff is collapsed.
Click to expand it.
channels/send_test.go
+
15
−
5
View file @
2b243d52
...
@@ -152,6 +152,8 @@ func TestSendGeneric(t *testing.T) {
...
@@ -152,6 +152,8 @@ func TestSendGeneric(t *testing.T) {
t
.
Fatalf
(
err
.
Error
())
t
.
Fatalf
(
err
.
Error
())
}
}
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
m
:=
&
manager
{
m
:=
&
manager
{
me
:
pi
,
me
:
pi
,
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
...
@@ -173,7 +175,7 @@ func TestSendGeneric(t *testing.T) {
...
@@ -173,7 +175,7 @@ func TestSendGeneric(t *testing.T) {
return
0
,
nil
return
0
,
nil
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
}),
}
,
crng
),
}
}
channelID
:=
new
(
id
.
ID
)
channelID
:=
new
(
id
.
ID
)
...
@@ -240,6 +242,8 @@ func TestAdminGeneric(t *testing.T) {
...
@@ -240,6 +242,8 @@ func TestAdminGeneric(t *testing.T) {
t
.
Fatalf
(
err
.
Error
())
t
.
Fatalf
(
err
.
Error
())
}
}
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
m
:=
&
manager
{
m
:=
&
manager
{
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
nicknameManager
:
&
nicknameManager
{
nicknameManager
:
&
nicknameManager
{
...
@@ -260,7 +264,7 @@ func TestAdminGeneric(t *testing.T) {
...
@@ -260,7 +264,7 @@ func TestAdminGeneric(t *testing.T) {
return
0
,
nil
return
0
,
nil
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
}),
}
,
crng
),
}
}
messageType
:=
Text
messageType
:=
Text
...
@@ -330,6 +334,8 @@ func TestSendMessage(t *testing.T) {
...
@@ -330,6 +334,8 @@ func TestSendMessage(t *testing.T) {
t
.
Fatalf
(
err
.
Error
())
t
.
Fatalf
(
err
.
Error
())
}
}
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
m
:=
&
manager
{
m
:=
&
manager
{
me
:
pi
,
me
:
pi
,
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
...
@@ -350,7 +356,7 @@ func TestSendMessage(t *testing.T) {
...
@@ -350,7 +356,7 @@ func TestSendMessage(t *testing.T) {
return
0
,
nil
return
0
,
nil
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
}),
}
,
crng
),
}
}
channelID
:=
new
(
id
.
ID
)
channelID
:=
new
(
id
.
ID
)
...
@@ -425,6 +431,8 @@ func TestSendReply(t *testing.T) {
...
@@ -425,6 +431,8 @@ func TestSendReply(t *testing.T) {
t
.
Fatalf
(
err
.
Error
())
t
.
Fatalf
(
err
.
Error
())
}
}
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
m
:=
&
manager
{
m
:=
&
manager
{
me
:
pi
,
me
:
pi
,
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
channels
:
make
(
map
[
id
.
ID
]
*
joinedChannel
),
...
@@ -445,7 +453,7 @@ func TestSendReply(t *testing.T) {
...
@@ -445,7 +453,7 @@ func TestSendReply(t *testing.T) {
return
0
,
nil
return
0
,
nil
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
}),
}
,
crng
),
}
}
channelID
:=
new
(
id
.
ID
)
channelID
:=
new
(
id
.
ID
)
...
@@ -520,6 +528,8 @@ func TestSendReaction(t *testing.T) {
...
@@ -520,6 +528,8 @@ func TestSendReaction(t *testing.T) {
t
.
Fatalf
(
err
.
Error
())
t
.
Fatalf
(
err
.
Error
())
}
}
crng
:=
fastRNG
.
NewStreamGenerator
(
100
,
5
,
csprng
.
NewSystemRNG
)
m
:=
&
manager
{
m
:=
&
manager
{
me
:
pi
,
me
:
pi
,
nicknameManager
:
&
nicknameManager
{
nicknameManager
:
&
nicknameManager
{
...
@@ -540,7 +550,7 @@ func TestSendReaction(t *testing.T) {
...
@@ -540,7 +550,7 @@ func TestSendReaction(t *testing.T) {
return
0
,
nil
return
0
,
nil
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
},
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
}),
}
,
crng
),
}
}
channelID
:=
new
(
id
.
ID
)
channelID
:=
new
(
id
.
ID
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment