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
868a1e36
Commit
868a1e36
authored
Jun 16, 2016
by
Jeromy Johnson
Committed by
GitHub
Jun 16, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2857 from ipfs/feature/test-race-blockstore
Remove failing blockstore with context test
parents
a4801ed0
5a08e9e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
90 deletions
+35
-90
blocks/blockstore/blockstore_test.go
blocks/blockstore/blockstore_test.go
+35
-90
No files found.
blocks/blockstore/blockstore_test.go
View file @
868a1e36
...
...
@@ -117,8 +117,6 @@ func TestAllKeysRespectsContext(t *testing.T) {
errors
<-
nil
// a nil one to signal break
}
// Once without context, to make sure it all works
{
var
results
dsq
.
Results
var
resultsmu
=
make
(
chan
struct
{})
resultChan
:=
make
(
chan
dsq
.
Result
)
...
...
@@ -156,59 +154,6 @@ func TestAllKeysRespectsContext(t *testing.T) {
}
t
.
Error
(
err
)
}
}
// Once with
{
var
results
dsq
.
Results
var
resultsmu
=
make
(
chan
struct
{})
resultChan
:=
make
(
chan
dsq
.
Result
)
d
.
SetFunc
(
func
(
q
dsq
.
Query
)
(
dsq
.
Results
,
error
)
{
results
=
dsq
.
ResultsWithChan
(
q
,
resultChan
)
resultsmu
<-
struct
{}{}
return
results
,
nil
})
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
go
getKeys
(
ctx
)
// make sure it's waiting.
<-
started
<-
resultsmu
select
{
case
<-
done
:
t
.
Fatal
(
"sync is wrong"
)
case
<-
results
.
Process
()
.
Closing
()
:
t
.
Fatal
(
"should not be closing"
)
case
<-
results
.
Process
()
.
Closed
()
:
t
.
Fatal
(
"should not be closed"
)
default
:
}
cancel
()
// let it go.
select
{
case
<-
done
:
t
.
Fatal
(
"sync is wrong"
)
case
<-
results
.
Process
()
.
Closed
()
:
t
.
Fatal
(
"should not be closed"
)
// should not be closed yet.
case
<-
results
.
Process
()
.
Closing
()
:
// should be closing now!
t
.
Log
(
"closing correctly at this point."
)
}
close
(
resultChan
)
<-
done
// should be done now.
<-
results
.
Process
()
.
Closed
()
// should be closed now
// print any errors
for
err
:=
range
errors
{
if
err
==
nil
{
break
}
t
.
Error
(
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