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
e9e3ca34
Commit
e9e3ca34
authored
Feb 17, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6b724502
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
40 deletions
+45
-40
go/neo/neo_test.go
go/neo/neo_test.go
+41
-40
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+4
-0
No files found.
go/neo/neo_test.go
View file @
e9e3ca34
...
...
@@ -65,14 +65,6 @@ func _TestMasterStorage(t0 *tEnv) {
M
:=
t
.
Master
(
"m"
)
C
:=
t
.
NewClient
(
"c"
,
"m:1"
)
tM
:=
t
.
Checker
(
"m"
)
tC
:=
t
.
Checker
(
"c"
)
tMS
:=
t
.
Checker
(
"m-s"
)
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 (nid already registered, ...)
...
...
@@ -97,9 +89,9 @@ func _TestMasterStorage(t0 *tEnv) {
// XXX M.partTab <- S1
// M starts verification
t
M
.
Expect
(
clusterState
(
"m"
,
proto
.
ClusterVerifying
))
t
.
Expect
(
"m"
,
clusterState
(
"m"
,
proto
.
ClusterVerifying
))
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
8
,
&
proto
.
SendPartitionTable
{
t
.
Expect
(
"m-s"
,
conntx
(
"m:2"
,
"s:2"
,
8
,
&
proto
.
SendPartitionTable
{
PTid
:
1
,
NumReplicas
:
0
,
RowList
:
[]
proto
.
RowInfo
{
...
...
@@ -107,14 +99,14 @@ func _TestMasterStorage(t0 *tEnv) {
},
}))
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
10
,
&
proto
.
LockedTransactions
{}))
t
MS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
10
,
&
proto
.
AnswerLockedTransactions
{
t
.
Expect
(
"m-s"
,
conntx
(
"m:2"
,
"s:2"
,
10
,
&
proto
.
LockedTransactions
{}))
t
.
Expect
(
"m-s"
,
conntx
(
"s:2"
,
"m:2"
,
10
,
&
proto
.
AnswerLockedTransactions
{
TidDict
:
nil
,
// map[zodb.Tid]zodb.Tid{},
}))
lastOid
,
err
:=
zstor
.
LastOid
(
bg
);
X
(
err
)
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
12
,
&
proto
.
LastIDs
{}))
t
MS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
12
,
&
proto
.
AnswerLastIDs
{
t
.
Expect
(
"m-s"
,
conntx
(
"m:2"
,
"s:2"
,
12
,
&
proto
.
LastIDs
{}))
t
.
Expect
(
"m-s"
,
conntx
(
"s:2"
,
"m:2"
,
12
,
&
proto
.
AnswerLastIDs
{
LastOid
:
lastOid
,
LastTid
:
lastTid
,
}))
...
...
@@ -127,11 +119,11 @@ func _TestMasterStorage(t0 *tEnv) {
// TODO M.Stop() while verify
// verification ok; M start service
t
M
.
Expect
(
clusterState
(
"m"
,
proto
.
ClusterRunning
))
t
.
Expect
(
"m"
,
clusterState
(
"m"
,
proto
.
ClusterRunning
))
// TODO ^^^ should be sent to S
t
MS
.
Expect
(
conntx
(
"m:2"
,
"s:2"
,
14
,
&
proto
.
StartOperation
{
Backup
:
false
}))
t
MS
.
Expect
(
conntx
(
"s:2"
,
"m:2"
,
14
,
&
proto
.
NotifyReady
{}))
t
.
Expect
(
"m-s"
,
conntx
(
"m:2"
,
"s:2"
,
14
,
&
proto
.
StartOperation
{
Backup
:
false
}))
t
.
Expect
(
"m-s"
,
conntx
(
"s:2"
,
"m:2"
,
14
,
&
proto
.
NotifyReady
{}))
// TODO S leave while service
// TODO S join while service
...
...
@@ -142,9 +134,9 @@ func _TestMasterStorage(t0 *tEnv) {
// trace of client start
// C connects M
t
CM
.
Expect
(
netdial
(
"c"
,
"m:1"
))
t
CM
.
Expect
(
netconnect
(
"c:1"
,
"m:3"
,
"m:1"
))
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
1
,
&
proto
.
RequestIdentification
{
t
.
Expect
(
"c-m"
,
netdial
(
"c"
,
"m:1"
))
t
.
Expect
(
"c-m"
,
netconnect
(
"c:1"
,
"m:3"
,
"m:1"
))
t
.
Expect
(
"c-m"
,
conntx
(
"c:1"
,
"m:3"
,
1
,
&
proto
.
RequestIdentification
{
NodeType
:
proto
.
CLIENT
,
NID
:
proto
.
NID
(
proto
.
CLIENT
,
0
),
Address
:
xnaddr
(
""
),
...
...
@@ -154,16 +146,16 @@ func _TestMasterStorage(t0 *tEnv) {
NewNID
:
nil
,
}))
t
M
.
Expect
(
δnode
(
"m"
,
""
,
proto
.
CLIENT
,
1
,
proto
.
RUNNING
,
0.02
))
t
.
Expect
(
"m"
,
δnode
(
"m"
,
""
,
proto
.
CLIENT
,
1
,
proto
.
RUNNING
,
0.02
))
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
1
,
&
proto
.
AcceptIdentification
{
t
.
Expect
(
"c-m"
,
conntx
(
"m:3"
,
"c:1"
,
1
,
&
proto
.
AcceptIdentification
{
NodeType
:
proto
.
MASTER
,
MyNID
:
proto
.
NID
(
proto
.
MASTER
,
1
),
YourNID
:
proto
.
NID
(
proto
.
CLIENT
,
1
),
}))
// C <- M NotifyNodeInformation
C1,M1,S
1
t
MC
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
0
,
&
proto
.
NotifyNodeInformation
{
// C <- M NotifyNodeInformation
M1,S1,C
1
t
.
Expect
(
"m-c"
,
conntx
(
"m:3"
,
"c:1"
,
0
,
&
proto
.
NotifyNodeInformation
{
IdTime
:
proto
.
IdTimeNone
,
// XXX ?
NodeList
:
[]
proto
.
NodeInfo
{
nodei
(
"m:1"
,
proto
.
MASTER
,
1
,
proto
.
RUNNING
,
proto
.
IdTimeNone
),
...
...
@@ -172,7 +164,7 @@ func _TestMasterStorage(t0 *tEnv) {
},
}))
t
MC
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
2
,
&
proto
.
SendPartitionTable
{
t
.
Expect
(
"m-c"
,
conntx
(
"m:3"
,
"c:1"
,
2
,
&
proto
.
SendPartitionTable
{
PTid
:
1
,
NumReplicas
:
0
,
RowList
:
[]
proto
.
RowInfo
{
...
...
@@ -180,13 +172,22 @@ func _TestMasterStorage(t0 *tEnv) {
},
}))
tC
.
Expect
(
δnode
(
"c"
,
"m:1"
,
proto
.
MASTER
,
1
,
proto
.
RUNNING
,
proto
.
IdTimeNone
))
tC
.
Expect
(
δnode
(
"c"
,
"s:1"
,
proto
.
STORAGE
,
1
,
proto
.
RUNNING
,
0.01
))
tC
.
Expect
(
δnode
(
"c"
,
""
,
proto
.
CLIENT
,
1
,
proto
.
RUNNING
,
0.02
))
t
.
Expect
(
"c"
,
δnode
(
"c"
,
"m:1"
,
proto
.
MASTER
,
1
,
proto
.
RUNNING
,
proto
.
IdTimeNone
))
t
.
Expect
(
"c"
,
δnode
(
"c"
,
"s:1"
,
proto
.
STORAGE
,
1
,
proto
.
RUNNING
,
0.01
))
t
.
Expect
(
"c"
,
δnode
(
"c"
,
""
,
proto
.
CLIENT
,
1
,
proto
.
RUNNING
,
0.02
))
// S <- M NotifyNodeInformation C1
t
.
Expect
(
"m-s"
,
conntx
(
"m:2"
,
"s:2"
,
16
,
&
proto
.
NotifyNodeInformation
{
IdTime
:
proto
.
IdTimeNone
,
// XXX ?
NodeList
:
[]
proto
.
NodeInfo
{
nodei
(
""
,
proto
.
CLIENT
,
1
,
proto
.
RUNNING
,
0.02
),
},
}))
t
.
Expect
(
"s"
,
δnode
(
"s"
,
""
,
proto
.
CLIENT
,
1
,
proto
.
RUNNING
,
0.02
))
// C asks M last_tid
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
3
,
&
proto
.
LastTransaction
{}))
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
3
,
&
proto
.
AnswerLastTransaction
{
lastTid
}))
t
.
Expect
(
"c-m"
,
conntx
(
"c:1"
,
"m:3"
,
3
,
&
proto
.
LastTransaction
{}))
t
.
Expect
(
"c-m"
,
conntx
(
"m:3"
,
"c:1"
,
3
,
&
proto
.
AnswerLastTransaction
{
lastTid
}))
// ----------------------------------------
...
...
@@ -200,8 +201,8 @@ func _TestMasterStorage(t0 *tEnv) {
}
})
t
CM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
5
,
&
proto
.
LastTransaction
{}))
t
CM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
5
,
&
proto
.
AnswerLastTransaction
{
lastTid
}))
t
.
Expect
(
"c-m"
,
conntx
(
"c:1"
,
"m:3"
,
5
,
&
proto
.
LastTransaction
{}))
t
.
Expect
(
"c-m"
,
conntx
(
"m:3"
,
"c:1"
,
5
,
&
proto
.
AnswerLastTransaction
{
lastTid
}))
xwait
(
wg
)
...
...
@@ -223,9 +224,9 @@ func _TestMasterStorage(t0 *tEnv) {
// trace
// ... -> connects to S
t
CS
.
Expect
(
netdial
(
"c"
,
"s:1"
))
t
CS
.
Expect
(
netconnect
(
"c:2"
,
"s:3"
,
"s:1"
))
t
CS
.
Expect
(
conntx
(
"c:2"
,
"s:3"
,
1
,
&
proto
.
RequestIdentification
{
t
.
Expect
(
"c-s"
,
netdial
(
"c"
,
"s:1"
))
t
.
Expect
(
"c-s"
,
netconnect
(
"c:2"
,
"s:3"
,
"s:1"
))
t
.
Expect
(
"c-s"
,
conntx
(
"c:2"
,
"s:3"
,
1
,
&
proto
.
RequestIdentification
{
NodeType
:
proto
.
CLIENT
,
NID
:
proto
.
NID
(
proto
.
CLIENT
,
1
),
Address
:
xnaddr
(
""
),
...
...
@@ -235,19 +236,19 @@ func _TestMasterStorage(t0 *tEnv) {
NewNID
:
nil
,
}))
t
CS
.
Expect
(
conntx
(
"s:3"
,
"c:2"
,
1
,
&
proto
.
AcceptIdentification
{
t
.
Expect
(
"c-s"
,
conntx
(
"s:3"
,
"c:2"
,
1
,
&
proto
.
AcceptIdentification
{
NodeType
:
proto
.
STORAGE
,
MyNID
:
proto
.
NID
(
proto
.
STORAGE
,
1
),
YourNID
:
proto
.
NID
(
proto
.
CLIENT
,
1
),
}))
// ... -> GetObject(xid1)
t
CS
.
Expect
(
conntx
(
"c:2"
,
"s:3"
,
3
,
&
proto
.
GetObject
{
t
.
Expect
(
"c-s"
,
conntx
(
"c:2"
,
"s:3"
,
3
,
&
proto
.
GetObject
{
Oid
:
xid1
.
Oid
,
Before
:
xzodb
.
At2Before
(
xid1
.
At
),
At
:
proto
.
INVALID_TID
,
}))
t
CS
.
Expect
(
conntx
(
"s:3"
,
"c:2"
,
3
,
&
proto
.
AnswerObject
{
t
.
Expect
(
"c-s"
,
conntx
(
"s:3"
,
"c:2"
,
3
,
&
proto
.
AnswerObject
{
Oid
:
xid1
.
Oid
,
Serial
:
serial1
,
NextSerial
:
proto
.
INVALID_TID
,
...
...
@@ -277,12 +278,12 @@ func _TestMasterStorage(t0 *tEnv) {
})
// ... -> GetObject(xid1prev)
t
CS
.
Expect
(
conntx
(
"c:2"
,
"s:3"
,
5
,
&
proto
.
GetObject
{
t
.
Expect
(
"c-s"
,
conntx
(
"c:2"
,
"s:3"
,
5
,
&
proto
.
GetObject
{
Oid
:
xid1prev
.
Oid
,
Before
:
serial1
,
At
:
proto
.
INVALID_TID
,
}))
t
CS
.
Expect
(
conntx
(
"s:3"
,
"c:2"
,
5
,
&
proto
.
AnswerObject
{
t
.
Expect
(
"c-s"
,
conntx
(
"s:3"
,
"c:2"
,
5
,
&
proto
.
AnswerObject
{
Oid
:
xid1prev
.
Oid
,
Serial
:
serial1prev
,
NextSerial
:
serial1
,
...
...
go/neo/t_cluster_test.go
View file @
e9e3ca34
...
...
@@ -154,6 +154,7 @@ func (t0 *tEnv) NewCluster(name string) *tCluster {
func
(
t
*
tCluster
)
Stop
()
{
t
.
Helper
()
t
.
TraceOff
()
t
.
Done
()
t
.
runCancel
()
err
:=
t
.
runWG
.
Wait
()
...
...
@@ -183,6 +184,7 @@ func (t *tCluster) TraceOff() {
}
}
/*
// Checker returns tracechecker corresponding to name.
//
// name might be of "node" or "node1-node2" kind. XXX more text
...
...
@@ -201,6 +203,7 @@ func (c *tStreamChecker) Expect(event interface{}) {
c.t.Helper()
c.t.Expect(c.stream, event)
}
*/
// registerNewNode registers new node with given name.
//
...
...
@@ -447,6 +450,7 @@ func (t0 *tEnv) NewCluster_MS(name string, Sback storage.Backend) *tCluster {
}))
// M sends nodeTab to S
// XXX notifications should go to "m-s/notify" ?
t
.
Expect
(
"m-s"
,
conntx
(
"m:2"
,
"s:2"
,
0
,
&
proto
.
NotifyNodeInformation
{
IdTime
:
proto
.
IdTimeNone
,
// XXX ?
NodeList
:
[]
proto
.
NodeInfo
{
...
...
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