9
9
package main
10
10
11
11
import (
12
+ "nav/config"
12
13
"database/sql"
13
14
"database/sql/driver"
14
15
"github.com/DATA-DOG/go-sqlmock"
16
+ c "nav/constants"
15
17
. "github.com/onsi/ginkgo"
16
18
. "github.com/onsi/gomega"
17
19
)
@@ -20,25 +22,25 @@ var _ = Describe("Nav Tests", func() {
20
22
Describe ("opt2num" , func () {
21
23
When ("Using a valid options key" , func () {
22
24
It ("Should return the correct value for graphOnly" , func () {
23
- Expect (opt2num ("graphOnly" )).To (Equal (graphOnly ))
25
+ Expect (opt2num ("graphOnly" )).To (Equal (c . GraphOnly ))
24
26
})
25
27
26
28
It ("Should return the correct value for jsonOutputPlain" , func () {
27
- Expect (opt2num ("jsonOutputPlain" )).To (Equal (jsonOutputPlain ))
29
+ Expect (opt2num ("jsonOutputPlain" )).To (Equal (c . JsonOutputPlain ))
28
30
})
29
31
30
32
It ("Should return the correct value for jsonOutputB64" , func () {
31
- Expect (opt2num ("jsonOutputB64" )).To (Equal (jsonOutputB64 ))
33
+ Expect (opt2num ("jsonOutputB64" )).To (Equal (c . JsonOutputB64 ))
32
34
})
33
35
34
36
It ("Should return the correct value for jsonOutputGZB64" , func () {
35
- Expect (opt2num ("jsonOutputGZB64" )).To (Equal (jsonOutputGZB64 ))
37
+ Expect (opt2num ("jsonOutputGZB64" )).To (Equal (c . JsonOutputGZB64 ))
36
38
})
37
39
})
38
40
39
41
When ("Using an invalid options key" , func () {
40
42
It ("Should return 0" , func () {
41
- Expect (opt2num ("invalidKey" )).To (Equal (invalidOutput ))
43
+ Expect (opt2num ("invalidKey" )).To (Equal (c . InvalidOutput ))
42
44
})
43
45
})
44
46
})
@@ -304,19 +306,20 @@ dgraph G {
304
306
dok .cache .entries = map [int ]entry {}
305
307
dok .cache .successors = map [int ][]entry {}
306
308
dok .cache .subSys = map [string ]string {}
307
- testConfig := configuration {
308
- DBDriver : "postgres" ,
309
- DBDSN : "host=dbs.hqhome163.com port=5432 user=alessandro password=<password> dbname=kernel_bin sslmode=disable" ,
310
- Symbol : "__x64_sys_getpid" ,
311
- Instance : 16 ,
312
- Mode : printAll ,
313
- ExcludedBefore : []string {"__fentry__" , "__stack_chk_fail" },
314
- ExcludedAfter : []string {"^kfree$" , "^_raw_spin_lock$" , "^_raw_spin_unlock$" , "^panic$" , "^call_rcu$" , "^__call_rcu$" , "__rcu_read_unlock" , "__rcu_read_lock" , "path_openat" },
315
- TargetSubsys : []string {},
316
- MaxDepth : 0 , //0: no limit
317
- Jout : "graphOnly" ,
318
- Graphviz : oText ,
319
- cmdlineNeeds : map [string ]bool {},
309
+ testConfig := config.Config {
310
+ ConfValues : config.ConfValues {
311
+ DBDriver : "postgres" ,
312
+ DBDSN : "host=dbs.hqhome163.com port=5432 user=alessandro password=<password> dbname=kernel_bin sslmode=disable" ,
313
+ Symbol : "__x64_sys_getpid" ,
314
+ DBInstance : 16 ,
315
+ Mode : c .PrintAll ,
316
+ ExcludedBefore : []string {"__fentry__" , "__stack_chk_fail" },
317
+ ExcludedAfter : []string {"^kfree$" , "^_raw_spin_lock$" , "^_raw_spin_unlock$" , "^panic$" , "^call_rcu$" , "^__call_rcu$" , "__rcu_read_unlock" , "__rcu_read_lock" , "path_openat" },
318
+ TargetSubsys : []string {},
319
+ MaxDepth : 0 , //0: no limit
320
+ Type : "graphOnly" ,
321
+ Graphviz : c .OText ,
322
+ },
320
323
}
321
324
322
325
dot , err := generateOutput (dok , & testConfig )
0 commit comments