Commit fb095f94 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bae69488
......@@ -39,12 +39,20 @@ import (
"lab.nexedi.com/kirr/go123/xsync"
)
// Verify basic M+S recovery.
func TestClusterRecoveryBasic(t *testing.T) {
Verify(t, func(t0 *tracetest.T, opt tClusterOptions) {
zback := xfs1back("../zodb/storage/fs1/testdata/1.fs")
t := tNewCluster_MS(t0, "abc1", zback, opt)
defer t.Stop()
})
}
// M drives cluster with 1 S & C through recovery -> verification -> service -> shutdown
func TestMasterStorage(t *testing.T) {
tracetest.Verify(t, tracetestMasterStorage)
Verify(t, tracetestMasterStorage)
}
func tracetestMasterStorage(t0 *tracetest.T) {
func tracetestMasterStorage(t0 *tracetest.T, opt tClusterOptions) {
X := exc.Raiseif
zback := xfs1back("../zodb/storage/fs1/testdata/1.fs")
......@@ -52,7 +60,7 @@ func tracetestMasterStorage(t0 *tracetest.T) {
lastTid, err := zstor.Sync(bg); X(err)
// create the cluster
t := tNewCluster_MS(t0, "abc1", zback, tClusterOptions{})
t := tNewCluster_MS(t0, "abc1", zback, opt)
defer t.Stop()
M := t.Master("m")
C := t.NewClient("c", "m:1")
......
......@@ -24,6 +24,7 @@ import (
"context"
"fmt"
"sync"
"testing"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet/lonet"
......@@ -385,6 +386,29 @@ func (m *tMaster) Run(ctx context.Context) error {
return m.Master.Run(ctx, l)
}
// -------
// Verify verifies f for all combinations of node kinds.
// XXX place
func Verify(t *testing.T, f func(*tracetest.T, tClusterOptions)) {
// TODO verify M=(go|py) x S=(go|py) x ...
// for now we only verify for all combinations of network
// for all networks
for _, network := range []string{"pipenet", "lonet"} {
opt := tClusterOptions{
Network: network,
}
// TODO don't pass in opt -> instead pass in T which will have .NewCluster() and use T.opt for it.
t.Run("net="+network, func (t *testing.T) {
tracetest.Verify(t, func(t *tracetest.T) {
f(t, opt)
})
})
}
}
// --------
......
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