@@ -19,22 +19,26 @@ func TestBuildCommand(t *testing.T) {
19
19
WithFscacheDriver ("fs_cache_dir" ),
20
20
WithFscacheThreads (4 ),
21
21
WithAPISock ("/dummy/apisock" ),
22
- WithUpgrade ()}
22
+ WithUpgrade (),
23
+ WithConfig ("testpath.json" )}
23
24
24
- args , err := BuildCommand (c )
25
+ args , configPath , err := BuildCommand (c )
25
26
assert .Nil (t , err )
26
27
actual := strings .Join (args , " " )
27
- assert .Equal (t , "singleton --fscache fs_cache_dir --fscache-threads 4 --upgrade --apisock /dummy/apisock" , actual )
28
+ assert .Equal (t , "singleton --fscache fs_cache_dir --fscache-threads 4 --upgrade --config testpath.json --apisock /dummy/apisock" , actual )
29
+ assert .Equal (t , configPath , "testpath.json" )
28
30
29
31
c1 := []Opt {WithMode ("singleton" ),
30
32
WithFscacheDriver ("fs_cache_dir" ),
31
33
WithFscacheThreads (4 ),
32
- WithAPISock ("/dummy/apisock" )}
34
+ WithAPISock ("/dummy/apisock" ),
35
+ WithConfig ("testpath.json" )}
33
36
34
- args1 , err := BuildCommand (c1 )
37
+ args1 , configPath1 , err := BuildCommand (c1 )
35
38
assert .Nil (t , err )
36
39
actual1 := strings .Join (args1 , " " )
37
- assert .Equal (t , "singleton --fscache fs_cache_dir --fscache-threads 4 --apisock /dummy/apisock" , actual1 )
40
+ assert .Equal (t , "singleton --fscache fs_cache_dir --fscache-threads 4 --config testpath.json --apisock /dummy/apisock" , actual1 )
41
+ assert .Equal (t , configPath1 , "testpath.json" )
38
42
}
39
43
40
44
// cpu: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz
@@ -50,7 +54,7 @@ func BenchmarkBuildCommand(b *testing.B) {
50
54
WithUpgrade ()}
51
55
52
56
for n := 0 ; n < b .N ; n ++ {
53
- _ , err := BuildCommand (c )
57
+ _ , _ , err := BuildCommand (c )
54
58
assert .Nil (b , err )
55
59
}
56
60
}
0 commit comments