2019-02-08 13:45:41 -08:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Test_openDB(t *testing.T) {
|
|
|
|
t.Parallel()
|
2020-09-18 04:08:24 -07:00
|
|
|
_, err := openDB(t.TempDir())
|
2019-02-08 13:45:41 -08:00
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_openTraceWriter(t *testing.T) {
|
|
|
|
t.Parallel()
|
2020-09-18 04:08:24 -07:00
|
|
|
|
|
|
|
fname := filepath.Join(t.TempDir(), "logfile")
|
2019-02-08 13:45:41 -08:00
|
|
|
w, err := openTraceWriter(fname)
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.NotNil(t, w)
|
|
|
|
|
|
|
|
// test no-op
|
|
|
|
w, err = openTraceWriter("")
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Nil(t, w)
|
|
|
|
}
|