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
c1f63a6b
Commit
c1f63a6b
authored
Oct 18, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c1a7c85a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
19 deletions
+21
-19
go/neo/client_test.go
go/neo/client_test.go
+16
-15
go/neo/py/runneo.py
go/neo/py/runneo.py
+5
-4
No files found.
go/neo/client_test.go
View file @
c1f63a6b
...
@@ -45,14 +45,15 @@ type NEOSrv interface {
...
@@ -45,14 +45,15 @@ type NEOSrv interface {
//
//
// Create it with StartNEOPySrv(XXX).
// Create it with StartNEOPySrv(XXX).
type
NEOPySrv
struct
{
type
NEOPySrv
struct
{
pysrv
*
exec
.
Cmd
// spawned `XXX`
pysrv
*
exec
.
Cmd
// spawned `runneo.py`
workdir
string
// location for database and log files
workdir
string
// location for database and log files
opt
NEOPyOptions
// options for spawned server
clusterName
string
// name of the cluster
cancel
func
()
// to stop pysrv
opt
NEOPyOptions
// options for spawned server
done
chan
struct
{}
// ready after Wait completes
cancel
func
()
// to stop pysrv
errExit
error
// error from Wait
done
chan
struct
{}
// ready after Wait completes
errExit
error
// error from Wait
masterAddr
string
// address of master in spawned cluster
masterAddr
string
// address of master in spawned cluster
}
}
// NEOPySrv.Bugs
// NEOPySrv.Bugs
...
@@ -65,10 +66,10 @@ type NEOPyOptions struct {
...
@@ -65,10 +66,10 @@ type NEOPyOptions struct {
// name
// name
}
}
// StartNEOPySrv starts NEO/py server for NEO database located in workdir/.
// StartNEOPySrv starts NEO/py server for
clusterName
NEO database located in workdir/.
// XXX dup wrt zeo?
// XXX dup wrt zeo?
func
StartNEOPySrv
(
workdir
string
,
opt
NEOPyOptions
)
(
_
*
NEOPySrv
,
err
error
)
{
func
StartNEOPySrv
(
workdir
,
clusterName
string
,
opt
NEOPyOptions
)
(
_
*
NEOPySrv
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"startneo %s
"
,
workdir
)
defer
xerr
.
Contextf
(
&
err
,
"startneo %s
/%s"
,
workdir
,
clusterName
)
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
...
@@ -81,8 +82,8 @@ func StartNEOPySrv(workdir string, opt NEOPyOptions) (_ *NEOPySrv, err error) {
...
@@ -81,8 +82,8 @@ func StartNEOPySrv(workdir string, opt NEOPyOptions) (_ *NEOPySrv, err error) {
return
nil
,
err
return
nil
,
err
}
}
n
:=
&
NEOPySrv
{
workdir
:
workdir
,
cancel
:
cancel
,
done
:
make
(
chan
struct
{})}
n
:=
&
NEOPySrv
{
workdir
:
workdir
,
c
lusterName
:
clusterName
,
c
ancel
:
cancel
,
done
:
make
(
chan
struct
{})}
n
.
pysrv
=
exec
.
CommandContext
(
ctx
,
"python"
,
"./py/runneo.py"
,
workdir
)
// XXX +opt
n
.
pysrv
=
exec
.
CommandContext
(
ctx
,
"python"
,
"./py/runneo.py"
,
workdir
,
clusterName
)
// XXX +opt
n
.
opt
=
opt
n
.
opt
=
opt
// $TEMP -> workdir (else NEO/py creates another one for e.g. coverage)
// $TEMP -> workdir (else NEO/py creates another one for e.g. coverage)
n
.
pysrv
.
Env
=
append
(
os
.
Environ
(),
"TEMP="
+
workdir
)
n
.
pysrv
.
Env
=
append
(
os
.
Environ
(),
"TEMP="
+
workdir
)
...
@@ -136,7 +137,7 @@ func StartNEOPySrv(workdir string, opt NEOPyOptions) (_ *NEOPySrv, err error) {
...
@@ -136,7 +137,7 @@ func StartNEOPySrv(workdir string, opt NEOPyOptions) (_ *NEOPySrv, err error) {
}
}
func
(
n
*
NEOPySrv
)
ClusterName
()
string
{
func
(
n
*
NEOPySrv
)
ClusterName
()
string
{
return
"xxx"
// FIXME stub
return
n
.
clusterName
}
}
func
(
n
*
NEOPySrv
)
MasterAddr
()
string
{
func
(
n
*
NEOPySrv
)
MasterAddr
()
string
{
...
@@ -198,7 +199,7 @@ func withNEOSrv(t *testing.T, f func(t *testing.T, nsrv NEOSrv), optv ...tOption
...
@@ -198,7 +199,7 @@ func withNEOSrv(t *testing.T, f func(t *testing.T, nsrv NEOSrv), optv ...tOption
inWorkDir
(
t
,
func
(
workdir
string
)
{
inWorkDir
(
t
,
func
(
workdir
string
)
{
X
:=
xtesting
.
FatalIf
(
t
)
X
:=
xtesting
.
FatalIf
(
t
)
npy
,
err
:=
StartNEOPySrv
(
workdir
,
NEOPyOptions
{});
X
(
err
)
npy
,
err
:=
StartNEOPySrv
(
workdir
,
"1"
,
NEOPyOptions
{});
X
(
err
)
defer
func
()
{
defer
func
()
{
err
:=
npy
.
Close
();
X
(
err
)
err
:=
npy
.
Close
();
X
(
err
)
}()
}()
...
...
go/neo/py/runneo.py
View file @
c1f63a6b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
# See https://www.nexedi.com/licensing for rationale and options.
# See https://www.nexedi.com/licensing for rationale and options.
"""runneo.py runs NEO/py cluster for NEO/go testing.
"""runneo.py runs NEO/py cluster for NEO/go testing.
Usage: runneo
py <workdir> <readyfil
e> XXX + (**kw for NEOCluster)
Usage: runneo
.py <workdir> <cluster-nam
e> XXX + (**kw for NEOCluster)
XXX
XXX
"""
"""
...
@@ -32,10 +32,11 @@ from time import sleep
...
@@ -32,10 +32,11 @@ from time import sleep
@
func
@
func
def
main
():
def
main
():
workdir
=
sys
.
argv
[
1
]
workdir
=
sys
.
argv
[
1
]
readyf
=
workdir
+
"/ready"
clusterName
=
sys
.
argv
[
2
]
readyf
=
workdir
+
"/ready"
cluster
=
NEOCluster
([
'1'
],
adapter
=
'SQLite'
,
temp_dir
=
workdir
)
# XXX +kw
cluster
=
NEOCluster
([
clusterName
],
adapter
=
'SQLite'
,
temp_dir
=
workdir
)
# XXX +kw
cluster
.
start
()
cluster
.
start
()
defer
(
cluster
.
stop
)
defer
(
cluster
.
stop
)
...
...
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