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-graphsync
Commits
f07e2e65
Commit
f07e2e65
authored
Jun 11, 2019
by
hannahhoward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(responsemanager): fix tests
parent
6cece715
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
24 deletions
+26
-24
responsemanager/responsemanager_test.go
responsemanager/responsemanager_test.go
+26
-24
No files found.
responsemanager/responsemanager_test.go
View file @
f07e2e65
...
...
@@ -222,31 +222,33 @@ func TestCancellationQueryInProgress(t *testing.T) {
responseManager
.
synchronize
()
// read one block -- to unblock processing
select
{
case
sentResponse
:=
<-
sentResponses
:
k
:=
sentResponse
.
link
.
(
cidlink
.
Link
)
blockIndex
:=
testutil
.
IndexOf
(
blks
,
k
.
Cid
)
if
blockIndex
==
-
1
{
t
.
Fatal
(
"sent incorrect link"
)
}
if
!
reflect
.
DeepEqual
(
sentResponse
.
data
,
blks
[
blockIndex
]
.
RawData
())
{
t
.
Fatal
(
"sent incorrect data"
)
}
if
sentResponse
.
requestID
!=
requestID
{
t
.
Fatal
(
"incorrect response id"
)
// at this point we should receive at most one more block, then traversal
// should complete
additionalMessageCount
:=
0
drainqueue
:
for
{
select
{
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
"Should have completed request but didn't"
)
case
sentResponse
:=
<-
sentResponses
:
if
additionalMessageCount
>
0
{
t
.
Fatal
(
"should not send any more responses"
)
}
k
:=
sentResponse
.
link
.
(
cidlink
.
Link
)
blockIndex
:=
testutil
.
IndexOf
(
blks
,
k
.
Cid
)
if
blockIndex
==
-
1
{
t
.
Fatal
(
"sent incorrect link"
)
}
if
!
reflect
.
DeepEqual
(
sentResponse
.
data
,
blks
[
blockIndex
]
.
RawData
())
{
t
.
Fatal
(
"sent incorrect data"
)
}
if
sentResponse
.
requestID
!=
requestID
{
t
.
Fatal
(
"incorrect response id"
)
}
additionalMessageCount
++
case
<-
requestIDChan
:
break
drainqueue
}
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
"did not send responses"
)
}
// at this point traversal should abort and we should receive a completion
select
{
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
"Should have completed request but didn't"
)
case
<-
sentResponses
:
t
.
Fatal
(
"should not send any more responses"
)
case
<-
requestIDChan
:
}
}
...
...
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