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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
b64155f9
Commit
b64155f9
authored
Apr 15, 2022
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
clean up e2e manager partner
parent
2773031b
No related branches found
No related tags found
3 merge requests
!510
Release
,
!207
WIP: Client Restructure
,
!203
Symmetric broadcast
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
e2e/ratchet/partner/manager_test.go
+1
-65
1 addition, 65 deletions
e2e/ratchet/partner/manager_test.go
with
1 addition
and
65 deletions
e2e/ratchet/partner/manager_test.go
+
1
−
65
View file @
b64155f9
...
@@ -9,7 +9,6 @@ package partner
...
@@ -9,7 +9,6 @@ package partner
import
(
import
(
"bytes"
"bytes"
"encoding/base64"
"math/rand"
"math/rand"
"reflect"
"reflect"
"testing"
"testing"
...
@@ -23,7 +22,6 @@ import (
...
@@ -23,7 +22,6 @@ import (
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
"golang.org/x/crypto/blake2b"
)
)
// Tests happy path of newManager.
// Tests happy path of newManager.
...
@@ -336,73 +334,11 @@ func TestManager_TriggerNegotiations(t *testing.T) {
...
@@ -336,73 +334,11 @@ func TestManager_TriggerNegotiations(t *testing.T) {
}
}
}
}
// Unit test of Manager.GetRelationshipFingerprint.
func
TestManager_GetRelationshipFingerprint
(
t
*
testing
.
T
)
{
m
,
_
:=
newTestManager
(
t
)
m
.
receive
.
fingerprint
=
[]
byte
{
5
}
m
.
send
.
fingerprint
=
[]
byte
{
10
}
h
,
_
:=
blake2b
.
New256
(
nil
)
h
.
Write
(
append
(
m
.
receive
.
fingerprint
,
m
.
send
.
fingerprint
...
))
expected
:=
base64
.
StdEncoding
.
EncodeToString
(
h
.
Sum
(
nil
))[
:
relationshipFpLength
]
fp
:=
m
.
ConnectionFingerprint
()
if
fp
!=
expected
{
t
.
Errorf
(
"ConnectionFingerprint did not return the expected "
+
"fingerprint.
\n
expected: %s
\n
received: %s"
,
expected
,
fp
)
}
// Flip the order and show that the output is the same.
m
.
receive
.
fingerprint
,
m
.
send
.
fingerprint
=
m
.
send
.
fingerprint
,
m
.
receive
.
fingerprint
fp
=
m
.
ConnectionFingerprint
()
if
fp
!=
expected
{
t
.
Errorf
(
"ConnectionFingerprint did not return the expected "
+
"fingerprint.
\n
expected: %s
\n
received: %s"
,
expected
,
fp
)
}
}
// Tests the consistency of the output of Manager.GetRelationshipFingerprint.
func
TestManager_GetRelationshipFingerprint_Consistency
(
t
*
testing
.
T
)
{
m
,
_
:=
newTestManager
(
t
)
prng
:=
rand
.
New
(
rand
.
NewSource
(
42
))
expectedFps
:=
[]
string
{
"GmeTCfxGOqRqeID"
,
"gbpJjHd3tIe8BKy"
,
"2/ZdG+WNzODJBiF"
,
"+V1ySeDLQfQNSkv"
,
"23OMC+rBmCk+gsu"
,
"qHu5MUVs83oMqy8"
,
"kuXqxsezI0kS9Bc"
,
"SlEhsoZ4BzAMTtr"
,
"yG8m6SPQfV/sbTR"
,
"j01ZSSm762TH7mj"
,
"SKFDbFvsPcohKPw"
,
"6JB5HK8DHGwS4uX"
,
"dU3mS1ujduGD+VY"
,
"BDXAy3trbs8P4mu"
,
"I4HoXW45EwWR0oD"
,
"661YH2l2jfOkHbA"
,
"cSS9ZyTOQKVx67a"
,
"ojfubzDIsMNYc/t"
,
"2WrEw83Yz6Rhq9I"
,
"TQILxBIUWMiQS2j"
,
"rEqdieDTXJfCQ6I"
,
}
for
i
,
expected
:=
range
expectedFps
{
prng
.
Read
(
m
.
receive
.
fingerprint
)
prng
.
Read
(
m
.
send
.
fingerprint
)
fp
:=
m
.
ConnectionFingerprint
()
if
fp
!=
expected
{
t
.
Errorf
(
"ConnectionFingerprint did not return the expected "
+
"fingerprint (%d).
\n
expected: %s
\n
received: %s"
,
i
,
expected
,
fp
)
}
// Flip the order and show that the output is the same.
m
.
receive
.
fingerprint
,
m
.
send
.
fingerprint
=
m
.
send
.
fingerprint
,
m
.
receive
.
fingerprint
fp
=
m
.
ConnectionFingerprint
()
if
fp
!=
expected
{
t
.
Errorf
(
"ConnectionFingerprint did not return the expected "
+
"fingerprint (%d).
\n
expected: %s
\n
received: %s"
,
i
,
expected
,
fp
)
}
// fmt.Printf("\"%s\",\n", fp) // Uncomment to reprint expected values
}
}
func
TestManager_MakeService
(
t
*
testing
.
T
)
{
func
TestManager_MakeService
(
t
*
testing
.
T
)
{
m
,
_
:=
newTestManager
(
t
)
m
,
_
:=
newTestManager
(
t
)
tag
:=
"hunter2"
tag
:=
"hunter2"
expected
:=
message
.
Service
{
expected
:=
message
.
Service
{
Identifier
:
m
.
ConnectionFingerprintBytes
(),
Identifier
:
m
.
ConnectionFingerprint
()
.
Bytes
(),
Tag
:
tag
,
Tag
:
tag
,
Metadata
:
m
.
partner
[
:
],
Metadata
:
m
.
partner
[
:
],
}
}
...
...
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