Skip to content

Commit

Permalink
Merge pull request #5 from AndersonBargas/updates
Browse files Browse the repository at this point in the history
Updates old packages and replaces one deprecated package usage.
  • Loading branch information
AndersonBargas authored Jan 7, 2024
2 parents 585e720 + a5f4c6a commit 8e33774
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 51 deletions.
5 changes: 2 additions & 3 deletions codec/protobuf/protobuf_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package protobuf

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -19,7 +18,7 @@ func TestProtobuf(t *testing.T) {
}

func TestSave(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"), rainstorm.Codec(Codec))
u1 := SimpleUser{ID: 1, Name: "John"}
Expand All @@ -32,7 +31,7 @@ func TestSave(t *testing.T) {
}

func TestGetSet(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"), rainstorm.Codec(Codec))
err := db.Set("bucket", "key", "value")
Expand Down
7 changes: 3 additions & 4 deletions examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rainstorm_test

import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand All @@ -15,7 +14,7 @@ import (
)

func ExampleDB_Save() {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)

type User struct {
Expand Down Expand Up @@ -195,7 +194,7 @@ func ExampleSkip() {
}

func ExampleUseDB() {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)

bDB, err := bolt.Open(filepath.Join(dir, "bolt.db"), 0600, &bolt.Options{Timeout: 10 * time.Second})
Expand Down Expand Up @@ -516,7 +515,7 @@ type Note struct {
}

func prepareDB() (string, *rainstorm.DB) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))

for i, name := range []string{"John", "Eric", "Dilbert"} {
Expand Down
3 changes: 1 addition & 2 deletions finder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rainstorm

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -491,7 +490,7 @@ func TestOne(t *testing.T) {
}

func TestOneNotWritable(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := Open(filepath.Join(dir, "rainstorm.db"))

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ module github.com/AndersonBargas/rainstorm/v5
require (
github.com/DataDog/zstd v1.4.1 // indirect
github.com/Sereal/Sereal v0.0.0-20200820125258-a016b7cda3f3
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.3.2
github.com/golang/snappy v0.0.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.2
github.com/stretchr/testify v1.8.1
github.com/vmihailenco/msgpack v4.0.4+incompatible
go.etcd.io/bbolt v1.3.4
go.etcd.io/bbolt v1.3.8
golang.org/x/net v0.0.0-20191105084925-a882066a44e0 // indirect
golang.org/x/sys v0.16.0 // indirect
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)
Expand Down
30 changes: 20 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,42 +1,52 @@
github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Sereal/Sereal v0.0.0-20190618215532-0b8ac451a863 h1:BRrxwOZBolJN4gIwvZMJY1tzqBvQgpaZiQRuIDD40jM=
github.com/Sereal/Sereal v0.0.0-20190618215532-0b8ac451a863/go.mod h1:D0JMgToj/WdxCgd30Kc1UcA9E+WdZoJqeVOuYW7iTBM=
github.com/Sereal/Sereal v0.0.0-20200820125258-a016b7cda3f3 h1:XgiXcABXIRyuLNyKHIk6gICrVXcGooDUxR+XMRr2QDM=
github.com/Sereal/Sereal v0.0.0-20200820125258-a016b7cda3f3/go.mod h1:D0JMgToj/WdxCgd30Kc1UcA9E+WdZoJqeVOuYW7iTBM=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20191105084925-a882066a44e0 h1:QPlSTtPE2k6PZPasQUbzuK3p9JbS+vMXYVto8g/yrsg=
golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
15 changes: 7 additions & 8 deletions index/id_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package index_test

import (
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -26,7 +25,7 @@ type SimpleProduct struct {
}

func TestIDIndex(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -62,7 +61,7 @@ func TestIDIndex(t *testing.T) {
}

func TestIDIndexPrefix(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -112,7 +111,7 @@ func TestIDIndexPrefix(t *testing.T) {
}

func TestIDIndexRange(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -159,7 +158,7 @@ func TestIDIndexRange(t *testing.T) {
}

func TestIDIndexParams(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -198,7 +197,7 @@ func TestIDIndexParams(t *testing.T) {
}

/*func TestIDIndex(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -303,7 +302,7 @@ func TestIDIndexParams(t *testing.T) {
}
func TestIDIndexRange(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -375,7 +374,7 @@ func TestIDIndexRange(t *testing.T) {
}
func TestIDIndexPrefix(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down
13 changes: 6 additions & 7 deletions index/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package index_test
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -16,7 +15,7 @@ import (
)

func TestListIndex(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -165,7 +164,7 @@ func TestListIndex(t *testing.T) {
}

func TestListIndexReverse(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -210,7 +209,7 @@ func TestListIndexReverse(t *testing.T) {
}

func TestListIndexAddRemoveID(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -254,7 +253,7 @@ func TestListIndexAddRemoveID(t *testing.T) {
}

func TestListIndexAllRecords(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -333,7 +332,7 @@ func TestListIndexAllRecords(t *testing.T) {
}

func TestListIndexRange(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -429,7 +428,7 @@ func TestListIndexRange(t *testing.T) {
}

func TestListIndexPrefix(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down
7 changes: 3 additions & 4 deletions index/unique_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package index_test

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -15,7 +14,7 @@ import (
)

func TestUniqueIndex(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -120,7 +119,7 @@ func TestUniqueIndex(t *testing.T) {
}

func TestUniqueIndexRange(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down Expand Up @@ -192,7 +191,7 @@ func TestUniqueIndexRange(t *testing.T) {
}

func TestUniqueIndexPrefix(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))
defer db.Close()
Expand Down
3 changes: 1 addition & 2 deletions q/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"os"

"io/ioutil"
"path/filepath"
"strings"

Expand Down Expand Up @@ -46,7 +45,7 @@ type User struct {
}

func prepareDB() (string, *rainstorm.DB) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
db, _ := rainstorm.Open(filepath.Join(dir, "rainstorm.db"))

for i, name := range []string{"John", "Norm", "Donald", "Eric", "Dilbert"} {
Expand Down
11 changes: 5 additions & 6 deletions storm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package rainstorm
import (
"bytes"
"encoding/binary"
"io/ioutil"
"math"
"math/bits"
"os"
Expand All @@ -26,7 +25,7 @@ func TestNewStorm(t *testing.T) {
require.Error(t, err)
require.Nil(t, db)

dir, err := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, err := os.MkdirTemp(os.TempDir(), "rainstorm")
require.NoError(t, err)
defer os.RemoveAll(dir)

Expand All @@ -47,7 +46,7 @@ func TestNewStorm(t *testing.T) {
}

func TestNewRainstormWithRainstormOptions(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)

dc := new(dummyCodec)
Expand All @@ -63,7 +62,7 @@ func TestNewRainstormWithRainstormOptions(t *testing.T) {
}

func TestNewRainstormWithBatch(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)

db1, _ := Open(filepath.Join(dir, "rainstorm1.db"), Batch())
Expand All @@ -83,7 +82,7 @@ func TestNewRainstormWithBatch(t *testing.T) {
}

func TestBoltDB(t *testing.T) {
dir, _ := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, _ := os.MkdirTemp(os.TempDir(), "rainstorm")
defer os.RemoveAll(dir)
bDB, err := bolt.Open(filepath.Join(dir, "bolt.db"), 0600, &bolt.Options{Timeout: 10 * time.Second})
require.NoError(t, err)
Expand Down Expand Up @@ -163,7 +162,7 @@ func TestToBytes(t *testing.T) {
}

func createDB(t errorHandler, opts ...func(*Options) error) (*DB, func()) {
dir, err := ioutil.TempDir(os.TempDir(), "rainstorm")
dir, err := os.MkdirTemp(os.TempDir(), "rainstorm")
if err != nil {
t.Error(err)
}
Expand Down
Loading

0 comments on commit 8e33774

Please sign in to comment.