The insecure-mode spec only asserted an error, so against main it
passed on a refused connection to the hardcoded endpoint. Match the
TLS handshake error instead. Pass insecure credentials to the test
server explicitly, which is what it already did, so the static
analysis no longer reports a server without credentials.
Run the command against a search service without TLS only: what the
command decides is whether to turn TLS off, how the mode maps and which
endpoint it dials. What pool.NewConn does with each mode belongs to
reva. Also cover the endpoint default.
The index command read OC_GRPC_CLIENT_TLS_MODE with a meaning of its
own: "insecure" dialed without TLS, and every other value, including
the default and "off", dialed with verified TLS and ignored
OC_GRPC_CLIENT_TLS_CACERT. Against the default setup, where the gRPC
services run without TLS, it failed unless --insecure was passed, and
against services with TLS enabled it only connected when their
certificate was trusted by the system roots, never with the generated
certificate or a private CA.
Map the mode with pool.StringToTLSMode and dial with pool.NewConn, the
mapping and dialer the other services' reva clients use: "off" dials
without TLS, "insecure" uses TLS without verifying the certificate and
"on" verifies it against the configured CA. --insecure still forces a
connection without TLS, and then the mode is not read at all.