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
503c430b
Commit
503c430b
authored
Feb 23, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3610f045
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
t/neo/connection_test.go
t/neo/connection_test.go
+6
-0
t/neo/storage/fs1/filestorage_test.go
t/neo/storage/fs1/filestorage_test.go
+7
-7
No files found.
t/neo/connection_test.go
View file @
503c430b
...
@@ -123,6 +123,12 @@ func xverifyPkt(pkt *PktBuf, connid uint32, msgcode uint16, payload []byte) {
...
@@ -123,6 +123,12 @@ func xverifyPkt(pkt *PktBuf, connid uint32, msgcode uint16, payload []byte) {
// delay a bit
// delay a bit
// needed e.g. to test Close interaction with waiting read or write
// needed e.g. to test Close interaction with waiting read or write
// (we cannot easily sync and make sure e.g. read is started and became asleep)
// (we cannot easily sync and make sure e.g. read is started and became asleep)
//
// XXX JM suggested to really wait till syscall starts this way:
// - via polling get traceback for thread that is going to call syscall and eventuall block
// - if from that traceback we can see that blocking syscall is already called
// -> this way we can know that it is already blocking and thus sleep-hack can be avoided
// this can be done via runtime/pprof -> "goroutine" predefined profile
func
tdelay
()
{
func
tdelay
()
{
time
.
Sleep
(
1
*
time
.
Millisecond
)
time
.
Sleep
(
1
*
time
.
Millisecond
)
}
}
...
...
t/neo/storage/fs1/filestorage_test.go
View file @
503c430b
...
@@ -4,7 +4,6 @@ package fs1
...
@@ -4,7 +4,6 @@ package fs1
import
(
import
(
"bytes"
"bytes"
"strconv"
"testing"
"testing"
"../../zodb"
"../../zodb"
...
@@ -12,13 +11,13 @@ import (
...
@@ -12,13 +11,13 @@ import (
// one entry inside transaction
// one entry inside transaction
type
txnEntry
struct
{
type
txnEntry
struct
{
Header
DataHeader
Header
DataHeader
rawData
[]
byte
// what is on disk, e.g. it can be backpointer
rawData
[]
byte
// what is on disk, e.g. it can be backpointer
data
[]
byte
// data client should see on load; nil means same as RawData
userData
[]
byte
// data client should see on load; nil means same as RawData
}
}
func
(
txe
*
txnEntry
)
Data
()
[]
byte
{
func
(
txe
*
txnEntry
)
Data
()
[]
byte
{
data
:=
txe
.
d
ata
data
:=
txe
.
userD
ata
if
data
==
nil
{
if
data
==
nil
{
data
=
txe
.
rawData
data
=
txe
.
rawData
}
}
...
@@ -40,7 +39,8 @@ func TestLoad(t *testing.T) {
...
@@ -40,7 +39,8 @@ func TestLoad(t *testing.T) {
for
_
,
txe
:=
range
dbe
.
Entryv
{
for
_
,
txe
:=
range
dbe
.
Entryv
{
txh
:=
txe
.
Header
txh
:=
txe
.
Header
xid
:=
zodb
.
Xid
{
zodb
.
XTid
{
txh
.
Tid
,
false
},
txh
.
Oid
}
// loadSerial
// loadSerial
xid
:=
zodb
.
Xid
{
zodb
.
XTid
{
txh
.
Tid
,
false
},
txh
.
Oid
}
data
,
tid
,
err
:=
fs
.
Load
(
xid
)
data
,
tid
,
err
:=
fs
.
Load
(
xid
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"load %v: %v"
,
xid
,
err
)
t
.
Errorf
(
"load %v: %v"
,
xid
,
err
)
...
@@ -49,7 +49,7 @@ func TestLoad(t *testing.T) {
...
@@ -49,7 +49,7 @@ func TestLoad(t *testing.T) {
t
.
Errorf
(
"load %v: returned tid unexpected: %v"
,
xid
,
tid
)
t
.
Errorf
(
"load %v: returned tid unexpected: %v"
,
xid
,
tid
)
}
}
if
!
bytes
.
Equal
(
data
,
txe
.
Data
())
{
if
!
bytes
.
Equal
(
data
,
txe
.
Data
())
{
t
.
Errorf
(
"load %v: different data:
\n
have: %
s
\n
want: %s"
,
xid
,
strconv
.
Quote
(
string
(
data
)),
strconv
.
Quote
(
string
(
txe
.
Data
())
))
t
.
Errorf
(
"load %v: different data:
\n
have: %
q
\n
want: %q"
,
xid
,
data
,
txe
.
Data
(
))
}
}
}
}
}
}
...
...
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