Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
dcdb9592
Commit
dcdb9592
authored
Dec 30, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6e1926c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
16 deletions
+26
-16
go/neo/neo_test.go
go/neo/neo_test.go
+10
-4
go/neo/t_cluster_test.go
go/neo/t_cluster_test.go
+16
-12
No files found.
go/neo/neo_test.go
View file @
dcdb9592
...
...
@@ -71,7 +71,7 @@ func tracetestMasterStorage(t0 *tracetest.T) {
// ----------------------------------------
// XXX convert prologue to t
StartSimpleNEOGoSrv (XXX naming)
// XXX convert prologue to t
NewCluster_MS
// M starts listening
tM
.
Expect
(
netlisten
(
"m:1"
))
...
...
@@ -408,6 +408,7 @@ func tracetestMasterStorage(t0 *tracetest.T) {
}
/*
// dispatch1 dispatched directly to single output channel
//
// XXX hack - better we don't need it.
...
...
@@ -419,12 +420,16 @@ type tdispatch1 struct {
func (d tdispatch1) Dispatch(event interface{}) {
d.outch.Send(event)
}
*/
func
benchmarkGetObject
(
b
*
testing
.
B
,
Mnet
,
Snet
,
Cnet
xnet
.
Networker
,
benchit
func
(
xcload1
func
()))
{
// create test cluster <- XXX factor to utility func
X
:=
exc
.
Raiseif
// create test cluster
zback
:=
xfs1back
(
"../zodb/storage/fs1/testdata/1.fs"
)
t
:=
tStartSimpleNEOGoSrv
(
"abc1"
,
zback
)
var
t0
*
tracetest
.
T
// XXX stub
t
:=
tNewCluster_MS
(
t0
,
"abc1"
,
zback
)
defer
t
.
Stop
()
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
...
...
@@ -482,7 +487,8 @@ func benchmarkGetObject(b *testing.B, Mnet, Snet, Cnet xnet.Networker, benchit f
// tracer.Detach()
t
.
TraceOff
()
err
:=
M
.
Start
();
t
.
FatalIf
(
err
)
var
M
ITestMaster
// XXX stub -> M = t.Master("m")
err
:=
M
.
Start
();
X
(
err
)
C
:=
t
.
NewClient
(
"c"
,
"m:1"
)
// XXX better use M.Addr() ?
...
...
go/neo/t_cluster_test.go
View file @
dcdb9592
...
...
@@ -27,6 +27,7 @@ import (
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet/pipenet"
"lab.nexedi.com/kirr/go123/xnet/virtnet"
"lab.nexedi.com/kirr/go123/xsync"
"lab.nexedi.com/kirr/neo/go/internal/xcontext"
...
...
@@ -43,12 +44,14 @@ import (
// Create it with tNewCluster.
// Create nodes with .NewMaster, .NewStorage and .NewClient.
//
// NOTE about network addresses being predictable due to using pipenet/lonet for inter-networking.
//
// XXX text about events tracing
type
tCluster
struct
{
*
tracetest
.
T
// original testing env this cluster was created at
name
string
// name of the cluster
network
*
pipenet
.
Network
// nodes interoperate via netowrk XXX -> lo
name
string
// name of the cluster
network
*
virtnet
.
SubNetwork
// nodes interoperate via netowrk
gotracer
*
TraceCollector
// for tracing go nodes XXX -> GoTracer
//tpy *PyTracer // for tracing py nodes
...
...
@@ -92,11 +95,14 @@ func tNewCluster(ttest *tracetest.T, name string) *tCluster {
T
:
ttest
,
name
:
name
,
network
:
pipenet
.
New
(
"testnet"
),
// test network
nodeTab
:
make
(
map
[
string
]
*
tNode
),
}
// test network
// XXX allow to use lonet
t
.
network
=
pipenet
.
AsVirtNet
(
pipenet
.
New
(
"testnet"
))
t
.
erouter
=
NewEventRouter
()
t
.
gotracer
=
NewTraceCollector
(
ttest
)
ttest
.
SetEventRouter
(
t
.
erouter
.
RouteEvent
)
...
...
@@ -298,22 +304,20 @@ func (m *tMaster) Run(ctx context.Context) error {
// --------
// tStartSimpleNEOGoSrv starts simple NEO/go server with 1 master and 1 storage.
// The cluster is returned in ready-to-start.
//
// XXX naming -> tStartSimpleClusterMS ?
func
tStartSimpleNEOGoSrv
(
t0
*
tracetest
.
T
,
name
string
,
Sback
storage
.
Backend
)
*
tCluster
{
// tNewCluster_MS starts simple NEO cluster with 1 master and 1 storage nodes.
// The cluster is returned in ready-to-start state.
func
tNewCluster_MS
(
t0
*
tracetest
.
T
,
name
string
,
Sback
storage
.
Backend
)
*
tCluster
{
t
:=
tNewCluster
(
t0
,
name
)
M
:=
t
.
NewMaster
(
"m"
)
t
.
NewMaster
(
"m"
)
//
XXX if we would always use lonet or pipenet - all network addresses would b
e predictable
//
NOTE all network addresses ar
e predictable
// M starts listening
t
.
Expect
(
"m"
,
netlisten
(
"m:1"
))
t
.
Expect
(
"m"
,
δnode
(
"m"
,
"m:1"
,
proto
.
MASTER
,
1
,
proto
.
RUNNING
,
proto
.
IdTimeNone
))
t
.
Expect
(
"m"
,
clusterState
(
"m"
,
proto
.
ClusterRecovering
))
S
:=
t
.
NewStorage
(
"s"
,
"m:1"
,
Sback
)
t
.
NewStorage
(
"s"
,
"m:1"
,
Sback
)
// S starts listening
t
.
Expect
(
"s"
,
netlisten
(
"s:1"
))
...
...
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