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
37bb05e1
Commit
37bb05e1
authored
Dec 25, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
0ee8a94f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
38 deletions
+17
-38
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+10
-38
go/neo/t_events_test.go
go/neo/t_events_test.go
+7
-0
No files found.
go/neo/t_cluster_test.go
View file @
37bb05e1
...
...
@@ -24,7 +24,6 @@ import (
"context"
"fmt"
"sync"
// "testing"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet/pipenet"
...
...
@@ -48,18 +47,9 @@ type tCluster struct {
//tpy *PyTracer // for tracing py nodes
erouter
*
EventRouter
// edispatch *tracetest.EventDispatcher
tabMu
sync
.
Mutex
nodeTab
map
[
string
/*node*/
]
*
tNode
// // checkTab keeps event checkers for the following event streams:
// // 1) events specific to a node, and
// // 2) events specific to exchange in between node1-node2 for
// // communications that originate at node1.
// //
// // NOTE that node1-node2 and node2-node1 are different and come with
// // separate event checkers.
// checkTab map[string/*node, or node1->node2*/]*tracetest.EventChecker
}
// tNode represents information about a test node ... XXX
...
...
@@ -93,16 +83,12 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
name
:
name
,
network
:
pipenet
.
New
(
"testnet"
),
// test network
nodeTab
:
make
(
map
[
string
]
*
tNode
),
// checkTab: make(map[string]*tracetest.EventChecker),
//... XXX
T
:
ttest
,
nodeTab
:
make
(
map
[
string
]
*
tNode
),
T
:
ttest
,
}
t
.
erouter
=
NewEventRouter
()
// t.edispatch = tracetest.NewEventDispatcher(t.erouter)
t
.
gotracer
=
NewTraceCollector
(
ttest
)
t
.
erouter
=
NewEventRouter
()
t
.
gotracer
=
NewTraceCollector
(
ttest
)
ttest
.
SetEventRouter
(
t
.
erouter
.
RouteEvent
)
t
.
gotracer
.
Attach
()
...
...
@@ -112,14 +98,9 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
// Stop stops the cluster.
//
// All processes of the cluster are stopped ... XXX
// XXX do we need error return?
func
(
t
*
tCluster
)
Stop
()
error
{
//... XXX
func
(
t
*
tCluster
)
Stop
()
{
t
.
gotracer
.
Detach
()
//XXX t.pytracer.Detach()
return
nil
}
// Checker returns tracechecker corresponding to name.
...
...
@@ -168,24 +149,15 @@ func (t *tCluster) registerNewNode(name string) *tNode {
panic
(
fmt
.
Sprintf
(
"test cluster: node %q registered twice"
,
name
))
}
// tracechecker for events on node
// c1 := tracetest.NewChan(name) // trace of events local to node
// trace of events local to node
t
.
erouter
.
BranchNode
(
name
,
name
)
// t.checkTab[name] = tracetest.NewEventChecker(t.TB, t.edispatch, c1)
// trace
checkers
for events on links of all node1-node2 pairs
// trace for events on links of all node1-node2 pairs
for
name2
:=
range
t
.
nodeTab
{
// trace of events with cause root being node1 -> node2 send
// c12 := tracetest.NewChan(name + "-" + name2)
// ----//---- node2 -> node1 send
// c21 := tracetest.NewChan(name2 + "-" + name)
//
// t12 := tracetest.NewEventChecker(t.TB, t.edispatch, c12)
// t21 := tracetest.NewEventChecker(t.TB, t.edispatch, c21)
// traces for events of 2 streams:
// 1) with cause root being node1 -> node2 send, and
// 2) ----//---- node1 <- node2 send.
t
.
erouter
.
BranchLink
(
name
+
"-"
+
name2
,
name
+
"-"
+
name2
,
name2
+
"-"
+
name
)
// t.checkTab[name + "-" + name2] = t12
// t.checkTab[name2 + "-" + name] = t21
}
node
:=
&
tNode
{}
...
...
go/neo/t_events_test.go
View file @
37bb05e1
...
...
@@ -152,6 +152,13 @@ func δnode(where string, laddr string, typ proto.NodeType, num int32, state pro
// EventRouter implements NEO-specific routing of events to trace test channels.
//
// A test has to define routing rules using BranchNode, BranchState and BranchLink.
//
// EventRouter maintains routes for the following event streams:
// 1) events specific to a node, and
// 2) events specific to exchange in between node1-node2 for
// communications that originate at node1.
//
// NOTE that node1-node2 and node2-node1 are different and come as separate streams.
type
EventRouter
struct
{
mu
sync
.
Mutex
...
...
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