Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: stop using the deprecated io/ioutil package
  • Loading branch information
web3-bot committed Mar 13, 2024
commit c2c6421fbc311df121b2207e692b2c3d14c97ec7
19 changes: 9 additions & 10 deletions ds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"math/rand"
"os"
"sort"
Expand Down Expand Up @@ -33,10 +32,10 @@ var testcases = map[string]string{
// returns datastore, and a function to call on exit.
// (this garbage collects). So:
//
// d, close := newDS(t)
// defer close()
// d, close := newDS(t)
// defer close()
func newDS(t *testing.T) (*Datastore, func()) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
path, err := os.MkdirTemp(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -337,7 +336,7 @@ func TestBatching(t *testing.T) {
}

func TestBatchingRequired(t *testing.T) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
path, err := os.MkdirTemp(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -616,7 +615,7 @@ func TestGC(t *testing.T) {
// this interval is not configurable, we re-open the database
// (the size is always calculated on Open) to make things quick.
func TestDiskUsage(t *testing.T) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
path, err := os.MkdirTemp(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -645,7 +644,7 @@ func TestDiskUsage(t *testing.T) {
}

func TestTxnDiscard(t *testing.T) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
path, err := os.MkdirTemp(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -678,7 +677,7 @@ func TestTxnDiscard(t *testing.T) {
}

func TestTxnCommit(t *testing.T) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
path, err := os.MkdirTemp(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -713,7 +712,7 @@ func TestTxnCommit(t *testing.T) {
}

func TestTxnBatch(t *testing.T) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
path, err := os.MkdirTemp(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -767,7 +766,7 @@ func TestTxnBatch(t *testing.T) {
}

func TestTTL(t *testing.T) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
path, err := os.MkdirTemp(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
Expand Down