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-merkledag
Commits
7993a94b
Commit
7993a94b
authored
Aug 23, 2015
by
rht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace context.TODO in test files with context.Background
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
44cd2f79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
merkledag_test.go
merkledag_test.go
+6
-6
utils/utils_test.go
utils/utils_test.go
+1
-1
No files found.
merkledag_test.go
View file @
7993a94b
...
@@ -155,6 +155,7 @@ func TestBatchFetchDupBlock(t *testing.T) {
...
@@ -155,6 +155,7 @@ func TestBatchFetchDupBlock(t *testing.T) {
}
}
func
runBatchFetchTest
(
t
*
testing
.
T
,
read
io
.
Reader
)
{
func
runBatchFetchTest
(
t
*
testing
.
T
,
read
io
.
Reader
)
{
ctx
:=
context
.
Background
()
var
dagservs
[]
DAGService
var
dagservs
[]
DAGService
for
_
,
bsi
:=
range
bstest
.
Mocks
(
5
)
{
for
_
,
bsi
:=
range
bstest
.
Mocks
(
5
)
{
dagservs
=
append
(
dagservs
,
NewDAGService
(
bsi
))
dagservs
=
append
(
dagservs
,
NewDAGService
(
bsi
))
...
@@ -169,7 +170,7 @@ func runBatchFetchTest(t *testing.T, read io.Reader) {
...
@@ -169,7 +170,7 @@ func runBatchFetchTest(t *testing.T, read io.Reader) {
t
.
Log
(
"finished setup."
)
t
.
Log
(
"finished setup."
)
dagr
,
err
:=
uio
.
NewDagReader
(
c
ontext
.
TODO
()
,
root
,
dagservs
[
0
])
dagr
,
err
:=
uio
.
NewDagReader
(
c
tx
,
root
,
dagservs
[
0
])
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -196,13 +197,13 @@ func runBatchFetchTest(t *testing.T, read io.Reader) {
...
@@ -196,13 +197,13 @@ func runBatchFetchTest(t *testing.T, read io.Reader) {
wg
.
Add
(
1
)
wg
.
Add
(
1
)
go
func
(
i
int
)
{
go
func
(
i
int
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
first
,
err
:=
dagservs
[
i
]
.
Get
(
c
ontext
.
Background
()
,
k
)
first
,
err
:=
dagservs
[
i
]
.
Get
(
c
tx
,
k
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
fmt
.
Println
(
"Got first node back."
)
fmt
.
Println
(
"Got first node back."
)
read
,
err
:=
uio
.
NewDagReader
(
c
ontext
.
TODO
()
,
first
,
dagservs
[
i
])
read
,
err
:=
uio
.
NewDagReader
(
c
tx
,
first
,
dagservs
[
i
])
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
@@ -266,8 +267,7 @@ func assertCanGet(t *testing.T, ds DAGService, n *Node) {
...
@@ -266,8 +267,7 @@ func assertCanGet(t *testing.T, ds DAGService, n *Node) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
_
,
err
=
ds
.
Get
(
context
.
TODO
(),
k
)
if
_
,
err
:=
ds
.
Get
(
context
.
Background
(),
k
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
}
}
...
@@ -281,7 +281,7 @@ func TestCantGet(t *testing.T) {
...
@@ -281,7 +281,7 @@ func TestCantGet(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
_
,
err
=
dsp
.
ds
.
Get
(
context
.
TODO
(),
k
)
_
,
err
=
dsp
.
ds
.
Get
(
context
.
Background
(),
k
)
if
!
strings
.
Contains
(
err
.
Error
(),
"not found"
)
{
if
!
strings
.
Contains
(
err
.
Error
(),
"not found"
)
{
t
.
Fatal
(
"expected err not found, got: "
,
err
)
t
.
Fatal
(
"expected err not found, got: "
,
err
)
}
}
...
...
utils/utils_test.go
View file @
7993a94b
...
@@ -104,7 +104,7 @@ func testInsert(t *testing.T, e *Editor, path, data string, create bool, experr
...
@@ -104,7 +104,7 @@ func testInsert(t *testing.T, e *Editor, path, data string, create bool, experr
}
}
}
}
err
=
e
.
InsertNodeAtPath
(
context
.
TODO
(),
path
,
ck
,
c
)
err
=
e
.
InsertNodeAtPath
(
context
.
Background
(),
path
,
ck
,
c
)
if
experr
!=
""
{
if
experr
!=
""
{
var
got
string
var
got
string
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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