edge/pkg/storage/driver/sqlite/document_store_test.go

30 lines
681 B
Go
Raw Permalink Normal View History

2023-02-09 12:16:36 +01:00
package sqlite
import (
"context"
"fmt"
2023-02-09 12:16:36 +01:00
"os"
"testing"
"time"
2023-02-09 12:16:36 +01:00
"forge.cadoles.com/arcad/edge/pkg/storage/testsuite"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/logger"
)
func TestDocumentStore(t *testing.T) {
t.Parallel()
2023-02-09 12:16:36 +01:00
logger.SetLevel(logger.LevelDebug)
file := "./testdata/documentstore_test.sqlite"
if err := os.Remove(file); err != nil && !errors.Is(err, os.ErrNotExist) {
t.Fatalf("%+v", errors.WithStack(err))
}
dsn := fmt.Sprintf("%s?_pragma=foreign_keys(1)&_pragma=busy_timeout=%d&_pragma=journal_mode=wal", file, (60 * time.Second).Milliseconds())
store := NewDocumentStore(dsn)
2023-02-09 12:16:36 +01:00
testsuite.TestDocumentStore(context.Background(), t, store)
2023-02-09 12:16:36 +01:00
}