test with stream

master
Bel LaPointe 2021-02-07 13:03:17 -06:00
parent 39ddc93e2f
commit 246008d83b
1 changed files with 57 additions and 54 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"local/storage"
"log" "log"
"os" "os"
"path" "path"
@ -12,6 +13,7 @@ import (
) )
func TestLastN(t *testing.T) { func TestLastN(t *testing.T) {
for _, storeName := range []string{storage.MAP.String(), storage.MAPSTREAM.String()} {
d, clean := makeJunk(t) d, clean := makeJunk(t)
defer clean() defer clean()
@ -19,7 +21,7 @@ func TestLastN(t *testing.T) {
N: 3, N: 3,
Ns: "b", Ns: "b",
Root: d, Root: d,
Store: "map", Store: storeName,
} }
lastn, err := New(conf) lastn, err := New(conf)
if err != nil { if err != nil {
@ -74,6 +76,7 @@ func TestLastN(t *testing.T) {
t.Fatal(len(saved)) t.Fatal(len(saved))
} }
} }
}
func makeJunk(t *testing.T) (string, func()) { func makeJunk(t *testing.T) (string, func()) {
d, err := ioutil.TempDir(os.TempDir(), "lastNtest*") d, err := ioutil.TempDir(os.TempDir(), "lastNtest*")