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
d8004baf
Commit
d8004baf
authored
Jan 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d4e577aa
Changes
3
Show 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) {
return
}
// Z
Object represents object state to be committed
.
type
ZObject
struct
{
// Z
RawObject represents raw ZODB object state
.
type
Z
Raw
Object
struct
{
Oid
zodb
.
Oid
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.
func
ZPyCommit
(
zurl
string
,
at
zodb
.
Tid
,
objv
...
Z
Object
)
(
_
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%s: zcommit @%s"
,
zurl
,
at
)
func
ZPyCommit
Raw
(
zurl
string
,
at
zodb
.
Tid
,
objv
...
ZRaw
Object
)
(
_
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"%s: z
py
commit @%s"
,
zurl
,
at
)
// prepare text input for `zodb commit`
zin
:=
&
bytes
.
Buffer
{}
...
...
go/zodb/import_x_test.go
View file @
d8004baf
...
...
@@ -34,14 +34,14 @@ func init() {
}
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
{
zobj
:=
xtesting
.
Z
Object
{
rawobj
:=
xtesting
.
ZRaw
Object
{
Oid
:
obj
.
POid
(),
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) {
workdir
:=
xworkdir
(
t
)
tfs
:=
workdir
+
"/t.fs"
// xcommit commits new transaction into tfs with data specified by objv.
xcommit
:=
func
(
at
zodb
.
Tid
,
objv
...
xtesting
.
ZObject
)
zodb
.
Tid
{
// xcommit commits new transaction into tfs with
raw
data specified by objv.
xcommit
:=
func
(
at
zodb
.
Tid
,
objv
...
xtesting
.
Z
Raw
Object
)
zodb
.
Tid
{
t
.
Helper
()
tid
,
err
:=
xtesting
.
ZPyCommit
(
tfs
,
at
,
objv
...
);
X
(
err
)
tid
,
err
:=
xtesting
.
ZPyCommit
Raw
(
tfs
,
at
,
objv
...
);
X
(
err
)
return
tid
}
// 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
)
fs
:=
xfsopenopt
(
t
,
tfs
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
,
Watchq
:
watchq
})
...
...
@@ -407,8 +407,8 @@ func TestWatch(t *testing.T) {
data0
:=
fmt
.
Sprintf
(
"data0.%d"
,
i
)
datai
:=
fmt
.
Sprintf
(
"data%d"
,
i
)
at
=
xcommit
(
at
,
xtesting
.
ZObject
{
0
,
data0
},
xtesting
.
ZObject
{
i
,
datai
})
xtesting
.
Z
Raw
Object
{
0
,
data0
},
xtesting
.
Z
Raw
Object
{
i
,
datai
})
// TODO also test for watcher errors
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