-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathlogv2_test.go
41 lines (36 loc) · 844 Bytes
/
logv2_test.go
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
/*
* Copyright 2022-present Kuei-chun Chen. All rights reserved.
* logv2_test.go
*/
package hatchet
import (
"database/sql"
"regexp"
"testing"
"github.com/mattn/go-sqlite3"
)
func TestAnalyze(t *testing.T) {
regex := func(re, s string) (bool, error) {
return regexp.MatchString(re, s)
}
sql.Register("sqlite3_extended",
&sqlite3.SQLiteDriver{
ConnectHook: func(conn *sqlite3.SQLiteConn) error {
return conn.RegisterFunc("regexp", regex, true)
},
})
filename := "testdata/mongod_ops.log.gz"
logv2 := &Logv2{testing: true, url: SQLITE3_FILE}
err := logv2.Analyze(filename, 0)
if err != nil {
t.Fatal(err)
}
}
func TestAnalyzeLegacy(t *testing.T) {
filename := "testdata/mongod_ops.log.gz"
logv2 := &Logv2{testing: true, legacy: true}
err := logv2.Analyze(filename, 0)
if err != nil {
t.Fatal(err)
}
}