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
424718ea
Commit
424718ea
authored
Mar 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e05d236b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
go/internal/xtesting/xtesting.go
go/internal/xtesting/xtesting.go
+30
-1
go/zodb/storage/demo/demo_test.go
go/zodb/storage/demo/demo_test.go
+6
-7
No files found.
go/internal/xtesting/xtesting.go
View file @
424718ea
// Copyright (C) 2017-202
0
Nexedi SA and Contributors.
// Copyright (C) 2017-202
1
Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
...
...
@@ -29,10 +29,12 @@ import (
"os"
"os/exec"
"reflect"
"strings"
"sync"
"testing"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xstrings"
"lab.nexedi.com/kirr/neo/go/zodb"
)
...
...
@@ -135,6 +137,33 @@ func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err
// XXX + ZPyCommitSrv ?
// ZPyRestore restores transactions specified by zin in zodbdump format.
//
// The restore is performed via zodbtools/py.
func
ZPyRestore
(
zurl
string
,
zin
string
)
(
tidv
[]
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%s: zpyrestore"
,
zurl
)
// run py `zodb restore`
cmd
:=
exec
.
Command
(
"python"
,
"-m"
,
"zodbtools.zodb"
,
"restore"
,
zurl
)
cmd
.
Stdin
=
strings
.
NewReader
(
zin
)
cmd
.
Stderr
=
os
.
Stderr
out
,
err
:=
cmd
.
Output
()
if
err
!=
nil
{
return
nil
,
err
}
for
_
,
line
:=
range
xstrings
.
SplitLines
(
string
(
out
),
"
\n
"
)
{
tid
,
err
:=
zodb
.
ParseTid
(
line
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"restored, but invalid output: %s"
,
err
)
}
tidv
=
append
(
tidv
,
tid
)
}
return
tidv
,
nil
}
// ---- tests for storage drivers ----
...
...
go/zodb/storage/demo/demo_test.go
View file @
424718ea
...
...
@@ -19,13 +19,11 @@
package
demo
/*
import
(
"testing"
"lab.nexedi.com/kirr/neo/go/internal/xtesting"
)
*/
// tOptions represents options for testing.
// TODO -> xtesting
...
...
@@ -33,12 +31,12 @@ type tOptions struct {
Preload
string
// preload database with data from this location
}
/*
// withDemoStorage tests f with all kind of demo overlays.
func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv
XXX
), optv ...tOptions) {
func
withDemoStorage
(
t
*
testing
.
T
,
f
func
(
t
*
testing
.
T
,
dsrv
*
Storage
/*XXX -> Srv ?*/
),
optv
...
tOptions
)
{
t
.
Helper
()
X
:=
xtesting
.
FatalIf
(
t
)
opt := t
.
Options{}
opt
:=
tOptions
{}
if
len
(
optv
)
>
1
{
panic
(
"multiple tOptions not allowed"
)
}
...
...
@@ -47,6 +45,7 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv XXX), optv ...tOpti
}
// verify on all combinations of preload being split into base+δ
txnv, err := xtesting.LoadDBHistory(t.Preload)
txnv
,
err
:=
xtesting
.
LoadDBHistory
(
opt
.
Preload
);
X
(
err
)
_
=
txnv
}
*/
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