Commit eb5eda25 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a31d9af2
...@@ -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
......
...@@ -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
} }
......
...@@ -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
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment