Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
e0fff1ea
Commit
e0fff1ea
authored
Dec 30, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6b9c53a4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
23 deletions
+39
-23
go/neo/neo_test.go
go/neo/neo_test.go
+12
-10
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+27
-13
No files found.
go/neo/neo_test.go
View file @
e0fff1ea
...
@@ -49,36 +49,39 @@ func TestMasterStorage(t *testing.T) {
...
@@ -49,36 +49,39 @@ func TestMasterStorage(t *testing.T) {
func
tracetestMasterStorage
(
t0
*
tracetest
.
T
)
{
func
tracetestMasterStorage
(
t0
*
tracetest
.
T
)
{
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
t
:=
tNewCluster
(
t0
,
"abc1"
)
defer
t
.
Stop
()
M
:=
t
.
NewMaster
(
"m"
)
zstor
:=
xfs1stor
(
"../zodb/storage/fs1/testdata/1.fs"
)
zstor
:=
xfs1stor
(
"../zodb/storage/fs1/testdata/1.fs"
)
zback
:=
xfs1back
(
"../zodb/storage/fs1/testdata/1.fs"
)
zback
:=
xfs1back
(
"../zodb/storage/fs1/testdata/1.fs"
)
_
=
t
.
NewStorage
(
"s"
,
"m:1"
,
zback
)
// XXX do we need to provide Mlist here?
t
:=
tNewCluster_MS
(
t0
,
"abc1"
,
zback
)
defer
t
.
Stop
()
M
:=
t
.
Master
(
"m"
)
C
:=
t
.
NewClient
(
"c"
,
"m:1"
)
C
:=
t
.
NewClient
(
"c"
,
"m:1"
)
lastTid
,
err
:=
zstor
.
Sync
(
bg
);
X
(
err
)
lastTid
,
err
:=
zstor
.
Sync
(
bg
);
X
(
err
)
tM
:=
t
.
Checker
(
"m"
)
tM
:=
t
.
Checker
(
"m"
)
tS
:=
t
.
Checker
(
"s"
)
//
tS := t.Checker("s")
tC
:=
t
.
Checker
(
"c"
)
tC
:=
t
.
Checker
(
"c"
)
tMS
:=
t
.
Checker
(
"m-s"
)
tMS
:=
t
.
Checker
(
"m-s"
)
tSM
:=
t
.
Checker
(
"s-m"
)
//
tSM := t.Checker("s-m")
tCM
:=
t
.
Checker
(
"c-m"
)
tCM
:=
t
.
Checker
(
"c-m"
)
tMC
:=
t
.
Checker
(
"m-c"
)
tMC
:=
t
.
Checker
(
"m-c"
)
tCS
:=
t
.
Checker
(
"c-s"
)
tCS
:=
t
.
Checker
(
"c-s"
)
// ----------------------------------------
// ----------------------------------------
// TODO create C; C tries connect to master - rejected ("not yet operational")
// TODO test ID rejects (uuid already registered, ...)
// XXX convert prologue to tNewCluster_MS
// XXX convert prologue to tNewCluster_MS
/*
// 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))
tM.Expect(clusterState("m", proto.ClusterRecovering))
tM.Expect(clusterState("m", proto.ClusterRecovering))
// TODO create C; C tries connect to master - rejected ("not yet operational")
// S starts listening
// S starts listening
tS.Expect(netlisten("s:1"))
tS.Expect(netlisten("s:1"))
...
@@ -106,8 +109,6 @@ func tracetestMasterStorage(t0 *tracetest.T) {
...
@@ -106,8 +109,6 @@ func tracetestMasterStorage(t0 *tracetest.T) {
YourUUID: proto.UUID(proto.STORAGE, 1),
YourUUID: proto.UUID(proto.STORAGE, 1),
}))
}))
// TODO test ID rejects (uuid already registered, ...)
// M starts recovery on S
// M starts recovery on S
tMS.Expect(conntx("m:2", "s:2", 0, &proto.Recovery{}))
tMS.Expect(conntx("m:2", "s:2", 0, &proto.Recovery{}))
tMS.Expect(conntx("s:2", "m:2", 0, &proto.AnswerRecovery{
tMS.Expect(conntx("s:2", "m:2", 0, &proto.AnswerRecovery{
...
@@ -128,6 +129,7 @@ func tracetestMasterStorage(t0 *tracetest.T) {
...
@@ -128,6 +129,7 @@ func tracetestMasterStorage(t0 *tracetest.T) {
tM.Expect(masterStartReady("m", true))
tM.Expect(masterStartReady("m", true))
// ----------------------------------------
// ----------------------------------------
*/
// M <- start cmd
// M <- start cmd
wg
:=
xsync
.
NewWorkGroup
(
bg
)
wg
:=
xsync
.
NewWorkGroup
(
bg
)
...
...
go/neo/t_cluster_test.go
View file @
e0fff1ea
...
@@ -66,24 +66,23 @@ type tCluster struct {
...
@@ -66,24 +66,23 @@ type tCluster struct {
runCancel
func
()
runCancel
func
()
}
}
// tNode represents information about a test
node ... XXX
// tNode represents information about a test
ed node.
type
tNode
struct
{
type
tNode
struct
{
itest
interface
{}
// ITest{Master,Storage,Client}
net
xnet
.
Networker
net
xnet
.
Networker
}
}
//
XXX stub
//
ITestMaster represents tested master node.
type
ITestMaster
interface
{
type
ITestMaster
interface
{
// Run(ctx context.Context) error
Start
()
error
Start
()
error
}
}
// ITestStorage represents tested storage node.
type
ITestStorage
interface
{
type
ITestStorage
interface
{
// Run(ctx context.Context) error
}
}
// ITestClient represents tested client node.
type
ITestClient
interface
{
type
ITestClient
interface
{
// Run(ctx context.Context) error
zodb
.
IStorageDriver
zodb
.
IStorageDriver
}
}
...
@@ -218,12 +217,11 @@ func (t *tCluster) registerNewNode(name string) *tNode {
...
@@ -218,12 +217,11 @@ func (t *tCluster) registerNewNode(name string) *tNode {
// NewMaster creates new master on node name.
// NewMaster creates new master on node name.
//
//
// The master will be accepting incoming connections at node:1.
// The master will be accepting incoming connections at node:1.
// The node must be not yet existing and will be dedicated to the created master fully. XXX
// The node must be not yet existing and will be fully dedicated to the created master.
//
// XXX error of creating py process? -> t.Fatal
func
(
t
*
tCluster
)
NewMaster
(
name
string
)
ITestMaster
{
func
(
t
*
tCluster
)
NewMaster
(
name
string
)
ITestMaster
{
node
:=
t
.
registerNewNode
(
name
)
tnode
:=
t
.
registerNewNode
(
name
)
m
:=
tNewMaster
(
t
.
name
,
":1"
,
node
.
net
)
m
:=
tNewMaster
(
t
.
name
,
":1"
,
tnode
.
net
)
tnode
.
itest
=
m
// let tracer know how to map state addresses to node names
// let tracer know how to map state addresses to node names
t
.
gotracer
.
RegisterNode
(
m
.
node
,
name
)
t
.
gotracer
.
RegisterNode
(
m
.
node
,
name
)
...
@@ -236,6 +234,22 @@ func (t *tCluster) NewMaster(name string) ITestMaster {
...
@@ -236,6 +234,22 @@ func (t *tCluster) NewMaster(name string) ITestMaster {
return
m
return
m
}
}
// Master returns master node that was previouslt created via NewMaster(name).
func
(
t
*
tCluster
)
Master
(
name
string
)
ITestMaster
{
t
.
tabMu
.
Lock
()
defer
t
.
tabMu
.
Unlock
()
tnode
,
ok
:=
t
.
nodeTab
[
name
]
if
!
ok
{
t
.
Fatalf
(
"no node %q"
,
name
)
}
m
,
ok
:=
tnode
.
itest
.
(
ITestMaster
)
if
!
ok
{
t
.
Fatalf
(
"node %q if of type %T, not master"
,
name
,
tnode
.
itest
)
}
return
m
}
func
(
t
*
tCluster
)
NewStorage
(
name
,
masterAddr
string
,
back
storage
.
Backend
)
ITestStorage
{
func
(
t
*
tCluster
)
NewStorage
(
name
,
masterAddr
string
,
back
storage
.
Backend
)
ITestStorage
{
node
:=
t
.
registerNewNode
(
name
)
node
:=
t
.
registerNewNode
(
name
)
s
:=
tNewStorage
(
t
.
name
,
masterAddr
,
":1"
,
node
.
net
,
back
)
s
:=
tNewStorage
(
t
.
name
,
masterAddr
,
":1"
,
node
.
net
,
back
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment