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
4df008a0
Commit
4df008a0
authored
Sep 15, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a922259e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
12 deletions
+37
-12
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+37
-12
No files found.
go/neo/server/cluster_test.go
View file @
4df008a0
...
...
@@ -553,36 +553,48 @@ func TestMasterStorage(t *testing.T) {
}
func
BenchmarkGetObject
(
b
*
testing
.
B
)
{
func
benchmarkGetObject
(
b
*
testing
.
B
,
Mnet
,
Snet
,
Cnet
xnet
.
Networker
)
{
// create test cluster <- XXX factor to utility func
net
:=
pipenet
.
New
(
"testnet"
)
Mhost
:=
net
.
Host
(
"m"
)
Shost
:=
net
.
Host
(
"s"
)
Chost
:=
net
.
Host
(
"c"
)
zstor
:=
xfs1stor
(
"../../zodb/storage/fs1/testdata/1.fs"
)
M
:=
NewMaster
(
"abc1"
,
":1"
,
Mhost
)
S
:=
NewStorage
(
"abc1"
,
"m:1"
,
":1"
,
Shost
,
zstor
)
C
:=
client
.
NewClient
(
"abc1"
,
"m:1"
,
Chost
)
// spawn M & S
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
defer
wg
.
Wait
()
defer
cancel
()
// XXX to wait for "ready to start" -> XXX add something to M api?
// spawn M
M
:=
NewMaster
(
"abc1"
,
""
,
Mnet
)
// XXX to wait for "M listens at ..." & "ready to start" -> XXX add something to M api?
tracer
:=
&
MyTracer
{
xtesting
.
NewSyncTracer
()}
tc
:=
xtesting
.
NewTraceChecker
(
b
,
tracer
.
SyncTracer
)
pg
:=
&
tracing
.
ProbeGroup
{}
tracing
.
Lock
()
pnode
:=
neo_traceNodeChanged_Attach
(
nil
,
tracer
.
traceNode
)
traceMasterStartReady_Attach
(
pg
,
tracer
.
traceMasterStartReady
)
tracing
.
Unlock
()
wg
.
Go
(
func
()
error
{
return
M
.
Run
(
ctx
)
})
// determing M serving address XXX better with M api
ev
:=
tracer
.
Get1
()
mnode
,
ok
:=
ev
.
Event
.
(
*
traceNode
)
if
!
ok
{
b
.
Fatal
(
"after M start: got %T ; want traceNode"
,
ev
.
Event
)
}
Maddr
:=
mnode
.
NodeInfo
.
Addr
.
String
()
tracing
.
Lock
()
pnode
.
Detach
()
tracing
.
Unlock
()
ev
.
Ack
()
// now after we know Maddr create S & C and start S serving
S
:=
NewStorage
(
"abc1"
,
Maddr
,
""
,
Snet
,
zstor
)
C
:=
client
.
NewClient
(
"abc1"
,
Maddr
,
Cnet
)
wg
.
Go
(
func
()
error
{
return
S
.
Run
(
ctx
)
})
...
...
@@ -628,3 +640,16 @@ func BenchmarkGetObject(b *testing.B) {
xcload1
()
}
}
func
BenchmarkGetObjectPipe
(
b
*
testing
.
B
)
{
net
:=
pipenet
.
New
(
"testnet"
)
Mhost
:=
net
.
Host
(
"m"
)
Shost
:=
net
.
Host
(
"s"
)
Chost
:=
net
.
Host
(
"c"
)
benchmarkGetObject
(
b
,
Mhost
,
Shost
,
Chost
)
}
func
BenchmarkGetObjectTCPlo
(
b
*
testing
.
B
)
{
net
:=
xnet
.
NetPlain
(
"tcp"
)
benchmarkGetObject
(
b
,
net
,
net
,
net
)
}
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