mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
e2e: test 'https' scheme endpoints
This commit is contained in:
parent
dd607b5eff
commit
0dc14d1771
@ -37,6 +37,18 @@ func ctlV3Version(cx ctlCtx) error {
|
||||
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 {
|
||||
t *testing.T
|
||||
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
|
||||
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.isClientAutoTLS {
|
||||
cmdArgs = append(cmdArgs, "--insecure-transport=false", "--insecure-skip-tls-verify")
|
||||
@ -162,6 +174,10 @@ func (cx *ctlCtx) PrefixArgs() []string {
|
||||
return cmdArgs
|
||||
}
|
||||
|
||||
func (cx *ctlCtx) PrefixArgs() []string {
|
||||
return cx.prefixArgs(cx.epc.grpcEndpoints())
|
||||
}
|
||||
|
||||
func isGRPCTimedout(err error) bool {
|
||||
return strings.Contains(err.Error(), "grpc: timed out trying to connect")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user