Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Levin Zimmermann
neoppod
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) {
tracer
:=
&
MyTracer
{
xtesting
.
NewSyncTracer
()}
tc
:=
xtesting
.
NewTraceChecker
(
t
,
tracer
.
SyncTracer
)
//net := xnet.NetTrace(pipenet.New(""), tracer) // test network
net
:=
pipenet
.
New
(
"testnet"
)
// test network
// shortcut for addresses
...
...
@@ -136,31 +135,27 @@ func TestMasterStorage(t *testing.T) {
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
Maddr
:=
"0"
Saddr
:=
"1"
wg
:=
&
xsync
.
WorkGroup
{}
// start master
M
:=
NewMaster
(
"abc1"
,
Maddr
,
Mhost
)
M
:=
NewMaster
(
"abc1"
,
":0"
,
Mhost
)
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
wg
.
Gox
(
func
()
{
err
:=
M
.
Run
(
Mctx
)
fmt
.
Println
(
"err: "
,
err
)
_
=
err
// XXX
})
// expect:
//tc.ExpectNetListen("0")
println
(
"111"
)
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
"0"
})
println
(
"222"
)
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
":0"
})
// M.clusterState <- RECOVERY
// M.nodeTab <- Node(M)
// start storage
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
())
wg
.
Gox
(
func
()
{
err
:=
S
.
Run
(
Sctx
)
...
...
@@ -169,18 +164,16 @@ func TestMasterStorage(t *testing.T) {
// expect:
//tc.ExpectNetListen("1")
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
"
1
"
})
tc
.
Expect
(
&
xnet
.
TraceDial
{
Dst
:
"0"
})
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
"
:0
"
})
tc
.
Expect
(
&
xnet
.
TraceDial
{
Dst
:
"
m:
0"
})
//tc.ExpectNetDial("0")
println
(
"333"
)
tc
.
ExpectPar
(
nettx
(
"s:1"
,
"m:1"
,
"
\x00\x00\x00\x01
"
),
// handshake
nettx
(
"m:1"
,
"s:1"
,
"
\x00\x00\x00\x01
"
),
)
println
(
"444"
)
// XXX temp
...
...
go/xcommon/xnet/trace.go
View file @
eb5eda25
...
...
@@ -49,17 +49,20 @@ type Tracer interface {
// TraceDial is event corresponding to network dialing
type
TraceDial
struct
{
// XXX also put networker?
// XXX also put Src here somehow ?
Dst
string
}
// TraceListen is event corresponding to network listening
type
TraceListen
struct
{
// XXX also put networker?
Laddr
string
}
// TraceTx is event corresponding to network transmission
type
TraceTx
struct
{
// XXX also put network somehow?
Src
,
Dst
net
.
Addr
Pkt
[]
byte
}
...
...
go/xcommon/xtesting/xtesting.go
View file @
eb5eda25
...
...
@@ -60,6 +60,9 @@ func (st *SyncTracer) Trace1(event interface{}) {
// The consumer, after dealing with the message, must send back an ack.
func
(
st
*
SyncTracer
)
Get1
()
*
SyncTraceMsg
{
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