good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
open
bor
Commits
6167dd65
Commit
6167dd65
authored
Jan 24, 2019
by
Ferenc Szabo
Committed by
Anton Evangelatov
Jan 24, 2019
Browse files
Options
Downloads
Patches
Plain Diff
swarm/pss: fix data race in notify_test.go (TestStart) (#18518)
parent
684faced
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
swarm/pss/notify/notify_test.go
+11
-4
11 additions, 4 deletions
swarm/pss/notify/notify_test.go
with
11 additions
and
4 deletions
swarm/pss/notify/notify_test.go
+
11
−
4
View file @
6167dd65
...
@@ -128,7 +128,7 @@ func TestStart(t *testing.T) {
...
@@ -128,7 +128,7 @@ func TestStart(t *testing.T) {
defer
rightSub
.
Unsubscribe
()
defer
rightSub
.
Unsubscribe
()
updateC
:=
make
(
chan
[]
byte
)
updateC
:=
make
(
chan
[]
byte
)
updateMsg
:=
[]
byte
{}
var
updateMsg
[]
byte
ctrlClient
:=
NewController
(
psses
[
rightPub
])
ctrlClient
:=
NewController
(
psses
[
rightPub
])
ctrlNotifier
:=
NewController
(
psses
[
leftPub
])
ctrlNotifier
:=
NewController
(
psses
[
leftPub
])
ctrlNotifier
.
NewNotifier
(
"foo.eth"
,
2
,
updateC
)
ctrlNotifier
.
NewNotifier
(
"foo.eth"
,
2
,
updateC
)
...
@@ -145,17 +145,24 @@ func TestStart(t *testing.T) {
...
@@ -145,17 +145,24 @@ func TestStart(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
copyOfUpdateMsg
:=
make
([]
byte
,
len
(
updateMsg
))
copy
(
copyOfUpdateMsg
,
updateMsg
)
ctrlClientError
:=
make
(
chan
error
,
1
)
ctrlClient
.
Subscribe
(
rsrcName
,
pubkey
,
addrbytes
,
func
(
s
string
,
b
[]
byte
)
error
{
ctrlClient
.
Subscribe
(
rsrcName
,
pubkey
,
addrbytes
,
func
(
s
string
,
b
[]
byte
)
error
{
if
s
!=
"foo.eth"
||
!
bytes
.
Equal
(
u
pdateMsg
,
b
)
{
if
s
!=
"foo.eth"
||
!
bytes
.
Equal
(
copyOfU
pdateMsg
,
b
)
{
t
.
Fatal
f
(
"unexpected result in client handler: '%s':'%x'"
,
s
,
b
)
ctrlClientError
<-
fmt
.
Error
f
(
"unexpected result in client handler: '%s':'%x'"
,
s
,
b
)
}
}
else
{
log
.
Info
(
"client handler receive"
,
"s"
,
s
,
"b"
,
b
)
log
.
Info
(
"client handler receive"
,
"s"
,
s
,
"b"
,
b
)
}
return
nil
return
nil
})
})
var
inMsg
*
pss
.
APIMsg
var
inMsg
*
pss
.
APIMsg
select
{
select
{
case
inMsg
=
<-
rmsgC
:
case
inMsg
=
<-
rmsgC
:
case
err
:=
<-
ctrlClientError
:
t
.
Fatal
(
err
)
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
ctx
.
Err
())
t
.
Fatal
(
ctx
.
Err
())
}
}
...
...
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