Commit 6e1926c0 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4bcf4809
...@@ -71,6 +71,8 @@ func tracetestMasterStorage(t0 *tracetest.T) { ...@@ -71,6 +71,8 @@ func tracetestMasterStorage(t0 *tracetest.T) {
// ---------------------------------------- // ----------------------------------------
// XXX convert prologue to tStartSimpleNEOGoSrv (XXX naming)
// M starts listening // M starts listening
tM.Expect(netlisten("m:1")) tM.Expect(netlisten("m:1"))
tM.Expect(δnode("m", "m:1", proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone)) tM.Expect(δnode("m", "m:1", proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone))
...@@ -425,11 +427,11 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f ...@@ -425,11 +427,11 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f
t := tStartSimpleNEOGoSrv("abc1", zback) t := tStartSimpleNEOGoSrv("abc1", zback)
defer t.Stop() defer t.Stop()
/*
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel()
/*
wg := xsync.NewWorkGroup(ctx) wg := xsync.NewWorkGroup(ctx)
defer wg.Wait() defer wg.Wait()
defer cancel()
// spawn M // spawn M
M := tNewMaster("abc1", "", Mnet) M := tNewMaster("abc1", "", Mnet)
...@@ -481,9 +483,8 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f ...@@ -481,9 +483,8 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f
t.TraceOff() t.TraceOff()
err := M.Start(); t.FatalIf(err) err := M.Start(); t.FatalIf(err)
// if err != nil {
// b.Fatal(err) C := t.NewClient("c", "m:1") // XXX better use M.Addr() ?
// }
xid1 := zodb.Xid{Oid: 1, At: zodb.TidMax} xid1 := zodb.Xid{Oid: 1, At: zodb.TidMax}
......
...@@ -300,30 +300,32 @@ func (m *tMaster) Run(ctx context.Context) error { ...@@ -300,30 +300,32 @@ func (m *tMaster) Run(ctx context.Context) error {
// tStartSimpleNEOGoSrv starts simple NEO/go server with 1 master and 1 storage. // tStartSimpleNEOGoSrv starts simple NEO/go server with 1 master and 1 storage.
// The cluster is returned in ready-to-start. // The cluster is returned in ready-to-start.
func tStartSimpleNEOGoSrv(name string, Sback storage.Backend) *tCluster { //
t := tNewCluster(name) // XXX naming -> tStartSimpleClusterMS ?
func tStartSimpleNEOGoSrv(t0 *tracetest.T, name string, Sback storage.Backend) *tCluster {
t := tNewCluster(t0, name)
M := t.NewMaster("m") M := t.NewMaster("m")
// XXX if we would always use lonet or pipenet - all network addresses would be predictable // XXX if we would always use lonet or pipenet - all network addresses would be predictable
// M starts listening - determine its listen address // M starts listening
t.Expect("m", netlisten("xxx")) // XXX xxx will be the address t.Expect("m", netlisten("m:1"))
t.Expect("m", δnode("m", Maddr, proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone)) t.Expect("m", δnode("m", "m:1", proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone))
t.Expect("m", clusterState("m", proto.ClusterRecovering)) t.Expect("m", clusterState("m", proto.ClusterRecovering))
S := t.NewStorage("s", Maddr, Sback) S := t.NewStorage("s", "m:1", Sback)
// S starts listening // S starts listening
t.Expect("s", netlisten("yyy")) // XXX yyy will be the address t.Expect("s", netlisten("s:1"))
// S connects to M // S connects to M
t.Expect("s-m", netdial("s", Maddr)) t.Expect("s-m", netdial("s", "m:1"))
t.Expect("s-m", netconnect("sXXX", "mYYY", Maddr)) t.Expect("s-m", netconnect("s:2", "m:2", "m:1"))
t.Expect("s-m", conntx("s:2", "m:2", 1, &proto.RequestIdentification{ t.Expect("s-m", conntx("s:2", "m:2", 1, &proto.RequestIdentification{
NodeType: proto.STORAGE, NodeType: proto.STORAGE,
UUID: 0, UUID: 0,
Address: xnaddr("s:1"), Address: xnaddr("s:1"),
ClusterName: "abc1", ClusterName: name,
IdTime: proto.IdTimeNone, IdTime: proto.IdTimeNone,
DevPath: nil, DevPath: nil,
NewNID: nil, NewNID: nil,
...@@ -356,10 +358,5 @@ func tStartSimpleNEOGoSrv(name string, Sback storage.Backend) *tCluster { ...@@ -356,10 +358,5 @@ func tStartSimpleNEOGoSrv(name string, Sback storage.Backend) *tCluster {
// M ready to start: new cluster, no in-progress S recovery // M ready to start: new cluster, no in-progress S recovery
t.Expect("m", masterStartReady("m", true)) t.Expect("m", masterStartReady("m", true))
err := M.Start()
if err != nil {
t.Fatal(err)
}
return t return t
} }
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