Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
6b9c53a4
Commit
6b9c53a4
authored
Dec 30, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dcdb9592
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+15
-6
No files found.
go/neo/t_cluster_test.go
View file @
6b9c53a4
...
...
@@ -60,7 +60,9 @@ type tCluster struct {
tabMu
sync
.
Mutex
nodeTab
map
[
string
/*node*/
]
*
tNode
runWG
*
xsync
.
WorkGroup
// started nodes are .Run under runWG
runCtx
context
.
Context
// runCtx is canceled on .Stop()
runWG
*
xsync
.
WorkGroup
// started nodes are .Run() under runWG
runCancel
func
()
}
...
...
@@ -109,9 +111,8 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
t
.
gotracer
.
Attach
()
runCtx
,
runCancel
:=
context
.
WithCancel
(
context
.
Background
())
t
.
runWG
=
xsync
.
NewWorkGroup
(
runCtx
)
t
.
runCancel
=
runCancel
t
.
runCtx
,
t
.
runCancel
=
context
.
WithCancel
(
context
.
Background
())
t
.
runWG
=
xsync
.
NewWorkGroup
(
t
.
runCtx
)
return
t
}
...
...
@@ -128,7 +129,10 @@ func (t *tCluster) Stop() {
if
xcontext
.
Canceled
(
err
)
{
// cancel is expected
err
=
nil
}
// XXX t.network.Close()
err2
:=
t
.
network
.
Close
()
if
err
==
nil
{
err
=
err2
}
if
err
!=
nil
{
t
.
Fatalf
(
"run shutdown: %s"
,
err
)
}
...
...
@@ -187,6 +191,11 @@ func (t *tCluster) registerNewNode(name string) *tNode {
panic
(
fmt
.
Sprintf
(
"test cluster: node %q registered twice"
,
name
))
}
host
,
err
:=
t
.
network
.
NewHost
(
t
.
runCtx
,
name
)
if
err
!=
nil
{
t
.
Fatalf
(
"register new node %q: %s"
,
name
,
err
)
}
// trace of events local to node
t
.
erouter
.
BranchNode
(
name
,
name
)
...
...
@@ -199,7 +208,7 @@ func (t *tCluster) registerNewNode(name string) *tNode {
}
node
:=
&
tNode
{}
node
.
net
=
xnet
.
NetTrace
(
t
.
network
.
Host
(
name
)
,
t
.
gotracer
)
node
.
net
=
xnet
.
NetTrace
(
host
,
t
.
gotracer
)
t
.
nodeTab
[
name
]
=
node
return
node
...
...
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