Commit 5c4b5fea authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3d31d3c1
...@@ -176,13 +176,20 @@ func nodeLinkPipe() (nl1, nl2 *NodeLink) { ...@@ -176,13 +176,20 @@ func nodeLinkPipe() (nl1, nl2 *NodeLink) {
// XXX temp for cluster_test.go // XXX temp for cluster_test.go
var NodeLinkPipe = nodeLinkPipe var NodeLinkPipe = nodeLinkPipe
func gox(wg *errgroup.Group, f func()) {
wg.Go(exc.Runx(f))
}
func TestNodeLink(t *testing.T) { func TestNodeLink(t *testing.T) {
// TODO catch exception -> add proper location from it -> t.Fatal (see git-backup) // TODO catch exception -> add proper location from it -> t.Fatal (see git-backup)
// Close vs recvPkt // Close vs recvPkt
nl1, nl2 := _nodeLinkPipe(linkNoRecvSend, linkNoRecvSend) nl1, nl2 := _nodeLinkPipe(linkNoRecvSend, linkNoRecvSend)
wg := WorkGroup() //wg := WorkGroup()
wg.Gox(func() { //wg.Gox(func() {
wg := &errgroup.Group{}
wg := &xsync.ErrGroup{}
gox(wg, func() {
tdelay() tdelay()
xclose(nl1) xclose(nl1)
}) })
......
...@@ -15,22 +15,21 @@ ...@@ -15,22 +15,21 @@
// //
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
package neo_test package server
// test interaction between nodes // test interaction between nodes
import ( import (
"bytes" //"bytes"
"context" "context"
"io" //"io"
"reflect" //"reflect"
"testing" "testing"
. "../neo" "../../neo"
"../neo/client" //"../../neo/client"
"../neo/server"
"../zodb" //"../../zodb"
"../zodb/storage/fs1" "../../zodb/storage/fs1"
"lab.nexedi.com/kirr/go123/exc" "lab.nexedi.com/kirr/go123/exc"
) )
...@@ -49,14 +48,14 @@ func xfs1stor(path string) *fs1.FileStorage { ...@@ -49,14 +48,14 @@ func xfs1stor(path string) *fs1.FileStorage {
// M drives cluster with 1 S through recovery -> verification -> service -> shutdown // M drives cluster with 1 S through recovery -> verification -> service -> shutdown
func TestMasterStorage(t *testing.T) { func TestMasterStorage(t *testing.T) {
net := NetPipe("") // test network net := neo.NetPipe("") // test network
Maddr := "0" Maddr := "0"
Saddr := "1" Saddr := "1"
M := server.NewMaster("abc1", Maddr, net) M := NewMaster("abc1", Maddr, net)
zstor := xfs1stor("../zodb/storage/fs1/testdata/1.fs") zstor := xfs1stor("../zodb/storage/fs1/testdata/1.fs")
S := server.NewStorage("abc1", Maddr, Saddr, net, zstor) S := NewStorage("abc1", Maddr, Saddr, net, zstor)
Mctx, Mcancel := context.WithCancel(context.Background()) Mctx, Mcancel := context.WithCancel(context.Background())
Sctx, Scancel := context.WithCancel(context.Background()) Sctx, Scancel := context.WithCancel(context.Background())
...@@ -64,7 +63,7 @@ func TestMasterStorage(t *testing.T) { ...@@ -64,7 +63,7 @@ func TestMasterStorage(t *testing.T) {
//Mev := M.subscribe(...) //Mev := M.subscribe(...)
wg := WorkGroup() wg := neo.WorkGroup()
wg.Gox(func() { wg.Gox(func() {
err := M.Run(Mctx) err := M.Run(Mctx)
_ = err // XXX _ = err // XXX
...@@ -88,14 +87,15 @@ func TestClientStorage(t *testing.T) { ...@@ -88,14 +87,15 @@ func TestClientStorage(t *testing.T) {
// XXX temp disabled // XXX temp disabled
return return
/*
Cnl, Snl := NodeLinkPipe() Cnl, Snl := NodeLinkPipe()
wg := WorkGroup() wg := neo.WorkGroup()
Sctx, Scancel := context.WithCancel(context.Background()) Sctx, Scancel := context.WithCancel(context.Background())
net := NetPipe("") // XXX here? (or a bit above?) net := neo.NetPipe("") // XXX here? (or a bit above?)
zstor := xfs1stor("../zodb/storage/fs1/testdata/1.fs") // XXX +readonly zstor := xfs1stor("../zodb/storage/fs1/testdata/1.fs") // XXX +readonly
S := server.NewStorage("cluster", "Maddr", "Saddr", net, zstor) S := NewStorage("cluster", "Maddr", "Saddr", net, zstor)
wg.Gox(func() { wg.Gox(func() {
S.ServeLink(Sctx, Snl) S.ServeLink(Sctx, Snl)
// XXX + test error return // XXX + test error return
...@@ -174,4 +174,5 @@ func TestClientStorage(t *testing.T) { ...@@ -174,4 +174,5 @@ func TestClientStorage(t *testing.T) {
Scancel() Scancel()
xwait(wg) xwait(wg)
*/
} }
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