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
d8004baf
Commit
d8004baf
authored
Jan 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d4e577aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
15 deletions
+15
-15
go/internal/xtesting/xtesting.go
go/internal/xtesting/xtesting.go
+5
-5
go/zodb/import_x_test.go
go/zodb/import_x_test.go
+4
-4
go/zodb/storage/fs1/filestorage_test.go
go/zodb/storage/fs1/filestorage_test.go
+6
-6
No files found.
go/internal/xtesting/xtesting.go
View file @
d8004baf
...
@@ -87,17 +87,17 @@ func NeedPy(t testing.TB, modules ...string) {
...
@@ -87,17 +87,17 @@ func NeedPy(t testing.TB, modules ...string) {
return
return
}
}
// Z
Object represents object state to be committed
.
// Z
RawObject represents raw ZODB object state
.
type
ZObject
struct
{
type
Z
Raw
Object
struct
{
Oid
zodb
.
Oid
Oid
zodb
.
Oid
Data
string
// raw serialized zodb data
Data
string
// raw serialized zodb data
}
}
// ZPyCommit
commits new transaction into database @ zurl with
data specified by objv.
// ZPyCommit
Raw commits new transaction into database @ zurl with raw
data specified by objv.
//
//
// The commit is performed via zodbtools/py.
// The commit is performed via zodbtools/py.
func
ZPyCommit
(
zurl
string
,
at
zodb
.
Tid
,
objv
...
Z
Object
)
(
_
zodb
.
Tid
,
err
error
)
{
func
ZPyCommit
Raw
(
zurl
string
,
at
zodb
.
Tid
,
objv
...
ZRaw
Object
)
(
_
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%s: zcommit @%s"
,
zurl
,
at
)
defer
xerr
.
Contextf
(
&
err
,
"%s: z
py
commit @%s"
,
zurl
,
at
)
// prepare text input for `zodb commit`
// prepare text input for `zodb commit`
zin
:=
&
bytes
.
Buffer
{}
zin
:=
&
bytes
.
Buffer
{}
...
...
go/zodb/import_x_test.go
View file @
d8004baf
...
@@ -34,14 +34,14 @@ func init() {
...
@@ -34,14 +34,14 @@ func init() {
}
}
func
ZPyCommit
(
zurl
string
,
at
zodb
.
Tid
,
objv
...
zodb
.
IPersistent
)
(
zodb
.
Tid
,
error
)
{
func
ZPyCommit
(
zurl
string
,
at
zodb
.
Tid
,
objv
...
zodb
.
IPersistent
)
(
zodb
.
Tid
,
error
)
{
var
zobjv
[]
xtesting
.
Z
Object
// raw zodb objects data to commit
var
rawobjv
[]
xtesting
.
ZRaw
Object
// raw zodb objects data to commit
for
_
,
obj
:=
range
objv
{
for
_
,
obj
:=
range
objv
{
zobj
:=
xtesting
.
Z
Object
{
rawobj
:=
xtesting
.
ZRaw
Object
{
Oid
:
obj
.
POid
(),
Oid
:
obj
.
POid
(),
Data
:
string
(
zodb
.
PSerialize
(
obj
)
.
XData
()),
Data
:
string
(
zodb
.
PSerialize
(
obj
)
.
XData
()),
}
}
zobjv
=
append
(
zobjv
,
z
obj
)
rawobjv
=
append
(
rawobjv
,
raw
obj
)
}
}
return
xtesting
.
ZPyCommit
(
zurl
,
at
,
z
objv
...
)
return
xtesting
.
ZPyCommit
Raw
(
zurl
,
at
,
raw
objv
...
)
}
}
go/zodb/storage/fs1/filestorage_test.go
View file @
d8004baf
...
@@ -358,15 +358,15 @@ func TestWatch(t *testing.T) {
...
@@ -358,15 +358,15 @@ func TestWatch(t *testing.T) {
workdir
:=
xworkdir
(
t
)
workdir
:=
xworkdir
(
t
)
tfs
:=
workdir
+
"/t.fs"
tfs
:=
workdir
+
"/t.fs"
// xcommit commits new transaction into tfs with data specified by objv.
// xcommit commits new transaction into tfs with
raw
data specified by objv.
xcommit
:=
func
(
at
zodb
.
Tid
,
objv
...
xtesting
.
ZObject
)
zodb
.
Tid
{
xcommit
:=
func
(
at
zodb
.
Tid
,
objv
...
xtesting
.
Z
Raw
Object
)
zodb
.
Tid
{
t
.
Helper
()
t
.
Helper
()
tid
,
err
:=
xtesting
.
ZPyCommit
(
tfs
,
at
,
objv
...
);
X
(
err
)
tid
,
err
:=
xtesting
.
ZPyCommit
Raw
(
tfs
,
at
,
objv
...
);
X
(
err
)
return
tid
return
tid
}
}
// force tfs creation & open tfs at go side
// force tfs creation & open tfs at go side
at
:=
xcommit
(
0
,
xtesting
.
ZObject
{
0
,
"data0"
})
at
:=
xcommit
(
0
,
xtesting
.
Z
Raw
Object
{
0
,
"data0"
})
watchq
:=
make
(
chan
zodb
.
CommitEvent
)
watchq
:=
make
(
chan
zodb
.
CommitEvent
)
fs
:=
xfsopenopt
(
t
,
tfs
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
,
Watchq
:
watchq
})
fs
:=
xfsopenopt
(
t
,
tfs
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
,
Watchq
:
watchq
})
...
@@ -407,8 +407,8 @@ func TestWatch(t *testing.T) {
...
@@ -407,8 +407,8 @@ func TestWatch(t *testing.T) {
data0
:=
fmt
.
Sprintf
(
"data0.%d"
,
i
)
data0
:=
fmt
.
Sprintf
(
"data0.%d"
,
i
)
datai
:=
fmt
.
Sprintf
(
"data%d"
,
i
)
datai
:=
fmt
.
Sprintf
(
"data%d"
,
i
)
at
=
xcommit
(
at
,
at
=
xcommit
(
at
,
xtesting
.
ZObject
{
0
,
data0
},
xtesting
.
Z
Raw
Object
{
0
,
data0
},
xtesting
.
ZObject
{
i
,
datai
})
xtesting
.
Z
Raw
Object
{
i
,
datai
})
// TODO also test for watcher errors
// TODO also test for watcher errors
e
:=
<-
watchq
e
:=
<-
watchq
...
...
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