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
Hide 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) {
func
tracetestMasterStorage
(
t0
*
tracetest
.
T
)
{
X
:=
exc
.
Raiseif
t
:=
tNewCluster
(
t0
,
"abc1"
)
defer
t
.
Stop
()
M
:=
t
.
NewMaster
(
"m"
)
zstor
:=
xfs1stor
(
"../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"
)
lastTid
,
err
:=
zstor
.
Sync
(
bg
);
X
(
err
)
tM
:=
t
.
Checker
(
"m"
)
tS
:=
t
.
Checker
(
"s"
)
//
tS := t.Checker("s")
tC
:=
t
.
Checker
(
"c"
)
tMS
:=
t
.
Checker
(
"m-s"
)
tSM
:=
t
.
Checker
(
"s-m"
)
//
tSM := t.Checker("s-m")
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 (uuid already registered, ...)
// XXX convert prologue to tNewCluster_MS
/*
// M starts listening
tM.Expect(netlisten("m:1"))
tM.Expect(δnode("m", "m:1", proto.MASTER, 1, proto.RUNNING, proto.IdTimeNone))
tM.Expect(clusterState("m", proto.ClusterRecovering))
// TODO create C; C tries connect to master - rejected ("not yet operational")
// S starts listening
tS.Expect(netlisten("s:1"))
...
...
@@ -106,8 +109,6 @@ func tracetestMasterStorage(t0 *tracetest.T) {
YourUUID: proto.UUID(proto.STORAGE, 1),
}))
// TODO test ID rejects (uuid already registered, ...)
// M starts recovery on S
tMS.Expect(conntx("m:2", "s:2", 0, &proto.Recovery{}))
tMS.Expect(conntx("s:2", "m:2", 0, &proto.AnswerRecovery{
...
...
@@ -128,6 +129,7 @@ func tracetestMasterStorage(t0 *tracetest.T) {
tM.Expect(masterStartReady("m", true))
// ----------------------------------------
*/
// M <- start cmd
wg
:=
xsync
.
NewWorkGroup
(
bg
)
...
...
go/neo/t_cluster_test.go
View file @
e0fff1ea
...
...
@@ -66,24 +66,23 @@ type tCluster struct {
runCancel
func
()
}
// tNode represents information about a test
node ... XXX
// tNode represents information about a test
ed node.
type
tNode
struct
{
net
xnet
.
Networker
itest
interface
{}
// ITest{Master,Storage,Client}
net
xnet
.
Networker
}
//
XXX stub
//
ITestMaster represents tested master node.
type
ITestMaster
interface
{
// Run(ctx context.Context) error
Start
()
error
}
// ITestStorage represents tested storage node.
type
ITestStorage
interface
{
// Run(ctx context.Context) error
}
// ITestClient represents tested client node.
type
ITestClient
interface
{
// Run(ctx context.Context) error
zodb
.
IStorageDriver
}
...
...
@@ -208,7 +207,7 @@ func (t *tCluster) registerNewNode(name string) *tNode {
}
node
:=
&
tNode
{}
node
.
net
=
xnet
.
NetTrace
(
host
,
t
.
gotracer
)
node
.
net
=
xnet
.
NetTrace
(
host
,
t
.
gotracer
)
t
.
nodeTab
[
name
]
=
node
return
node
...
...
@@ -218,12 +217,11 @@ func (t *tCluster) registerNewNode(name string) *tNode {
// NewMaster creates new master on node name.
//
// 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
//
// XXX error of creating py process? -> t.Fatal
// The node must be not yet existing and will be fully dedicated to the created master.
func
(
t
*
tCluster
)
NewMaster
(
name
string
)
ITestMaster
{
node
:=
t
.
registerNewNode
(
name
)
m
:=
tNewMaster
(
t
.
name
,
":1"
,
node
.
net
)
tnode
:=
t
.
registerNewNode
(
name
)
m
:=
tNewMaster
(
t
.
name
,
":1"
,
tnode
.
net
)
tnode
.
itest
=
m
// let tracer know how to map state addresses to node names
t
.
gotracer
.
RegisterNode
(
m
.
node
,
name
)
...
...
@@ -236,6 +234,22 @@ func (t *tCluster) NewMaster(name string) ITestMaster {
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
{
node
:=
t
.
registerNewNode
(
name
)
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