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
85a6574c
Commit
85a6574c
authored
Mar 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a243d4e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
go/zodb/storage/demo/demo_test.go
go/zodb/storage/demo/demo_test.go
+12
-6
No files found.
go/zodb/storage/demo/demo_test.go
View file @
85a6574c
...
@@ -20,9 +20,14 @@
...
@@ -20,9 +20,14 @@
package
demo
package
demo
import
(
import
(
"bytes"
"context"
"regexp"
"testing"
"testing"
"lab.nexedi.com/kirr/neo/go/internal/xtesting"
"lab.nexedi.com/kirr/neo/go/internal/xtesting"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/zodbtools"
)
)
// tOptions represents options for testing.
// tOptions represents options for testing.
...
@@ -48,8 +53,8 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr
...
@@ -48,8 +53,8 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr
zdump
:=
""
zdump
:=
""
if
opt
.
Preload
!=
""
{
if
opt
.
Preload
!=
""
{
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
buf
:=
bytes
.
Buffer
{}
buf
:=
&
bytes
.
Buffer
{}
stor
,
_
,
err
:=
fs1
.
Open
(
ctx
,
opt
.
Preload
,
&
zodb
.
Driver
Options
{
ReadOnly
:
true
});
X
(
err
)
stor
,
err
:=
zodb
.
Open
(
ctx
,
opt
.
Preload
,
&
zodb
.
Open
Options
{
ReadOnly
:
true
});
X
(
err
)
err
=
zodbtools
.
Dump
(
ctx
,
buf
,
stor
,
0
,
zodb
.
TidMax
,
/*hashonly=*/
false
)
err
=
zodbtools
.
Dump
(
ctx
,
buf
,
stor
,
0
,
zodb
.
TidMax
,
/*hashonly=*/
false
)
stor
.
Close
()
stor
.
Close
()
X
(
err
)
X
(
err
)
...
@@ -57,7 +62,7 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr
...
@@ -57,7 +62,7 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr
}
}
// split zdump into transactions
// split zdump into transactions
// TODO -> zodbtools.DumpReader
//
XXX hacky;
TODO -> zodbtools.DumpReader
txnRe
:=
regexp
.
MustCompile
(
`^txn (?P<tid>[0-9a-f]{16}) "(?P<status>.)"$`
)
txnRe
:=
regexp
.
MustCompile
(
`^txn (?P<tid>[0-9a-f]{16}) "(?P<status>.)"$`
)
type
zdumpTxn
struct
{
type
zdumpTxn
struct
{
tid
zodb
.
Tid
tid
zodb
.
Tid
...
@@ -68,12 +73,13 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr
...
@@ -68,12 +73,13 @@ func withDemoStorage(t *testing.T, f func(t *testing.T, dsrv *Storage/*XXX -> Sr
// [m[0]:m[1]] refer to whole txn line
// [m[0]:m[1]] refer to whole txn line
__
:=
zdump
[
m
[
2
]
:
m
[
3
]]
__
:=
zdump
[
m
[
2
]
:
m
[
3
]]
tid
,
err
:=
zodb
.
ParseTid
(
__
);
X
(
err
)
tid
,
err
:=
zodb
.
ParseTid
(
__
);
X
(
err
)
txnv
=
append
(
txnv
,
zdumpTxn
{
tid
,
m
[
0
])
txnv
=
append
(
txnv
,
zdumpTxn
{
tid
,
m
[
0
]
}
)
}
}
// verify on all combinations of preload being split into base+δ
// verify on all combinations of preload being split into base+δ
txnv
,
err
:=
xtesting
.
LoadDBHistory
(
opt
.
Preload
);
X
(
err
)
/*
txnv, err := xtesting.LoadDBHistory(opt.Preload); X(err)
_ = txnv
_ = 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