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
3c29423c
Commit
3c29423c
authored
2 years ago
by
David Stainton
Browse files
Options
Downloads
Patches
Plain Diff
Attempt to fix Test_asymmetricClient_Smoke
parent
7633d35e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
5 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!371
[Channel RSAtoPrivate] Implement Reverse Asymmetric in Client/Broadcast
,
!354
Channels impl
,
!340
Project/channels
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
broadcast/asymmetric_test.go
+37
-6
37 additions, 6 deletions
broadcast/asymmetric_test.go
broadcast/utils_test.go
+14
-8
14 additions, 8 deletions
broadcast/utils_test.go
with
51 additions
and
14 deletions
broadcast/asymmetric_test.go
+
37
−
6
View file @
3c29423c
...
@@ -3,18 +3,22 @@ package broadcast
...
@@ -3,18 +3,22 @@ package broadcast
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
"reflect"
"sync"
"testing"
"time"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/identity/receptionID"
"gitlab.com/elixxir/client/cmix/identity/receptionID"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/cmix/rounds"
crypto
"gitlab.com/elixxir/crypto/broadcast"
crypto
"gitlab.com/elixxir/crypto/broadcast"
cMixCrypto
"gitlab.com/elixxir/crypto/cmix"
cMixCrypto
"gitlab.com/elixxir/crypto/cmix"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/crypto/signature/rsa"
"reflect"
"sync"
"testing"
"time"
)
)
// Tests that symmetricClient adheres to the Symmetric interface.
// Tests that symmetricClient adheres to the Symmetric interface.
...
@@ -23,6 +27,26 @@ var _ Channel = (*broadcastClient)(nil)
...
@@ -23,6 +27,26 @@ var _ Channel = (*broadcastClient)(nil)
// Tests that symmetricClient adheres to the Symmetric interface.
// Tests that symmetricClient adheres to the Symmetric interface.
var
_
Client
=
(
cmix
.
Client
)(
nil
)
var
_
Client
=
(
cmix
.
Client
)(
nil
)
type
mockProcessor
struct
{
messages
[]
format
.
Message
}
var
_
message
.
Processor
=
(
*
mockProcessor
)(
nil
)
func
newMockProcessor
()
*
mockProcessor
{
m
:=
new
(
mockProcessor
)
m
.
messages
=
make
([]
format
.
Message
,
0
)
return
m
}
func
(
p
*
mockProcessor
)
Process
(
message
format
.
Message
,
receptionID
receptionID
.
EphemeralIdentity
,
round
rounds
.
Round
)
{
p
.
messages
=
append
(
p
.
messages
,
message
)
}
func
(
p
mockProcessor
)
String
()
string
{
return
"hello"
}
func
Test_asymmetricClient_Smoke
(
t
*
testing
.
T
)
{
func
Test_asymmetricClient_Smoke
(
t
*
testing
.
T
)
{
cMixHandler
:=
newMockCmixHandler
()
cMixHandler
:=
newMockCmixHandler
()
rngGen
:=
fastRNG
.
NewStreamGenerator
(
1000
,
10
,
csprng
.
NewSystemRNG
)
rngGen
:=
fastRNG
.
NewStreamGenerator
(
1000
,
10
,
csprng
.
NewSystemRNG
)
...
@@ -46,6 +70,13 @@ func Test_asymmetricClient_Smoke(t *testing.T) {
...
@@ -46,6 +70,13 @@ func Test_asymmetricClient_Smoke(t *testing.T) {
RsaPubKey
:
cpubkey
,
RsaPubKey
:
cpubkey
,
}
}
///
// must mutate cMixHandler such that it's processorMap contains a
// message.Processor
processor
:=
newMockProcessor
()
cMixHandler
.
processorMap
[
*
cid
]
=
make
(
map
[
string
][]
message
.
Processor
)
cMixHandler
.
processorMap
[
*
cid
][
"AsymmBcast"
]
=
[]
message
.
Processor
{
processor
}
const
n
=
5
const
n
=
5
cbChans
:=
make
([]
chan
[]
byte
,
n
)
cbChans
:=
make
([]
chan
[]
byte
,
n
)
clients
:=
make
([]
Channel
,
n
)
clients
:=
make
([]
Channel
,
n
)
...
...
This diff is collapsed.
Click to expand it.
broadcast/utils_test.go
+
14
−
8
View file @
3c29423c
...
@@ -8,18 +8,20 @@
...
@@ -8,18 +8,20 @@
package
broadcast
package
broadcast
import
(
import
(
"math/rand"
"sync"
"testing"
"time"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/identity/receptionID"
"gitlab.com/elixxir/client/cmix/identity/receptionID"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/client/cmix/rounds"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/crypto/signature/rsa"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"math/rand"
"sync"
"testing"
"time"
)
)
// newRsaPubKey generates a new random RSA public key for testing.
// newRsaPubKey generates a new random RSA public key for testing.
...
@@ -69,7 +71,10 @@ func (m *mockCmix) GetMaxMessageLength() int {
...
@@ -69,7 +71,10 @@ func (m *mockCmix) GetMaxMessageLength() int {
func
(
m
*
mockCmix
)
SendWithAssembler
(
recipient
*
id
.
ID
,
assembler
cmix
.
MessageAssembler
,
func
(
m
*
mockCmix
)
SendWithAssembler
(
recipient
*
id
.
ID
,
assembler
cmix
.
MessageAssembler
,
cmixParams
cmix
.
CMIXParams
)
(
id
.
Round
,
ephemeral
.
Id
,
error
)
{
cmixParams
cmix
.
CMIXParams
)
(
id
.
Round
,
ephemeral
.
Id
,
error
)
{
fingerprint
,
service
,
payload
,
mac
,
_
:=
assembler
(
42
)
fingerprint
,
service
,
payload
,
mac
,
err
:=
assembler
(
42
)
if
err
!=
nil
{
panic
(
err
)
}
msg
:=
format
.
NewMessage
(
m
.
numPrimeBytes
)
msg
:=
format
.
NewMessage
(
m
.
numPrimeBytes
)
msg
.
SetContents
(
payload
)
msg
.
SetContents
(
payload
)
...
@@ -78,6 +83,7 @@ func (m *mockCmix) SendWithAssembler(recipient *id.ID, assembler cmix.MessageAss
...
@@ -78,6 +83,7 @@ func (m *mockCmix) SendWithAssembler(recipient *id.ID, assembler cmix.MessageAss
m
.
handler
.
Lock
()
m
.
handler
.
Lock
()
defer
m
.
handler
.
Unlock
()
defer
m
.
handler
.
Unlock
()
for
_
,
p
:=
range
m
.
handler
.
processorMap
[
*
recipient
][
service
.
Tag
]
{
for
_
,
p
:=
range
m
.
handler
.
processorMap
[
*
recipient
][
service
.
Tag
]
{
p
.
Process
(
msg
,
receptionID
.
EphemeralIdentity
{},
rounds
.
Round
{})
p
.
Process
(
msg
,
receptionID
.
EphemeralIdentity
{},
rounds
.
Round
{})
}
}
...
...
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