Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nleiva committed May 14, 2022
1 parent 4d9c997 commit 2487165
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 0 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,9 @@ func newClientTLS(xr CiscoGrpcClient) (credentials.TransportCredentials, error)
}
// TODO: make skipVerify an input. If false, you need to provice the CA cert.
skipVerify := true
xr.Domain = "ems.cisco.com"

config := &tls.Config{
// ServerName: xr.Domain,
InsecureSkipVerify: skipVerify,
// RootCAs: certPool,
}
return credentials.NewTLS(config), nil
}
Expand Down
7 changes: 5 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func Server(t *testing.T, svc string) *grpc.Server {
}
creds, err := credentials.NewServerTLSFromFile(defaultCert, defaultKey)
if err != nil {
t.Fatalf("failed to construct TLS credentialst: %v", err)
t.Fatalf("failed to construct TLS credentials: %v", err)
}
// var opts []grpc.ServerOption
s := grpc.NewServer(
Expand Down Expand Up @@ -434,7 +434,7 @@ func TestConnect(t *testing.T) {
{name: "wrong target", target: "192.168.0.1:57344", err: "TBD"},
{name: "wrong certificate", certf: "example/input/certificate/ems5502-1.pem", err: "TBD"},
{name: "inexistent certificate", certf: "dummy", err: "TBD"},
{name: "No certificate", certf: ""},
{name: "No certificate", certf: "empty"},
}
s := Server(t, "none")

Expand All @@ -445,6 +445,9 @@ func TestConnect(t *testing.T) {
if tc.certf != "" {
xc.Cert = tc.certf
}
if tc.certf == "empty" {
xc.Cert = ""
}
if tc.target != "" {
xc.Host = tc.target
}
Expand Down

0 comments on commit 2487165

Please sign in to comment.