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
2f2fccf2
Commit
2f2fccf2
authored
Mar 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
09d4b801
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
10 deletions
+94
-10
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+24
-5
t/neo/storage/fs1/py/gen-testdata
t/neo/storage/fs1/py/gen-testdata
+4
-1
t/neo/storage/fs1/testdata_expect_test.go
t/neo/storage/fs1/testdata_expect_test.go
+66
-4
No files found.
t/neo/storage/fs1/filestorage_test.go
View file @
2f2fccf2
...
...
@@ -38,6 +38,7 @@ type txnEntry struct {
Header
DataHeader
rawData
[]
byte
// what is on disk, e.g. it can be backpointer
userData
[]
byte
// data client should see on load; nil means same as RawData
dataTid
zodb
.
Tid
// data tid client should see on iter; 0 means same as Header.Tid
}
// Data returns data a client should see
...
...
@@ -49,6 +50,15 @@ func (txe *txnEntry) Data() []byte {
return
data
}
// DataTid returns data tid a client should see
func
(
txe
*
txnEntry
)
DataTid
()
zodb
.
Tid
{
dataTid
:=
txe
.
dataTid
if
dataTid
==
0
{
dataTid
=
txe
.
Header
.
Tid
}
return
dataTid
}
// successfull result of load for an oid
type
oidLoadedOk
struct
{
tid
zodb
.
Tid
...
...
@@ -127,7 +137,7 @@ func testIterate(t *testing.T, fs *FileStorage, tidMin, tidMax zodb.Tid, expectv
for
k
:=
0
;
;
k
++
{
txnErrorf
:=
func
(
format
string
,
a
...
interface
{})
{
subj
:=
fmt
.
Sprintf
(
"iterating %v..%v: step %v
/%v:"
,
tidMin
,
tidMax
,
k
+
1
,
len
(
expectv
))
subj
:=
fmt
.
Sprintf
(
"iterating %v..%v: step %v
#%v"
,
tidMin
,
tidMax
,
k
,
len
(
expectv
))
msg
:=
fmt
.
Sprintf
(
format
,
a
...
)
t
.
Errorf
(
"%v: %v"
,
subj
,
msg
)
}
...
...
@@ -155,13 +165,20 @@ func testIterate(t *testing.T, fs *FileStorage, tidMin, tidMax zodb.Tid, expectv
if
txni
!=
&
fsi
.
txnIter
.
Txnh
.
TxnInfo
{
t
.
Fatal
(
"unexpected txni pointer"
)
}
if
!
reflect
.
DeepEqual
(
fsi
.
txnIter
.
Txnh
,
dbe
.
Header
)
{
txnErrorf
(
"unexpected txn entry:
\n
have: %q
\n
want: %q"
,
fsi
.
txnIter
.
Txnh
,
dbe
.
Header
)
// compare transaction headers modulo .workMem
// (workMem is not initialized in _1fs_dbEntryv)
txnh1
:=
fsi
.
txnIter
.
Txnh
txnh2
:=
dbe
.
Header
txnh1
.
workMem
=
nil
txnh2
.
workMem
=
nil
if
!
reflect
.
DeepEqual
(
txnh1
,
txnh2
)
{
txnErrorf
(
"unexpected txn entry:
\n
have: %q
\n
want: %q"
,
txnh1
,
txnh2
)
}
for
kdata
:=
0
;
;
kdata
++
{
dataErrorf
:=
func
(
format
string
,
a
...
interface
{})
{
dsubj
:=
fmt
.
Sprintf
(
"dstep %v
/
%v"
,
kdata
,
len
(
dbe
.
Entryv
))
dsubj
:=
fmt
.
Sprintf
(
"dstep %v
#
%v"
,
kdata
,
len
(
dbe
.
Entryv
))
msg
:=
fmt
.
Sprintf
(
format
,
a
...
)
txnErrorf
(
"%v: %v"
,
dsubj
,
msg
)
}
...
...
@@ -205,7 +222,9 @@ func testIterate(t *testing.T, fs *FileStorage, tidMin, tidMax zodb.Tid, expectv
dataErrorf
(
"data mismatch:
\n
have %q
\n
want %q"
,
datai
.
Data
,
txe
.
Data
())
}
// TODO .DataTid
if
datai
.
DataTid
!=
txe
.
DataTid
()
{
dataErrorf
(
"data tid mismatch: have %v; want %v"
,
datai
.
DataTid
,
txe
.
DataTid
())
}
}
}
}
...
...
t/neo/storage/fs1/py/gen-testdata
View file @
2f2fccf2
...
...
@@ -171,13 +171,16 @@ def main():
plen
=
dh
.
plen
if
plen
==
0
:
rawdata
=
p64
(
dh
.
back
)
# back-pointer or 0 (= delete)
data
=
"/* from %s */ []byte(%s)"
%
(
hex64
(
drec
.
data_txn
),
escapeqq
(
drec
.
data
))
# XXX vs .data = None ?
data
=
"[]byte(%s)"
%
escapeqq
(
drec
.
data
)
datatid
=
hex64
(
drec
.
data_txn
)
# XXX vs .data = None ?
else
:
rawdata
=
drec
.
data
data
=
"/* same as ^^^ */ nil"
datatid
=
"/* same as ^^^ */ 0"
emit
(
"
\
t
\
t
\
t
\
t
[]byte(%s),"
%
escapeqq
(
rawdata
))
emit
(
"
\
t
\
t
\
t
\
t
%s,"
%
data
)
emit
(
"
\
t
\
t
\
t
\
t
%s,"
%
datatid
)
emit
(
"
\
t
\
t
\
t
},"
)
emit
(
"
\
t
\
t
},"
)
...
...
t/neo/storage/fs1/testdata_expect_test.go
View file @
2f2fccf2
This diff is collapsed.
Click to expand it.
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