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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
051cf040
Commit
051cf040
authored
Feb 20, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1d807b7c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
go/zodb/persistent_test.go
go/zodb/persistent_test.go
+5
-5
No files found.
go/zodb/persistent_test.go
View file @
051cf040
...
@@ -192,6 +192,8 @@ func TestPersistentBasic(t *testing.T) {
...
@@ -192,6 +192,8 @@ func TestPersistentBasic(t *testing.T) {
}()
}()
}
}
// ---- TestPersistentDB ----
// zcacheControl is simple live cache control that prevents specified objects
// zcacheControl is simple live cache control that prevents specified objects
// to be evicted from live cache.
// to be evicted from live cache.
type
zcacheControl
struct
{
type
zcacheControl
struct
{
...
@@ -207,8 +209,6 @@ func (cc *zcacheControl) WantEvict(obj IPersistent) bool {
...
@@ -207,8 +209,6 @@ func (cc *zcacheControl) WantEvict(obj IPersistent) bool {
return
true
return
true
}
}
// ---- TestPersistentDB ----
// tPersistentDB represents one testing environment inside TestPersistentDB.
// tPersistentDB represents one testing environment inside TestPersistentDB.
type
tPersistentDB
struct
{
type
tPersistentDB
struct
{
*
testing
.
T
*
testing
.
T
...
@@ -340,6 +340,7 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -340,6 +340,7 @@ func TestPersistentDB(t0 *testing.T) {
stor
,
err
:=
OpenStorage
(
ctx
,
zurl
,
&
OpenOptions
{
ReadOnly
:
true
});
X
(
err
)
stor
,
err
:=
OpenStorage
(
ctx
,
zurl
,
&
OpenOptions
{
ReadOnly
:
true
});
X
(
err
)
db
:=
NewDB
(
stor
)
db
:=
NewDB
(
stor
)
// testopen opens new db transaction/connection and wraps it with tPersistentDB.
testopen
:=
func
(
opt
*
ConnOptions
)
*
tPersistentDB
{
testopen
:=
func
(
opt
*
ConnOptions
)
*
tPersistentDB
{
t0
.
Helper
()
t0
.
Helper
()
...
@@ -369,8 +370,6 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -369,8 +370,6 @@ func TestPersistentDB(t0 *testing.T) {
// do not evict obj2 from live cache. obj1 is ok to be evicted.
// do not evict obj2 from live cache. obj1 is ok to be evicted.
zcache1
:=
t
.
conn
.
Cache
()
zcache1
:=
t
.
conn
.
Cache
()
zcache1
.
SetControl
(
&
zcacheControl
{[]
Oid
{
_obj2
.
oid
}})
zcache1
.
SetControl
(
&
zcacheControl
{[]
Oid
{
_obj2
.
oid
}})
// FIXME test that live cache keeps objects live even if we drop all
// regular pointers to it and do GC.
// get objects
// get objects
obj1
:=
t
.
Get
(
101
)
obj1
:=
t
.
Get
(
101
)
...
@@ -476,7 +475,8 @@ func TestPersistentDB(t0 *testing.T) {
...
@@ -476,7 +475,8 @@ func TestPersistentDB(t0 *testing.T) {
t
.
checkObj
(
obj1
,
101
,
InvalidTid
,
GHOST
,
0
)
t
.
checkObj
(
obj1
,
101
,
InvalidTid
,
GHOST
,
0
)
t
.
checkObj
(
obj2
,
102
,
at2
,
UPTODATE
,
0
,
"kitty"
)
t
.
checkObj
(
obj2
,
102
,
at2
,
UPTODATE
,
0
,
"kitty"
)
// TODO live cache must not drop pinned entries after GC
// FIXME test that live cache keeps pinned object live even if we drop
// all regular pointers to it and do GC.
/*
/*
obj1 = nil
obj1 = nil
obj2 = nil
obj2 = nil
...
...
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