|
@@ -37,6 +37,18 @@ func ctlV3Version(cx ctlCtx) error {
|
|
|
return spawnWithExpect(cmdArgs, version.Version)
|
|
return spawnWithExpect(cmdArgs, version.Version)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// TestCtlV3DialWithHTTPScheme ensures that client handles endpoints with HTTPS scheme.
|
|
|
|
|
+func TestCtlV3DialWithHTTPScheme(t *testing.T) {
|
|
|
|
|
+ testCtl(t, dialWithSchemeTest, withCfg(configClientTLS))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func dialWithSchemeTest(cx ctlCtx) {
|
|
|
|
|
+ cmdArgs := append(cx.prefixArgs(cx.epc.endpoints()), "put", "foo", "bar")
|
|
|
|
|
+ if err := spawnWithExpect(cmdArgs, "OK"); err != nil {
|
|
|
|
|
+ cx.t.Fatal(err)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
type ctlCtx struct {
|
|
type ctlCtx struct {
|
|
|
t *testing.T
|
|
t *testing.T
|
|
|
cfg etcdProcessClusterConfig
|
|
cfg etcdProcessClusterConfig
|
|
@@ -141,12 +153,12 @@ func testCtl(t *testing.T, testFunc func(ctlCtx), opts ...ctlOption) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (cx *ctlCtx) PrefixArgs() []string {
|
|
|
|
|
|
|
+func (cx *ctlCtx) prefixArgs(eps []string) []string {
|
|
|
if len(cx.epc.proxies()) > 0 { // TODO: add proxy check as in v2
|
|
if len(cx.epc.proxies()) > 0 { // TODO: add proxy check as in v2
|
|
|
panic("v3 proxy not implemented")
|
|
panic("v3 proxy not implemented")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- cmdArgs := []string{ctlBinPath, "--endpoints", strings.Join(cx.epc.grpcEndpoints(), ","), "--dial-timeout", cx.dialTimeout.String()}
|
|
|
|
|
|
|
+ cmdArgs := []string{ctlBinPath, "--endpoints", strings.Join(eps, ","), "--dial-timeout", cx.dialTimeout.String()}
|
|
|
if cx.epc.cfg.clientTLS == clientTLS {
|
|
if cx.epc.cfg.clientTLS == clientTLS {
|
|
|
if cx.epc.cfg.isClientAutoTLS {
|
|
if cx.epc.cfg.isClientAutoTLS {
|
|
|
cmdArgs = append(cmdArgs, "--insecure-transport=false", "--insecure-skip-tls-verify")
|
|
cmdArgs = append(cmdArgs, "--insecure-transport=false", "--insecure-skip-tls-verify")
|
|
@@ -162,6 +174,10 @@ func (cx *ctlCtx) PrefixArgs() []string {
|
|
|
return cmdArgs
|
|
return cmdArgs
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (cx *ctlCtx) PrefixArgs() []string {
|
|
|
|
|
+ return cx.prefixArgs(cx.epc.grpcEndpoints())
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func isGRPCTimedout(err error) bool {
|
|
func isGRPCTimedout(err error) bool {
|
|
|
return strings.Contains(err.Error(), "grpc: timed out trying to connect")
|
|
return strings.Contains(err.Error(), "grpc: timed out trying to connect")
|
|
|
}
|
|
}
|