-
Notifications
You must be signed in to change notification settings - Fork 270
Expand file tree
/
Copy pathsqlite_test.go
More file actions
41 lines (35 loc) · 824 Bytes
/
Copy pathsqlite_test.go
File metadata and controls
41 lines (35 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package sqlite
import (
"path/filepath"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestInit(t *testing.T) {
dbFile := filepath.Join(t.TempDir(), "test_sqlite.db")
db, err := Init(dbFile)
if err != nil {
// ignore test error about not being able to connect to real sqlite
t.Logf("connect to sqlite failed, err=%v, dbFile=%s", err, dbFile)
return
}
defer Close(db)
t.Logf("%+v", db.Name())
}
func Test_gormConfig(t *testing.T) {
o := defaultOptions()
o.apply(
WithLogging(nil),
WithLogging(nil, 4),
WithSlowThreshold(time.Millisecond*100),
WithEnableTrace(),
WithMaxIdleConns(5),
WithMaxOpenConns(50),
WithConnMaxLifetime(time.Minute*3),
WithEnableForeignKey(),
WithLogRequestIDKey("request_id"),
WithGormPlugin(nil),
)
c := gormConfig(o)
assert.NotNil(t, c)
}