Add flags for tls file path (#1419)
This commit is contained in:
committed by
Menghan Li
parent
bba722ab6d
commit
66c9ed803b
@ -50,6 +50,7 @@ var (
|
||||
useTLS = flag.Bool("use_tls", false, "Connection uses TLS if true, else plain TCP")
|
||||
testCA = flag.Bool("use_test_ca", false, "Whether to replace platform root CAs with test CA as the CA root")
|
||||
tlsServerName = flag.String("server_host_override", "foo.test.google.fr", "The server name use to verify the hostname returned by TLS handshake if it is not empty. Otherwise, --server_host is used.")
|
||||
caFile = flag.String("ca_file", "", "The file containning the CA root cert file")
|
||||
)
|
||||
|
||||
// testCaseWithWeight contains the test case type and its weight.
|
||||
@ -275,7 +276,10 @@ func newConn(address string, useTLS, testCA bool, tlsServerName string) (*grpc.C
|
||||
var creds credentials.TransportCredentials
|
||||
if testCA {
|
||||
var err error
|
||||
creds, err = credentials.NewClientTLSFromFile(testdata.Path("ca.pem"), sn)
|
||||
if *caFile == "" {
|
||||
*caFile = testdata.Path("ca.pem")
|
||||
}
|
||||
creds, err = credentials.NewClientTLSFromFile(*caFile, sn)
|
||||
if err != nil {
|
||||
grpclog.Fatalf("Failed to create TLS credentials %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user