Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goshimmer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
iota-imt
goshimmer
Commits
907689f0
Commit
907689f0
authored
4 years ago
by
capossele
Browse files
Options
Downloads
Patches
Plain Diff
improves dRNG integration test
parent
8745a15e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/integration-tests/tester/framework/framework.go
+7
-0
7 additions, 0 deletions
tools/integration-tests/tester/framework/framework.go
tools/integration-tests/tester/tests/drng_test.go
+14
-7
14 additions, 7 deletions
tools/integration-tests/tester/tests/drng_test.go
with
21 additions
and
7 deletions
tools/integration-tests/tester/framework/framework.go
+
7
−
0
View file @
907689f0
...
...
@@ -153,5 +153,12 @@ func (f *Framework) CreateDRNGNetwork(name string, members, peers int) (*DRNGNet
}
}
// wait until peers are fully started and connected
time
.
Sleep
(
1
*
time
.
Second
)
err
=
drng
.
network
.
WaitForAutopeering
(
3
)
if
err
!=
nil
{
return
nil
,
err
}
return
drng
,
nil
}
This diff is collapsed.
Click to expand it.
tools/integration-tests/tester/tests/drng_test.go
+
14
−
7
View file @
907689f0
package
tests
import
(
"encoding/hex"
"log"
"testing"
"time"
...
...
@@ -17,22 +18,28 @@ func TestDRNG(t *testing.T) {
// wait for randomness generation to be started
log
.
Printf
(
"Waiting for randomness generation to be started...
\n
"
)
time
.
Sleep
(
7
0
*
time
.
Second
)
time
.
Sleep
(
10
0
*
time
.
Second
)
peers
:=
len
(
drng
.
Peers
())
randomnessMap
:=
make
(
map
[
string
]
int
)
// check for randomness on every peer
for
i
:=
0
;
i
<
3
;
i
++
{
randomness
:=
make
([][]
byte
,
peers
)
for
j
,
peer
:=
range
drng
.
Peers
()
{
for
_
,
peer
:=
range
drng
.
Peers
()
{
resp
,
err
:=
peer
.
GetRandomness
()
require
.
NoError
(
t
,
err
)
log
.
Println
(
resp
)
randomness
[
j
]
=
resp
.
Randomness
}
for
i
:=
1
;
i
<
peers
;
i
++
{
require
.
Equal
(
t
,
randomness
[
0
],
randomness
[
i
])
randomnessMap
[
hex
.
EncodeToString
(
resp
.
Randomness
)]
++
}
// wait for the next randomness
time
.
Sleep
(
10
*
time
.
Second
)
}
// check that we got at least 3 different random values
require
.
GreaterOrEqual
(
t
,
len
(
randomnessMap
),
3
)
// check that each random values has been received by all the peers.
for
_
,
v
:=
range
randomnessMap
{
require
.
GreaterOrEqual
(
t
,
v
,
peers
)
}
}
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