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
1
Merge Requests
1
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
b2929804
Commit
b2929804
authored
1 year ago
by
Levin Zimmermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client_test: Add nmaster={1,2} to test matrix
Tests should work with both one master or more than one masters.
parent
6dba6409
1 merge request
!2
WIP: Teach NEO/go to handle multiple master nodes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
83 deletions
+86
-83
go/neo/client_test.go
go/neo/client_test.go
+86
-83
No files found.
go/neo/client_test.go
View file @
b2929804
...
...
@@ -436,105 +436,108 @@ func withNEOSrv(t *testing.T, f func(t *testing.T, nsrv NEOSrv), optv ...tOption
f
(
work
)
}
// TODO + all variants with nreplica=X, npartition=Y,
nmaster=Z,
... ?
// TODO + all variants with nreplica=X, npartition=Y, ... ?
for
_
,
ssl
:=
range
[]
bool
{
false
,
true
}
{
kind
:=
""
if
ssl
{
kind
=
"ssl"
}
else
{
kind
=
"!ssl"
}
for
_
,
nmaster
:=
range
[]
int
{
1
,
1
}
{
neoOpt
:=
NEOSrvOptions
{
name
:
"1"
,
SSL
:
ssl
,
nmaster
:
1
,
}
for
_
,
ssl
:=
range
[]
bool
{
false
,
true
}
{
kind
:=
""
if
ssl
{
kind
=
"ssl"
}
else
{
kind
=
"!ssl"
}
// startNEOpy starts NEO/py server with database in workdir/
// and preloads it with data according to opt.Preload.
startNEOpy
:=
func
(
t
*
testing
.
T
,
workdir
string
,
opt
tOptions
)
*
NEOPySrv
{
X
:=
xtesting
.
FatalIf
(
t
)
neoOpt
:=
neoOpt
neoOpt
.
workdir
=
workdir
npy
,
err
:=
StartNEOPySrv
(
neoOpt
);
X
(
err
)
if
opt
.
Preload
!=
""
{
cmd
:=
exec
.
Command
(
"python"
,
"-c"
,
"from neo.scripts.neomigrate import main; main()"
,
"-q"
,
"-c"
,
npy
.
clusterName
(),
)
if
ssl
{
cmd
.
Args
=
append
(
cmd
.
Args
,
"--ca"
,
neoOpt
.
CA
())
cmd
.
Args
=
append
(
cmd
.
Args
,
"--cert"
,
neoOpt
.
Cert
())
cmd
.
Args
=
append
(
cmd
.
Args
,
"--key"
,
neoOpt
.
Key
())
}
cmd
.
Args
=
append
(
cmd
.
Args
,
opt
.
Preload
,
// py internal representation of master_nodes is a
// string where each addr is separated by 1 space
strings
.
Join
(
npy
.
masterAddrSlice
,
" "
),
)
cmd
.
Stdin
=
nil
cmd
.
Stdout
=
os
.
Stdout
cmd
.
Stderr
=
os
.
Stderr
err
:=
cmd
.
Run
();
X
(
err
)
neoOpt
:=
NEOSrvOptions
{
name
:
"1"
,
SSL
:
ssl
,
nmaster
:
nmaster
,
}
return
npy
}
// NEO/py
t
.
Run
(
"py/"
+
kind
,
func
(
t
*
testing
.
T
)
{
t
.
Helper
()
// TODO t.NeedPy(...)
inWorkDir
(
t
,
func
(
workdir
string
)
{
X
:=
xtesting
.
FatalIf
(
t
)
npy
:=
startNEOpy
(
t
,
workdir
,
opt
)
defer
func
()
{
err
:=
npy
.
Close
();
X
(
err
)
}()
f
(
t
,
npy
)
})
})
// NEO/go
t
.
Run
(
"go/"
+
kind
,
func
(
t
*
testing
.
T
)
{
t
.
Helper
()
inWorkDir
(
t
,
func
(
workdir
string
)
{
// startNEOpy starts NEO/py server with database in workdir/
// and preloads it with data according to opt.Preload.
startNEOpy
:=
func
(
t
*
testing
.
T
,
workdir
string
,
opt
tOptions
)
*
NEOPySrv
{
X
:=
xtesting
.
FatalIf
(
t
)
neoOpt
:=
neoOpt
neoOpt
.
workdir
=
workdir
// start NEO/py first. We need it to create the
// database and to preload it, because NEO/go
// does not currently support commit.
npy
:=
startNEOpy
(
t
,
workdir
,
opt
)
err
:=
npy
.
Close
();
X
(
err
)
// start NEO/py again to flush ttrans/tobj -> trans/obj tables
// if preload was requested. We need this because currently
// NEO/go does not implement recovery (which is write operation),
// and NEO/py leaves data after ZODB commit in ttrans/tobj (to
// be moved to trans/obj on next ZODB commit). See
// lab.nexedi.com/nexedi/neoppod/commit/7eb7cf1b
npy
,
err
:=
StartNEOPySrv
(
neoOpt
);
X
(
err
)
if
opt
.
Preload
!=
""
{
optRestart
:=
opt
optRestart
.
Preload
=
""
npy
=
startNEOpy
(
t
,
workdir
,
optRestart
)
err
=
npy
.
Close
();
X
(
err
)
cmd
:=
exec
.
Command
(
"python"
,
"-c"
,
"from neo.scripts.neomigrate import main; main()"
,
"-q"
,
"-c"
,
npy
.
clusterName
(),
)
if
ssl
{
cmd
.
Args
=
append
(
cmd
.
Args
,
"--ca"
,
neoOpt
.
CA
())
cmd
.
Args
=
append
(
cmd
.
Args
,
"--cert"
,
neoOpt
.
Cert
())
cmd
.
Args
=
append
(
cmd
.
Args
,
"--key"
,
neoOpt
.
Key
())
}
cmd
.
Args
=
append
(
cmd
.
Args
,
opt
.
Preload
,
// py internal representation of master_nodes is a
// string where each addr is separated by 1 space
strings
.
Join
(
npy
.
masterAddrSlice
,
" "
),
)
cmd
.
Stdin
=
nil
cmd
.
Stdout
=
os
.
Stdout
cmd
.
Stderr
=
os
.
Stderr
err
:=
cmd
.
Run
();
X
(
err
)
}
return
npy
}
// start NEO/go, as the database is created and preloaded
ngo
,
err
:=
StartNEOGoSrv
(
neoOpt
);
X
(
err
)
defer
func
()
{
err
:=
ngo
.
Close
();
X
(
err
)
}()
// NEO/py
t
.
Run
(
"py/"
+
kind
,
func
(
t
*
testing
.
T
)
{
t
.
Helper
()
// TODO t.NeedPy(...)
inWorkDir
(
t
,
func
(
workdir
string
)
{
X
:=
xtesting
.
FatalIf
(
t
)
npy
:=
startNEOpy
(
t
,
workdir
,
opt
)
defer
func
()
{
err
:=
npy
.
Close
();
X
(
err
)
}()
f
(
t
,
npy
)
})
})
// NEO/go
t
.
Run
(
"go/"
+
kind
,
func
(
t
*
testing
.
T
)
{
t
.
Helper
()
inWorkDir
(
t
,
func
(
workdir
string
)
{
X
:=
xtesting
.
FatalIf
(
t
)
f
(
t
,
ngo
)
neoOpt
:=
neoOpt
neoOpt
.
workdir
=
workdir
// start NEO/py first. We need it to create the
// database and to preload it, because NEO/go
// does not currently support commit.
npy
:=
startNEOpy
(
t
,
workdir
,
opt
)
err
:=
npy
.
Close
();
X
(
err
)
// start NEO/py again to flush ttrans/tobj -> trans/obj tables
// if preload was requested. We need this because currently
// NEO/go does not implement recovery (which is write operation),
// and NEO/py leaves data after ZODB commit in ttrans/tobj (to
// be moved to trans/obj on next ZODB commit). See
// lab.nexedi.com/nexedi/neoppod/commit/7eb7cf1b
if
opt
.
Preload
!=
""
{
optRestart
:=
opt
optRestart
.
Preload
=
""
npy
=
startNEOpy
(
t
,
workdir
,
optRestart
)
err
=
npy
.
Close
();
X
(
err
)
}
// start NEO/go, as the database is created and preloaded
ngo
,
err
:=
StartNEOGoSrv
(
neoOpt
);
X
(
err
)
defer
func
()
{
err
:=
ngo
.
Close
();
X
(
err
)
}()
f
(
t
,
ngo
)
})
})
}
)
}
}
}
...
...
This diff is collapsed.
Click to expand it.
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