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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
eb5eda25
Commit
eb5eda25
authored
Jun 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a31d9af2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+6
-13
go/xcommon/xnet/trace.go
go/xcommon/xnet/trace.go
+3
-0
go/xcommon/xtesting/xtesting.go
go/xcommon/xtesting/xtesting.go
+3
-0
No files found.
go/neo/server/cluster_test.go
View file @
eb5eda25
...
@@ -118,7 +118,6 @@ func TestMasterStorage(t *testing.T) {
...
@@ -118,7 +118,6 @@ func TestMasterStorage(t *testing.T) {
tracer
:=
&
MyTracer
{
xtesting
.
NewSyncTracer
()}
tracer
:=
&
MyTracer
{
xtesting
.
NewSyncTracer
()}
tc
:=
xtesting
.
NewTraceChecker
(
t
,
tracer
.
SyncTracer
)
tc
:=
xtesting
.
NewTraceChecker
(
t
,
tracer
.
SyncTracer
)
//net := xnet.NetTrace(pipenet.New(""), tracer) // test network
net
:=
pipenet
.
New
(
"testnet"
)
// test network
net
:=
pipenet
.
New
(
"testnet"
)
// test network
// shortcut for addresses
// shortcut for addresses
...
@@ -136,31 +135,27 @@ func TestMasterStorage(t *testing.T) {
...
@@ -136,31 +135,27 @@ func TestMasterStorage(t *testing.T) {
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
Maddr
:=
"0"
Saddr
:=
"1"
wg
:=
&
xsync
.
WorkGroup
{}
wg
:=
&
xsync
.
WorkGroup
{}
// start master
// start master
M
:=
NewMaster
(
"abc1"
,
Maddr
,
Mhost
)
M
:=
NewMaster
(
"abc1"
,
":0"
,
Mhost
)
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
wg
.
Gox
(
func
()
{
wg
.
Gox
(
func
()
{
err
:=
M
.
Run
(
Mctx
)
err
:=
M
.
Run
(
Mctx
)
fmt
.
Println
(
"err: "
,
err
)
_
=
err
// XXX
_
=
err
// XXX
})
})
// expect:
// expect:
//tc.ExpectNetListen("0")
//tc.ExpectNetListen("0")
println
(
"111"
)
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
":0"
})
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
"0"
})
println
(
"222"
)
// M.clusterState <- RECOVERY
// M.clusterState <- RECOVERY
// M.nodeTab <- Node(M)
// M.nodeTab <- Node(M)
// start storage
// start storage
zstor
:=
xfs1stor
(
"../../zodb/storage/fs1/testdata/1.fs"
)
zstor
:=
xfs1stor
(
"../../zodb/storage/fs1/testdata/1.fs"
)
S
:=
NewStorage
(
"abc1"
,
Maddr
,
Saddr
,
Shost
,
zstor
)
S
:=
NewStorage
(
"abc1"
,
"m:0"
,
":0"
,
Shost
,
zstor
)
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
wg
.
Gox
(
func
()
{
wg
.
Gox
(
func
()
{
err
:=
S
.
Run
(
Sctx
)
err
:=
S
.
Run
(
Sctx
)
...
@@ -169,18 +164,16 @@ func TestMasterStorage(t *testing.T) {
...
@@ -169,18 +164,16 @@ func TestMasterStorage(t *testing.T) {
// expect:
// expect:
//tc.ExpectNetListen("1")
//tc.ExpectNetListen("1")
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
"
1
"
})
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
"
:0
"
})
tc
.
Expect
(
&
xnet
.
TraceDial
{
Dst
:
"0"
})
tc
.
Expect
(
&
xnet
.
TraceDial
{
Dst
:
"
m:
0"
})
//tc.ExpectNetDial("0")
//tc.ExpectNetDial("0")
println
(
"333"
)
tc
.
ExpectPar
(
tc
.
ExpectPar
(
nettx
(
"s:1"
,
"m:1"
,
"
\x00\x00\x00\x01
"
),
// handshake
nettx
(
"s:1"
,
"m:1"
,
"
\x00\x00\x00\x01
"
),
// handshake
nettx
(
"m:1"
,
"s:1"
,
"
\x00\x00\x00\x01
"
),
nettx
(
"m:1"
,
"s:1"
,
"
\x00\x00\x00\x01
"
),
)
)
println
(
"444"
)
// XXX temp
// XXX temp
...
...
go/xcommon/xnet/trace.go
View file @
eb5eda25
...
@@ -49,17 +49,20 @@ type Tracer interface {
...
@@ -49,17 +49,20 @@ type Tracer interface {
// TraceDial is event corresponding to network dialing
// TraceDial is event corresponding to network dialing
type
TraceDial
struct
{
type
TraceDial
struct
{
// XXX also put networker?
// XXX also put Src here somehow ?
// XXX also put Src here somehow ?
Dst
string
Dst
string
}
}
// TraceListen is event corresponding to network listening
// TraceListen is event corresponding to network listening
type
TraceListen
struct
{
type
TraceListen
struct
{
// XXX also put networker?
Laddr
string
Laddr
string
}
}
// TraceTx is event corresponding to network transmission
// TraceTx is event corresponding to network transmission
type
TraceTx
struct
{
type
TraceTx
struct
{
// XXX also put network somehow?
Src
,
Dst
net
.
Addr
Src
,
Dst
net
.
Addr
Pkt
[]
byte
Pkt
[]
byte
}
}
...
...
go/xcommon/xtesting/xtesting.go
View file @
eb5eda25
...
@@ -60,6 +60,9 @@ func (st *SyncTracer) Trace1(event interface{}) {
...
@@ -60,6 +60,9 @@ func (st *SyncTracer) Trace1(event interface{}) {
// The consumer, after dealing with the message, must send back an ack.
// The consumer, after dealing with the message, must send back an ack.
func
(
st
*
SyncTracer
)
Get1
()
*
SyncTraceMsg
{
func
(
st
*
SyncTracer
)
Get1
()
*
SyncTraceMsg
{
return
<-
st
.
tracech
return
<-
st
.
tracech
//msg := <-st.tracech
//fmt.Printf("trace: get1: %T %v\n", msg.Event, msg.Event)
//return msg
}
}
...
...
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