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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
0d1ba52e
Commit
0d1ba52e
authored
Mar 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e08c206a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
39 deletions
+49
-39
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+49
-39
No files found.
t/neo/storage/fs1/filestorage_test.go
View file @
0d1ba52e
...
@@ -15,6 +15,8 @@ package fs1
...
@@ -15,6 +15,8 @@ package fs1
import
(
import
(
"bytes"
"bytes"
"fmt"
"io"
"reflect"
"reflect"
"testing"
"testing"
...
@@ -109,62 +111,70 @@ func TestLoad(t *testing.T) {
...
@@ -109,62 +111,70 @@ func TestLoad(t *testing.T) {
// check iterating XXX move to separate test ?
// check iterating XXX move to separate test ?
// tids we will use for tid{Min,Max}
// tids we will use for tid{Min,Max}
tidv
:=
[]
zodb
.
Tid
{
zodb
.
Tid
(
0
)
}
tidv
:=
[]
zodb
.
Tid
{}
for
_
,
dbe
:=
range
_1fs_dbEntryv
{
for
_
,
dbe
:=
range
_1fs_dbEntryv
{
//tidv = append(tidv, dbe.Header.Tid-1) // XXX here?
tidv
=
append
(
tidv
,
dbe
.
Header
.
Tid
)
tidv
=
append
(
tidv
,
dbe
.
Header
.
Tid
)
//tidv = append(tidv, dbe.Header.Tid+1) // XXX here?
}
}
tidv
=
append
(
tidv
,
zodb
.
TidMax
)
// XXX i -> iMin, j -> iMax ?
// XXX i -> iMin, j -> iMax ?
for
i
,
tidMin
:=
range
tidv
{
for
i
,
tidMin
:=
range
tidv
{
// TODO test both tidMin, and tidMin - 1
minv
:=
[]
zodb
.
Tid
{
tidMin
-
1
,
tidMin
,
tidMin
+
1
}
for
j
,
tidMax
:=
range
tidv
{
for
j
,
tidMax
:=
range
tidv
{
// TODO test both tidMax, and tidMax + 1
maxv
:=
[]
zodb
.
Tid
{
tidMax
-
1
,
tidMax
,
tidMax
+
1
}
_
=
j
// XXX
iter
:=
fs
.
Iterate
(
tidMin
,
tidMax
)
for
ii
,
tmin
:=
range
minv
{
for
jj
,
tmax
:=
range
maxv
{
iter
:=
fs
.
Iterate
(
tmin
,
tmax
)
// expected number of iteration steps
nsteps
:=
j
-
i
+
1
nsteps
-=
ii
/
2
// one less point for tidMin+1
nsteps
-=
(
2
-
jj
)
/
2
// one less point for tidMax-1
if
nsteps
<
0
{
nsteps
=
0
// j < i and j == i and ii/jj
}
if
tidMin
>
tidMax
{
for
k
:=
0
;
;
k
++
{
// expect error / panic or empty iteration ?
subj
:=
fmt
.
Sprintf
(
"iterating %v..%v: step %v/%v"
,
tmin
,
tmax
,
k
+
1
,
nsteps
)
}
if
k
>=
nsteps
{
t
.
Errorf
(
"%v: steps overrun"
,
subj
)
}
//txni := zodb.TxnInfo{}
txni
,
dataIter
,
err
:=
iter
.
NextTxn
()
//datai := zodb.StorageRecordInformation{}
if
err
!=
nil
{
if
err
==
io
.
EOF
{
if
k
!=
nsteps
-
1
{
t
.
Errorf
(
"%v: steps underrun"
,
subj
)
}
break
}
t
.
Errorf
(
"%v: %v"
,
subj
,
err
)
}
for
k
:=
0
;
;
k
++
{
dbe
:=
_1fs_dbEntryv
[
i
+
k
]
txni
,
dataIter
,
err
:=
iter
.
NextTxn
()
if
err
!=
nil
{
err
=
okEOF
(
err
)
break
}
// XXX vvv assumes i < j
// TODO also check .Pos, .LenPrev, .Len
// FIXME first tidMin and last tidMax
if
!
reflect
.
DeepEqual
(
*
txni
,
dbe
.
Header
.
TxnInfo
)
{
dbe
:=
_1fs_dbEntryv
[
i
+
k
]
// XXX fatal temp
t
.
Fatalf
(
"%v: unexpected txn entry:
\n
have: %q
\n
want: %q"
,
subj
,
*
txni
,
dbe
.
Header
.
TxnInfo
)
}
// TODO also check .Pos, .LenPrev, .Len
for
{
if
!
reflect
.
DeepEqual
(
*
txni
,
dbe
.
Header
.
TxnInfo
)
{
datai
,
err
:=
dataIter
.
NextData
()
t
.
Errorf
(
"iterating %v..%v: step %v: unexpected txn entry:
\n
have: %q
\n
want: %q"
,
tidMin
,
tidMax
,
k
,
*
txni
,
dbe
.
Header
.
TxnInfo
)
if
err
!=
nil
{
}
err
=
okEOF
(
err
)
break
}
for
{
_
=
datai
datai
,
err
:=
dataIter
.
NextData
()
}
if
err
!=
nil
{
err
=
okEOF
(
err
)
break
}
_
=
datai
// TODO check err
}
// TODO check err
}
}
}
}
// TODO check err
}
}
}
}
}
}
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