2015-03-16 03:15:27 +00:00
|
|
|
package physical
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
2016-04-26 03:10:32 +00:00
|
|
|
"log"
|
2015-03-16 03:15:27 +00:00
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFileBackend(t *testing.T) {
|
|
|
|
dir, err := ioutil.TempDir("", "vault")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
defer os.RemoveAll(dir)
|
|
|
|
|
2016-04-26 03:10:32 +00:00
|
|
|
logger := log.New(os.Stderr, "", log.LstdFlags)
|
|
|
|
b, err := NewBackend("file", logger, map[string]string{
|
2015-03-16 03:15:27 +00:00
|
|
|
"path": dir,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
testBackend(t, b)
|
|
|
|
testBackend_ListPrefix(t, b)
|
|
|
|
}
|