Commit d31f1348 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7f7e2a02
......@@ -54,34 +54,81 @@ func TestMasterStorage(t *testing.T) {
Maddr := "0"
Saddr := "1"
wg := &xsync.WorkGroup{}
// start master
M := NewMaster("abc1", Maddr, net)
Mctx, Mcancel := context.WithCancel(context.Background())
wg.Gox(func() {
err := M.Run(Mctx)
_ = err // XXX
})
// expect:
// M.clusterState <- RECOVERY
// M.nodeTab <- Node(M)
// start storage
zstor := xfs1stor("../../zodb/storage/fs1/testdata/1.fs")
S := NewStorage("abc1", Maddr, Saddr, net, zstor)
Mctx, Mcancel := context.WithCancel(context.Background())
Sctx, Scancel := context.WithCancel(context.Background())
_ = Scancel;
//Mev := M.subscribe(...)
wg := &xsync.WorkGroup{}
wg.Gox(func() {
err := M.Run(Mctx)
_ = err // XXX
err := S.Run(Sctx)
_ = err // XXX
})
//ev <- Mev
//assert ev == ClusterInformation{State: RECOVERY}
// expect:
// M <- S .? RequestIdentification{...} + TODO test ID rejects
// M -> S .? AcceptIdentification{...}
// M.nodeTab <- Node(S) XXX order can be racy?
// S.nodeTab <- Node(M) XXX order can be racy?
//
// ; storCtlRecovery
// M -> S .? Recovery
// S <- M .? AnswerRecovery
//
// M -> S .? AskPartitionTable
// S <- M .? AnswerPartitionTable
// M.partTab <- ... XXX
// XXX updated something cluster currently can be operational
err := M.Start()
exc.Raiseif(err)
if false {
err := S.Run(Sctx) // XXX go
_ = err
}
// expect:
// M.clusterState <- VERIFICATION + TODO it should be sent to S
// M -> S .? LockedTransactions{}
// M <- S .? AnswerLockedTransactions{...}
// M -> S .? LastIDs{}
// M <- S .? AnswerLastIDs{...}
// + TODO S leave at verify
// + TODO S join at verify
// + TODO M.Stop() while verify
// expect:
// M.clusterState <- RUNNING + TODO it should be sent to S
// + TODO S leave while service
// + TODO S join while service
// + TODO M.Stop while service
// + TODO Client connects here ?
// TODO S.Stop() or Scancel()
// expect:
// M.nodeTab -= S
// M.clusterState <- RECOVERY
// ...
// TODO Scancel -> S down - test how M behaves
// TODO test M.recovery starting back from verification/service
// (M needs to resend to all storages recovery messages just from start)
xwait(wg)
Mcancel() // XXX temp
Scancel() // XXX temp
}
// basic interaction between Client -- Storage
......
......@@ -428,7 +428,7 @@ loop:
// check partTab is still operational
// if not -> cancel to go back to recovery
if m.partTab.OperationalWith(&m.nodeTab) {
if !m.partTab.OperationalWith(&m.nodeTab) {
vcancel()
err = errClusterDegraded
break loop
......
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