Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-swarm
Commits
27f6c394
Commit
27f6c394
authored
Mar 31, 2021
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add TestSelfDial
parent
acc35e8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
dial_test.go
dial_test.go
+20
-0
No files found.
dial_test.go
View file @
27f6c394
...
...
@@ -651,3 +651,23 @@ func TestDialSimultaneousJoin(t *testing.T) {
t
.
Fatal
(
"no connection from first dial"
)
}
}
func
TestDialSelf
(
t
*
testing
.
T
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
swarms
:=
makeSwarms
(
ctx
,
t
,
2
)
s1
:=
swarms
[
0
]
defer
s1
.
Close
()
_
,
err
:=
s1
.
DialPeer
(
ctx
,
s1
.
LocalPeer
())
if
err
!=
ErrDialToSelf
{
t
.
Fatal
(
"expected error from self dial"
)
}
// do it twice to make sure we get a new active dial object that fails again
_
,
err
=
s1
.
DialPeer
(
ctx
,
s1
.
LocalPeer
())
if
err
!=
ErrDialToSelf
{
t
.
Fatal
(
"expected error from self dial"
)
}
}
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