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
dms3
go-dms3-routing
Commits
3ca26062
Commit
3ca26062
authored
Dec 14, 2016
by
Zander Mackie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testing the rest of the interface
License: MIT Signed-off-by:
Zander Mackie
<
zmackie@gmail.com
>
parent
eac4ce04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
offline/offline_test.go
offline/offline_test.go
+31
-0
No files found.
offline/offline_test.go
View file @
3ca26062
...
@@ -46,3 +46,34 @@ func TestOfflineRouterStorage(t *testing.T) {
...
@@ -46,3 +46,34 @@ func TestOfflineRouterStorage(t *testing.T) {
}
}
}
}
func
TestOfflineRouterLocal
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
nds
:=
ds
.
NewMapDatastore
()
privkey
,
_
,
_
:=
testutil
.
RandTestKeyPair
(
128
)
offline
:=
NewOfflineRouter
(
nds
,
privkey
)
id
,
_
:=
testutil
.
RandPeerID
()
_
,
err
:=
offline
.
FindPeer
(
ctx
,
id
)
if
err
!=
ErrOffline
{
t
.
Fatal
(
"OfflineRouting should alert that its offline"
)
}
cid
,
_
:=
testutil
.
RandCidV0
()
pChan
:=
offline
.
FindProvidersAsync
(
ctx
,
cid
,
1
)
p
,
ok
:=
<-
pChan
if
ok
{
t
.
Fatalf
(
"FindProvidersAsync did not return a closed channel. Instead we got %+v !"
,
p
)
}
cid
,
_
=
testutil
.
RandCidV0
()
err
=
offline
.
Provide
(
ctx
,
cid
)
if
err
!=
ErrOffline
{
t
.
Fatal
(
"OfflineRouting should alert that its offline"
)
}
err
=
offline
.
Bootstrap
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
"You shouldn't be able to bootstrap offline routing."
)
}
}
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