Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-flow-metrics
Commits
e5a6a4db
Unverified
Commit
e5a6a4db
authored
Nov 08, 2019
by
Steven Allen
Committed by
GitHub
Nov 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12 from libp2p/test/issue-65
regression test for issue-65
parents
c3ecce9c
237035be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
sweeper_test.go
sweeper_test.go
+44
-0
No files found.
sweeper_test.go
0 → 100644
View file @
e5a6a4db
package
flow
import
(
"testing"
"time"
)
// regression test for libp2p/go-libp2p-core#65
func
TestIdleInconsistency
(
t
*
testing
.
T
)
{
r
:=
new
(
MeterRegistry
)
m1
:=
r
.
Get
(
"first"
)
m2
:=
r
.
Get
(
"second"
)
m3
:=
r
.
Get
(
"third"
)
m1
.
Mark
(
10
)
m2
.
Mark
(
20
)
m3
.
Mark
(
30
)
// make m1 and m3 go idle
for
i
:=
0
;
i
<
30
;
i
++
{
time
.
Sleep
(
time
.
Second
)
m2
.
Mark
(
1
)
}
time
.
Sleep
(
time
.
Second
)
// re-activate m3
m3
.
Mark
(
20
)
time
.
Sleep
(
time
.
Second
+
time
.
Millisecond
)
// check the totals
if
total
:=
r
.
Get
(
"first"
)
.
Snapshot
()
.
Total
;
total
!=
10
{
t
.
Errorf
(
"expected first total to be 10, got %d"
,
total
)
}
if
total
:=
r
.
Get
(
"second"
)
.
Snapshot
()
.
Total
;
total
!=
50
{
t
.
Errorf
(
"expected second total to be 50, got %d"
,
total
)
}
if
total
:=
r
.
Get
(
"third"
)
.
Snapshot
()
.
Total
;
total
!=
50
{
t
.
Errorf
(
"expected third total to be 50, got %d"
,
total
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment