Commit e9e3ca34 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6b724502
......@@ -65,14 +65,6 @@ func _TestMasterStorage(t0 *tEnv) {
M := t.Master("m")
C := t.NewClient("c", "m:1")
tM := t.Checker("m")
tC := t.Checker("c")
tMS := t.Checker("m-s")
tCM := t.Checker("c-m")
tMC := t.Checker("m-c")
tCS := t.Checker("c-s")
// TODO create C; C tries connect to master - rejected ("not yet operational")
// TODO test ID rejects (nid already registered, ...)
......@@ -97,9 +89,9 @@ func _TestMasterStorage(t0 *tEnv) {
// XXX M.partTab <- S1
// M starts verification
tM.Expect(clusterState("m", proto.ClusterVerifying))
t.Expect("m", clusterState("m", proto.ClusterVerifying))
tMS.Expect(conntx("m:2", "s:2", 8, &proto.SendPartitionTable{
t.Expect("m-s", conntx("m:2", "s:2", 8, &proto.SendPartitionTable{
PTid: 1,
NumReplicas: 0,
RowList: []proto.RowInfo{
......@@ -107,14 +99,14 @@ func _TestMasterStorage(t0 *tEnv) {
},
}))
tMS.Expect(conntx("m:2", "s:2", 10, &proto.LockedTransactions{}))
tMS.Expect(conntx("s:2", "m:2", 10, &proto.AnswerLockedTransactions{
t.Expect("m-s", conntx("m:2", "s:2", 10, &proto.LockedTransactions{}))
t.Expect("m-s", conntx("s:2", "m:2", 10, &proto.AnswerLockedTransactions{
TidDict: nil, // map[zodb.Tid]zodb.Tid{},
}))
lastOid, err := zstor.LastOid(bg); X(err)
tMS.Expect(conntx("m:2", "s:2", 12, &proto.LastIDs{}))
tMS.Expect(conntx("s:2", "m:2", 12, &proto.AnswerLastIDs{
t.Expect("m-s", conntx("m:2", "s:2", 12, &proto.LastIDs{}))
t.Expect("m-s", conntx("s:2", "m:2", 12, &proto.AnswerLastIDs{
LastOid: lastOid,
LastTid: lastTid,
}))
......@@ -127,11 +119,11 @@ func _TestMasterStorage(t0 *tEnv) {
// TODO M.Stop() while verify
// verification ok; M start service
tM.Expect(clusterState("m", proto.ClusterRunning))
t.Expect("m", clusterState("m", proto.ClusterRunning))
// TODO ^^^ should be sent to S
tMS.Expect(conntx("m:2", "s:2", 14, &proto.StartOperation{Backup: false}))
tMS.Expect(conntx("s:2", "m:2", 14, &proto.NotifyReady{}))
t.Expect("m-s", conntx("m:2", "s:2", 14, &proto.StartOperation{Backup: false}))
t.Expect("m-s", conntx("s:2", "m:2", 14, &proto.NotifyReady{}))
// TODO S leave while service
// TODO S join while service
......@@ -142,9 +134,9 @@ func _TestMasterStorage(t0 *tEnv) {
// trace of client start
// C connects M
tCM.Expect(netdial("c", "m:1"))
tCM.Expect(netconnect("c:1", "m:3", "m:1"))
tCM.Expect(conntx("c:1", "m:3", 1, &proto.RequestIdentification{
t.Expect("c-m", netdial("c", "m:1"))
t.Expect("c-m", netconnect("c:1", "m:3", "m:1"))
t.Expect("c-m", conntx("c:1", "m:3", 1, &proto.RequestIdentification{
NodeType: proto.CLIENT,
NID: proto.NID(proto.CLIENT, 0),
Address: xnaddr(""),
......@@ -154,16 +146,16 @@ func _TestMasterStorage(t0 *tEnv) {
NewNID: nil,
}))
tM.Expect(δnode("m", "", proto.CLIENT, 1, proto.RUNNING, 0.02))
t.Expect("m", δnode("m", "", proto.CLIENT, 1, proto.RUNNING, 0.02))
tCM.Expect(conntx("m:3", "c:1", 1, &proto.AcceptIdentification{
t.Expect("c-m", conntx("m:3", "c:1", 1, &proto.AcceptIdentification{
NodeType: proto.MASTER,
MyNID: proto.NID(proto.MASTER, 1),
YourNID: proto.NID(proto.CLIENT, 1),
}))
// C <- M NotifyNodeInformation C1,M1,S1
tMC.Expect(conntx("m:3", "c:1", 0, &proto.NotifyNodeInformation{
// C <- M NotifyNodeInformation M1,S1,C1
t.Expect("m-c", conntx("m:3", "c:1", 0, &proto.NotifyNodeInformation{
IdTime: proto.IdTimeNone, // XXX ?
NodeList: []proto.NodeInfo{
nodei("m:1", proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone),
......@@ -172,7 +164,7 @@ func _TestMasterStorage(t0 *tEnv) {
},
}))
tMC.Expect(conntx("m:3", "c:1", 2, &proto.SendPartitionTable{
t.Expect("m-c", conntx("m:3", "c:1", 2, &proto.SendPartitionTable{
PTid: 1,
NumReplicas: 0,
RowList: []proto.RowInfo{
......@@ -180,13 +172,22 @@ func _TestMasterStorage(t0 *tEnv) {
},
}))
tC.Expect(δnode("c", "m:1", proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone))
tC.Expect(δnode("c", "s:1", proto.STORAGE, 1, proto.RUNNING, 0.01))
tC.Expect(δnode("c", "", proto.CLIENT, 1, proto.RUNNING, 0.02))
t.Expect("c", δnode("c", "m:1", proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone))
t.Expect("c", δnode("c", "s:1", proto.STORAGE, 1, proto.RUNNING, 0.01))
t.Expect("c", δnode("c", "", proto.CLIENT, 1, proto.RUNNING, 0.02))
// S <- M NotifyNodeInformation C1
t.Expect("m-s", conntx("m:2", "s:2", 16, &proto.NotifyNodeInformation{
IdTime: proto.IdTimeNone, // XXX ?
NodeList: []proto.NodeInfo{
nodei("", proto.CLIENT, 1, proto.RUNNING, 0.02),
},
}))
t.Expect("s", δnode("s", "", proto.CLIENT, 1, proto.RUNNING, 0.02))
// C asks M last_tid
tCM.Expect(conntx("c:1", "m:3", 3, &proto.LastTransaction{}))
tCM.Expect(conntx("m:3", "c:1", 3, &proto.AnswerLastTransaction{lastTid}))
t.Expect("c-m", conntx("c:1", "m:3", 3, &proto.LastTransaction{}))
t.Expect("c-m", conntx("m:3", "c:1", 3, &proto.AnswerLastTransaction{lastTid}))
// ----------------------------------------
......@@ -200,8 +201,8 @@ func _TestMasterStorage(t0 *tEnv) {
}
})
tCM.Expect(conntx("c:1", "m:3", 5, &proto.LastTransaction{}))
tCM.Expect(conntx("m:3", "c:1", 5, &proto.AnswerLastTransaction{lastTid}))
t.Expect("c-m", conntx("c:1", "m:3", 5, &proto.LastTransaction{}))
t.Expect("c-m", conntx("m:3", "c:1", 5, &proto.AnswerLastTransaction{lastTid}))
xwait(wg)
......@@ -223,9 +224,9 @@ func _TestMasterStorage(t0 *tEnv) {
// trace
// ... -> connects to S
tCS.Expect(netdial("c", "s:1"))
tCS.Expect(netconnect("c:2", "s:3", "s:1"))
tCS.Expect(conntx("c:2", "s:3", 1, &proto.RequestIdentification{
t.Expect("c-s", netdial("c", "s:1"))
t.Expect("c-s", netconnect("c:2", "s:3", "s:1"))
t.Expect("c-s", conntx("c:2", "s:3", 1, &proto.RequestIdentification{
NodeType: proto.CLIENT,
NID: proto.NID(proto.CLIENT, 1),
Address: xnaddr(""),
......@@ -235,19 +236,19 @@ func _TestMasterStorage(t0 *tEnv) {
NewNID: nil,
}))
tCS.Expect(conntx("s:3", "c:2", 1, &proto.AcceptIdentification{
t.Expect("c-s", conntx("s:3", "c:2", 1, &proto.AcceptIdentification{
NodeType: proto.STORAGE,
MyNID: proto.NID(proto.STORAGE, 1),
YourNID: proto.NID(proto.CLIENT, 1),
}))
// ... -> GetObject(xid1)
tCS.Expect(conntx("c:2", "s:3", 3, &proto.GetObject{
t.Expect("c-s", conntx("c:2", "s:3", 3, &proto.GetObject{
Oid: xid1.Oid,
Before: xzodb.At2Before(xid1.At),
At: proto.INVALID_TID,
}))
tCS.Expect(conntx("s:3", "c:2", 3, &proto.AnswerObject{
t.Expect("c-s", conntx("s:3", "c:2", 3, &proto.AnswerObject{
Oid: xid1.Oid,
Serial: serial1,
NextSerial: proto.INVALID_TID,
......@@ -277,12 +278,12 @@ func _TestMasterStorage(t0 *tEnv) {
})
// ... -> GetObject(xid1prev)
tCS.Expect(conntx("c:2", "s:3", 5, &proto.GetObject{
t.Expect("c-s", conntx("c:2", "s:3", 5, &proto.GetObject{
Oid: xid1prev.Oid,
Before: serial1,
At: proto.INVALID_TID,
}))
tCS.Expect(conntx("s:3", "c:2", 5, &proto.AnswerObject{
t.Expect("c-s", conntx("s:3", "c:2", 5, &proto.AnswerObject{
Oid: xid1prev.Oid,
Serial: serial1prev,
NextSerial: serial1,
......
......@@ -154,6 +154,7 @@ func (t0 *tEnv) NewCluster(name string) *tCluster {
func (t *tCluster) Stop() {
t.Helper()
t.TraceOff()
t.Done()
t.runCancel()
err := t.runWG.Wait()
......@@ -183,6 +184,7 @@ func (t *tCluster) TraceOff() {
}
}
/*
// Checker returns tracechecker corresponding to name.
//
// name might be of "node" or "node1-node2" kind. XXX more text
......@@ -201,6 +203,7 @@ func (c *tStreamChecker) Expect(event interface{}) {
c.t.Helper()
c.t.Expect(c.stream, event)
}
*/
// registerNewNode registers new node with given name.
//
......@@ -447,6 +450,7 @@ func (t0 *tEnv) NewCluster_MS(name string, Sback storage.Backend) *tCluster {
}))
// M sends nodeTab to S
// XXX notifications should go to "m-s/notify" ?
t.Expect("m-s", conntx("m:2", "s:2", 0, &proto.NotifyNodeInformation{
IdTime: proto.IdTimeNone, // XXX ?
NodeList: []proto.NodeInfo{
......
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