Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func SubtestManyKeysAndQuery(t *testing.T) {
var keystrs []string
var values [][]byte
count := 100
for i := 0; i < count; i++ {
for i := range count {
s := fmt.Sprintf("%dkey%d", i, i)
dsk := ds.NewKey(s)
keystrs = append(keystrs, dsk.String())
Expand Down Expand Up @@ -661,7 +661,7 @@ func TestManyKeysAndQuery(t *testing.T) {
var keystrs []string
var values [][]byte
count := 100
for i := 0; i < count; i++ {
for i := range count {
s := fmt.Sprintf("%dkey%d", i, i)
dsk := ds.NewKey(s)
keystrs = append(keystrs, dsk.String())
Expand Down
31 changes: 11 additions & 20 deletions sqlite/ds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ func TestQuery(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

addTestCases(t, d, testcases)

Expand Down Expand Up @@ -175,8 +174,7 @@ func TestHas(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

addTestCases(t, d, testcases)

Expand All @@ -203,8 +201,7 @@ func TestNotExistGet(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

addTestCases(t, d, testcases)

Expand Down Expand Up @@ -234,8 +231,7 @@ func TestDelete(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

addTestCases(t, d, testcases)

Expand Down Expand Up @@ -265,8 +261,7 @@ func TestGetEmpty(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

err := d.Put(ctx, ds.NewKey("/a"), []byte{})
if err != nil {
Expand All @@ -287,8 +282,7 @@ func TestBatching(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

b, err := d.Batch(ctx)
if err != nil {
Expand Down Expand Up @@ -446,8 +440,7 @@ func TestNotFounds(t *testing.T) {

badk := ds.NewKey("notreal")

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

val, err := d.Get(ctx, badk)
if err != ds.ErrNotFound {
Expand Down Expand Up @@ -490,7 +483,7 @@ func SubtestManyKeysAndQuery(t *testing.T) {
var keystrs []string
var values [][]byte
count := 100
for i := 0; i < count; i++ {
for i := range count {
s := fmt.Sprintf("%dkey%d", i, i)
dsk := ds.NewKey(s)
keystrs = append(keystrs, dsk.String())
Expand Down Expand Up @@ -568,8 +561,7 @@ func TestBasicPutGet(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

k := ds.NewKey("foo")
val := []byte("Hello Datastore!")
Expand Down Expand Up @@ -626,14 +618,13 @@ func TestManyKeysAndQuery(t *testing.T) {
d, done := newDS(t)
defer done()

ctx, cancelCtx := context.WithCancel(context.Background())
defer cancelCtx()
ctx := t.Context()

var keys []ds.Key
var keystrs []string
var values [][]byte
count := 100
for i := 0; i < count; i++ {
for i := range count {
s := fmt.Sprintf("%dkey%d", i, i)
dsk := ds.NewKey(s)
keystrs = append(keystrs, dsk.String())
Expand Down
Loading