File tree 2 files changed +28
-1
lines changed
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import (
29
29
30
30
var (
31
31
blobfuseProxyEndpoint = flag .String ("blobfuse-proxy-endpoint" , "unix://tmp/blobfuse-proxy.sock" , "blobfuse-proxy endpoint" )
32
+ grpcServerRunner = server .RunGRPCServer
32
33
)
33
34
34
35
func main () {
@@ -55,7 +56,7 @@ func main() {
55
56
mountServer := server .NewMountServiceServer ()
56
57
57
58
klog .V (2 ).Infof ("Listening for connections on address: %v\n " , listener .Addr ())
58
- if err = server . RunGRPCServer (mountServer , false , listener ); err != nil {
59
+ if err = grpcServerRunner (mountServer , false , listener ); err != nil {
59
60
klog .Fatalf ("Error running grpc server %v. Error: %v" , listener .Addr (), err )
60
61
}
61
62
}
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "net"
5
+ "os"
6
+ "testing"
7
+
8
+ "sigs.k8s.io/blob-csi-driver/pkg/blobfuse-proxy/pb"
9
+ )
10
+
11
+ func mockRunGRPCServer (_ pb.MountServiceServer , _ bool , _ net.Listener ) error {
12
+ return nil
13
+ }
14
+
15
+ func TestMain (_ * testing.T ) {
16
+ // mock the grpcServerRunner
17
+ originalGRPCServerRunner := grpcServerRunner
18
+ grpcServerRunner = mockRunGRPCServer
19
+ defer func () { grpcServerRunner = originalGRPCServerRunner }()
20
+
21
+ // Set the blobfuse-proxy-endpoint
22
+ os .Args = []string {"cmd" , "-blobfuse-proxy-endpoint=unix://tmp/test.sock" }
23
+
24
+ // Run main
25
+ main ()
26
+ }
You can’t perform that action at this time.
0 commit comments