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
Commits
ebb040aa
Unverified
Commit
ebb040aa
authored
Jun 18, 2018
by
Whyrusleeping
Committed by
GitHub
Jun 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5125 from ipfs/fix/5099
make republisher test robust against timing issues
parents
b516aa1c
a9cb26c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
namesys/republisher/repub_test.go
namesys/republisher/repub_test.go
+22
-7
No files found.
namesys/republisher/repub_test.go
View file @
ebb040aa
...
...
@@ -59,18 +59,33 @@ func TestRepublish(t *testing.T) {
publisher
:=
nodes
[
3
]
p
:=
path
.
FromString
(
"/ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
)
// does not need to be valid
rp
:=
namesys
.
NewIpnsPublisher
(
publisher
.
Routing
,
publisher
.
Repo
.
Datastore
())
err
:=
rp
.
PublishWithEOL
(
ctx
,
publisher
.
PrivateKey
,
p
,
time
.
Now
()
.
Add
(
time
.
Second
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
name
:=
"/ipns/"
+
publisher
.
Identity
.
Pretty
()
if
err
:=
verifyResolution
(
nodes
,
name
,
p
);
err
!=
nil
{
// Retry in case the record expires before we can fetch it. This can
// happen when running the test on a slow machine.
var
expiration
time
.
Time
timeout
:=
time
.
Second
for
{
expiration
=
time
.
Now
()
.
Add
(
time
.
Second
)
err
:=
rp
.
PublishWithEOL
(
ctx
,
publisher
.
PrivateKey
,
p
,
expiration
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
err
=
verifyResolution
(
nodes
,
name
,
p
)
if
err
==
nil
{
break
}
if
time
.
Now
()
.
After
(
expiration
)
{
timeout
*=
2
continue
}
t
.
Fatal
(
err
)
}
// Now wait a second, the records will be invalid and we should fail to resolve
time
.
Sleep
(
time
.
Second
)
time
.
Sleep
(
time
out
)
if
err
:=
verifyResolutionFails
(
nodes
,
name
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
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