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
83c151e9
Commit
83c151e9
authored
Dec 14, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8b93ac4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
24 deletions
+5
-24
t/neo/connection_test.go
t/neo/connection_test.go
+5
-24
No files found.
t/neo/connection_test.go
View file @
83c151e9
...
...
@@ -28,23 +28,10 @@ import (
"golang.org/x/sync/errgroup"
"lab.nexedi.com/kirr/go123/exc"
"lab.nexedi.com/kirr/go123/myname"
//
"lab.nexedi.com/kirr/go123/myname"
"lab.nexedi.com/kirr/go123/xerr"
)
// run function which raises exception, and return exception as error, if any
// XXX -> exc.Runx ?
func
runx
(
xf
func
())
(
err
error
)
{
//here := my.FuncName()
here
:=
myname
.
Func
()
defer
exc
.
Catch
(
func
(
e
*
exc
.
Error
)
{
err
=
exc
.
Addcallingcontext
(
here
,
e
)
})
xf
()
return
}
// XXX move me out of here ?
type
workGroup
struct
{
*
errgroup
.
Group
...
...
@@ -53,7 +40,7 @@ type workGroup struct {
// like errgroup.Go but translates exceptions to errors
func
(
wg
*
workGroup
)
Gox
(
xf
func
())
{
wg
.
Go
(
func
()
error
{
return
r
unx
(
xf
)
return
exc
.
R
unx
(
xf
)
})
}
...
...
@@ -178,14 +165,9 @@ func TestNodeLink(t *testing.T) {
}
xwait
(
wg
)
// TODO (?) every func: run with exception catcher (including t.Fatal)
// if caught:
// * ctx.cancel
// * wait all for finish
// * rethrough in main
// check raw exchange works
nl1
,
nl2
=
nodeLinkPipe
()
// check raw exchange works
wg
,
ctx
:=
WorkGroupCtx
(
context
.
Background
())
wg
.
Gox
(
func
()
{
// send ping; wait for pong
...
...
@@ -214,9 +196,9 @@ func TestNodeLink(t *testing.T) {
xwait
(
wgclose
)
/*
// test 1 channels on top of nodelink
nl1
,
nl2
=
nodeLinkPipe
()
c1
:=
nl1
.
NewConn
()
nl2
.
HandleNewConn
(
func
(
c
*
Conn
)
{
pkt
:=
xrecv
(
c
)
// XXX t.Fatal() must be called from main goroutine -> context.Cancel ?
...
...
@@ -229,5 +211,4 @@ func TestNodeLink(t *testing.T) {
// TODO check pkt2 is pkt1 + small modification
// test 2 channels with replies comming in reversed time order
*/
}
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