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-kad-dht
Commits
326973f4
Commit
326973f4
authored
Jun 25, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
providers test with multiple peers
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
c8bc7ce3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
providers/providers_test.go
providers/providers_test.go
+21
-5
No files found.
providers/providers_test.go
View file @
326973f4
...
...
@@ -58,10 +58,17 @@ func TestProvidersSerialization(t *testing.T) {
dstore
:=
ds
.
NewMapDatastore
()
k
:=
key
.
Key
(
"my key!"
)
p
:=
peer
.
ID
(
"my peer"
)
pt
:=
time
.
Now
()
p1
:=
peer
.
ID
(
"peer one"
)
p2
:=
peer
.
ID
(
"peer two"
)
pt1
:=
time
.
Now
()
pt2
:=
pt1
.
Add
(
time
.
Hour
)
err
:=
writeProviderEntry
(
dstore
,
k
,
p
,
pt
)
err
:=
writeProviderEntry
(
dstore
,
k
,
p1
,
pt1
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
err
=
writeProviderEntry
(
dstore
,
k
,
p2
,
pt2
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -71,12 +78,21 @@ func TestProvidersSerialization(t *testing.T) {
t
.
Fatal
(
err
)
}
lt
,
ok
:=
pset
.
set
[
p
]
lt1
,
ok
:=
pset
.
set
[
p1
]
if
!
ok
{
t
.
Fatal
(
"failed to load set correctly"
)
}
if
pt1
!=
lt1
{
t
.
Fatal
(
"time wasnt serialized correctly"
)
}
lt2
,
ok
:=
pset
.
set
[
p2
]
if
!
ok
{
t
.
Fatal
(
"failed to load set correctly"
)
}
if
pt
!=
lt
{
if
pt
2
!=
lt
2
{
t
.
Fatal
(
"time wasnt serialized correctly"
)
}
}
...
...
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