William Petit
8e574c299b
All checks were successful
arcad/edge/pipeline/pr-master This commit looks good
30 lines
656 B
Go
30 lines
656 B
Go
package sqlite
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"testing"
|
|
"time"
|
|
|
|
"forge.cadoles.com/arcad/edge/pkg/storage/testsuite"
|
|
"github.com/pkg/errors"
|
|
"gitlab.com/wpetit/goweb/logger"
|
|
)
|
|
|
|
func TestDocumentStore(t *testing.T) {
|
|
t.Parallel()
|
|
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", file, (60 * time.Second).Milliseconds())
|
|
store := NewDocumentStore(dsn)
|
|
|
|
testsuite.TestDocumentStore(context.Background(), t, store)
|
|
}
|