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
interface-go-dms3-core
Commits
1c94e621
Unverified
Commit
1c94e621
authored
Sep 27, 2019
by
Steven Allen
Committed by
GitHub
Sep 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #45 from ipfs/fix/flaky-pubsub-test
fix(test): fix a flaky pubsub test
parents
10d20732
00de46e2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
tests/pubsub.go
tests/pubsub.go
+15
-1
No files found.
tests/pubsub.go
View file @
1c94e621
...
...
@@ -34,13 +34,20 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) {
t
.
Fatal
(
err
)
}
done
:=
make
(
chan
struct
{})
go
func
()
{
defer
close
(
done
)
ticker
:=
time
.
NewTicker
(
100
*
time
.
Millisecond
)
defer
ticker
.
Stop
()
for
{
err
:=
apis
[
1
]
.
PubSub
()
.
Publish
(
ctx
,
"testch"
,
[]
byte
(
"hello world"
))
if
err
!=
nil
{
switch
err
{
case
nil
:
case
context
.
Canceled
:
return
default
:
t
.
Error
(
err
)
cancel
()
return
...
...
@@ -53,6 +60,13 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) {
}
}()
// Wait for the sender to finish before we return.
// Otherwise, we can get random errors as publish fails.
defer
func
()
{
cancel
()
<-
done
}()
m
,
err
:=
sub
.
Next
(
ctx
)
if
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