()
| 95 | } |
| 96 | |
| 97 | func createTestConn() *grpc.ClientConn { |
| 98 | opts := []grpc.DialOption{ |
| 99 | grpc.WithContextDialer(dialTCPUserTimeout), |
| 100 | } |
| 101 | switch *customCredentialsType { |
| 102 | case "tls": |
| 103 | creds := credentials.NewClientTLSFromCert(nil, "") |
| 104 | opts = append(opts, grpc.WithTransportCredentials(creds)) |
| 105 | case "alts": |
| 106 | creds := alts.NewClientCreds(alts.DefaultClientOptions()) |
| 107 | opts = append(opts, grpc.WithTransportCredentials(creds)) |
| 108 | case "google_default_credentials": |
| 109 | opts = append(opts, grpc.WithCredentialsBundle(google.NewDefaultCredentials())) |
| 110 | case "compute_engine_channel_creds": |
| 111 | opts = append(opts, grpc.WithCredentialsBundle(google.NewComputeEngineCredentials())) |
| 112 | default: |
| 113 | errorLog.Fatalf("Invalid --custom_credentials_type:%v", *customCredentialsType) |
| 114 | } |
| 115 | conn, err := grpc.NewClient(*serverURI, opts...) |
| 116 | if err != nil { |
| 117 | errorLog.Fatalf("grpc.NewClient(%q) = %v", *serverURI, err) |
| 118 | } |
| 119 | return conn |
| 120 | } |
| 121 | |
| 122 | func runCmd(command string) { |
| 123 | infoLog.Printf("Running cmd:|%v|\n", command) |
no test coverage detected