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
2de637bb
Commit
2de637bb
authored
Dec 18, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
114b7fd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
go/neo/neo_test.go
go/neo/neo_test.go
+12
-17
go/neo/t_misc_test.go
go/neo/t_misc_test.go
+8
-4
No files found.
go/neo/neo_test.go
View file @
2de637bb
...
...
@@ -28,8 +28,6 @@ import (
"reflect"
"testing"
"golang.org/x/sync/errgroup"
"github.com/kylelemons/godebug/pretty"
"lab.nexedi.com/kirr/neo/go/neo/proto"
...
...
@@ -145,8 +143,8 @@ func TestMasterStorage(t0 *testing.T) {
// ----------------------------------------
// M <- start cmd
wg
:=
&
errgroup
.
Group
{}
gox
(
wg
,
func
()
{
wg
:=
xsync
.
NewWorkGroup
(
bg
)
gox
(
wg
,
func
(
ctx
context
.
Context
)
{
err
:=
M
.
Start
();
X
(
err
)
})
...
...
@@ -252,9 +250,9 @@ func TestMasterStorage(t0 *testing.T) {
// ----------------------------------------
// C asks M about last tid XXX better master sends it itself on new client connected
wg
=
&
errgroup
.
Group
{}
gox
(
wg
,
func
()
{
cLastTid
,
err
:=
C
.
Sync
(
bg
);
X
(
err
)
wg
=
xsync
.
NewWorkGroup
(
bg
)
gox
(
wg
,
func
(
ctx
context
.
Context
)
{
cLastTid
,
err
:=
C
.
Sync
(
ctx
);
X
(
err
)
if
cLastTid
!=
lastTid
{
exc
.
Raisef
(
"C.LastTid -> %v ; want %v"
,
cLastTid
,
lastTid
)
...
...
@@ -262,21 +260,18 @@ func TestMasterStorage(t0 *testing.T) {
})
tCM
.
Expect
(
conntx
(
"c:1"
,
"m:3"
,
5
,
&
proto
.
LastTransaction
{}))
tCM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
5
,
&
proto
.
AnswerLastTransaction
{
Tid
:
lastTid
,
}))
tCM
.
Expect
(
conntx
(
"m:3"
,
"c:1"
,
5
,
&
proto
.
AnswerLastTransaction
{
lastTid
}))
xwait
(
wg
)
// ----------------------------------------
// C starts loading first object ...
wg
=
&
errgroup
.
Group
{}
wg
=
xsync
.
NewWorkGroup
(
bg
)
xid1
:=
zodb
.
Xid
{
Oid
:
1
,
At
:
zodb
.
TidMax
}
buf1
,
serial1
,
err
:=
zstor
.
Load
(
bg
,
xid1
);
X
(
err
)
gox
(
wg
,
func
()
{
buf
,
serial
,
err
:=
C
.
Load
(
bg
,
xid1
);
X
(
err
)
gox
(
wg
,
func
(
ctx
context
.
Context
)
{
buf
,
serial
,
err
:=
C
.
Load
(
ctx
,
xid1
);
X
(
err
)
if
!
(
bytes
.
Equal
(
buf
.
Data
,
buf1
.
Data
)
&&
serial
==
serial1
)
{
exc
.
Raisef
(
"C.Load(%v) ->
\n
data:
\n
%s
\n
serial:
\n
%s
\n
"
,
xid1
,
...
...
@@ -328,11 +323,11 @@ func TestMasterStorage(t0 *testing.T) {
// verify NextSerial is properly returned in AnswerObject via trace-loading prev. revision of obj1
// (XXX we currently need NextSerial for neo/py client cache)
wg
=
&
errgroup
.
Group
{}
wg
=
xsync
.
NewWorkGroup
(
bg
)
xid1prev
:=
zodb
.
Xid
{
Oid
:
1
,
At
:
serial1
-
1
}
buf1prev
,
serial1prev
,
err
:=
zstor
.
Load
(
bg
,
xid1prev
);
X
(
err
)
gox
(
wg
,
func
()
{
buf
,
serial
,
err
:=
C
.
Load
(
bg
,
xid1prev
);
X
(
err
)
gox
(
wg
,
func
(
ctx
context
.
Context
)
{
buf
,
serial
,
err
:=
C
.
Load
(
ctx
,
xid1prev
);
X
(
err
)
if
!
(
bytes
.
Equal
(
buf
.
Data
,
buf1prev
.
Data
)
&&
serial
==
serial1prev
)
{
exc
.
Raisef
(
"C.Load(%v) ->
\n
data:
\n
%s
\n
serial:
\n
%s
\n
"
,
xid1prev
,
...
...
go/neo/t_misc_test.go
View file @
2de637bb
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
// Copyright (C) 2017
-2020
Nexedi SA and Contributors.
//
Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
...
...
@@ -36,8 +36,12 @@ func xwait(w interface { Wait() error }) {
exc
.
Raiseif
(
err
)
}
func
gox
(
wg
interface
{
Go
(
func
()
error
)
},
xf
func
())
{
wg
.
Go
(
exc
.
Funcx
(
xf
))
func
gox
(
wg
interface
{
Go
(
func
(
context
.
Context
)
error
)
},
xf
func
(
context
.
Context
))
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
return
exc
.
Funcx
(
func
()
{
xf
(
ctx
)
})()
})
}
func
xfs1stor
(
path
string
)
*
zfs1
.
FileStorage
{
...
...
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