forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.4] Backport cherry-pick of etcd-io#14860: Trigger release in curre…
…nt branch for github workflow case Signed-off-by: ArkaSaha30 <[email protected]>
- Loading branch information
Showing
12 changed files
with
550 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ jobs: | |
Name-Email: [email protected] | ||
Expire-Date: 0 | ||
EOF | ||
DRY_RUN=true ./scripts/release.sh --no-upload --no-docker-push 3.4.99 | ||
DRY_RUN=true ./scripts/release.sh --no-upload --no-docker-push --in-place 3.4.99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,4 @@ function log_info { | |
>&2 echo -n -e "${COLOR_NONE}" | ||
>&2 echo "$@" | ||
>&2 echo -n -e "${COLOR_NONE}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
// Copyright 2023 The etcd Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// These tests are directly validating etcd connection multiplexing. | ||
//go:build !cluster_proxy | ||
|
||
package e2e | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
clientv2 "go.etcd.io/etcd/client" | ||
pb "go.etcd.io/etcd/etcdserver/etcdserverpb" | ||
"go.etcd.io/etcd/pkg/testutil" | ||
) | ||
|
||
func TestConnectionMultiplexing(t *testing.T) { | ||
defer testutil.AfterTest(t) | ||
for _, tc := range []struct { | ||
name string | ||
serverTLS clientConnType | ||
}{ | ||
{ | ||
name: "ServerTLS", | ||
serverTLS: clientTLS, | ||
}, | ||
{ | ||
name: "ServerNonTLS", | ||
serverTLS: clientNonTLS, | ||
}, | ||
{ | ||
name: "ServerTLSAndNonTLS", | ||
serverTLS: clientTLSAndNonTLS, | ||
}, | ||
} { | ||
t.Run(tc.name, func(t *testing.T) { | ||
ctx := context.Background() | ||
cfg := etcdProcessClusterConfig{clusterSize: 1, clientTLS: tc.serverTLS, enableV2: true} | ||
clus, err := newEtcdProcessCluster(&cfg) | ||
require.NoError(t, err) | ||
defer clus.Close() | ||
|
||
var clientScenarios []clientConnType | ||
switch tc.serverTLS { | ||
case clientTLS: | ||
clientScenarios = []clientConnType{clientTLS} | ||
case clientNonTLS: | ||
clientScenarios = []clientConnType{clientNonTLS} | ||
case clientTLSAndNonTLS: | ||
clientScenarios = []clientConnType{clientTLS, clientNonTLS} | ||
} | ||
|
||
for _, connType := range clientScenarios { | ||
name := "ClientNonTLS" | ||
if connType == clientTLS { | ||
name = "ClientTLS" | ||
} | ||
t.Run(name, func(t *testing.T) { | ||
testConnectionMultiplexing(ctx, t, clus.EndpointsV3()[0], connType) | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
} | ||
|
||
func testConnectionMultiplexing(ctx context.Context, t *testing.T, endpoint string, connType clientConnType) { | ||
switch connType { | ||
case clientTLS: | ||
endpoint = toTLS(endpoint) | ||
case clientNonTLS: | ||
default: | ||
panic(fmt.Sprintf("Unsupported conn type %v", connType)) | ||
} | ||
t.Run("etcdctl", func(t *testing.T) { | ||
t.Run("v2", func(t *testing.T) { | ||
etcdctl := NewEtcdctl([]string{endpoint}, connType, false, true) | ||
err := etcdctl.Set("a", "1") | ||
assert.NoError(t, err) | ||
}) | ||
t.Run("v3", func(t *testing.T) { | ||
etcdctl := NewEtcdctl([]string{endpoint}, connType, false, false) | ||
err := etcdctl.Put("a", "1") | ||
assert.NoError(t, err) | ||
}) | ||
}) | ||
t.Run("clientv2", func(t *testing.T) { | ||
c, err := newClientV2(t, []string{endpoint}, connType, false) | ||
require.NoError(t, err) | ||
kv := clientv2.NewKeysAPI(c) | ||
_, err = kv.Set(ctx, "a", "1", nil) | ||
assert.NoError(t, err) | ||
}) | ||
t.Run("clientv3", func(t *testing.T) { | ||
c := newClient(t, []string{endpoint}, connType, false) | ||
_, err := c.Get(ctx, "a") | ||
assert.NoError(t, err) | ||
}) | ||
t.Run("curl", func(t *testing.T) { | ||
for _, httpVersion := range []string{"2", "1.1", "1.0", ""} { | ||
tname := "http" + httpVersion | ||
if httpVersion == "" { | ||
tname = "default" | ||
} | ||
t.Run(tname, func(t *testing.T) { | ||
assert.NoError(t, fetchGrpcGateway(endpoint, httpVersion, connType)) | ||
assert.NoError(t, fetchMetrics(endpoint, httpVersion, connType)) | ||
assert.NoError(t, fetchVersion(endpoint, httpVersion, connType)) | ||
assert.NoError(t, fetchHealth(endpoint, httpVersion, connType)) | ||
assert.NoError(t, fetchDebugVars(endpoint, httpVersion, connType)) | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
func fetchGrpcGateway(endpoint string, httpVersion string, connType clientConnType) error { | ||
rangeData, err := json.Marshal(&pb.RangeRequest{ | ||
Key: []byte("a"), | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
req := cURLReq{endpoint: "/v3/kv/range", value: string(rangeData), timeout: 5, httpVersion: httpVersion} | ||
return curl(endpoint, "POST", req, connType, "header") | ||
} | ||
|
||
func fetchMetrics(endpoint string, httpVersion string, connType clientConnType) error { | ||
req := cURLReq{endpoint: "/metrics", timeout: 5, httpVersion: httpVersion} | ||
return curl(endpoint, "GET", req, connType, "etcd_cluster_version") | ||
} | ||
|
||
func fetchVersion(endpoint string, httpVersion string, connType clientConnType) error { | ||
req := cURLReq{endpoint: "/version", timeout: 5, httpVersion: httpVersion} | ||
return curl(endpoint, "GET", req, connType, "etcdserver") | ||
} | ||
|
||
func fetchHealth(endpoint string, httpVersion string, connType clientConnType) error { | ||
req := cURLReq{endpoint: "/health", timeout: 5, httpVersion: httpVersion} | ||
return curl(endpoint, "GET", req, connType, "health") | ||
} | ||
|
||
func fetchDebugVars(endpoint string, httpVersion string, connType clientConnType) error { | ||
req := cURLReq{endpoint: "/debug/vars", timeout: 5, httpVersion: httpVersion} | ||
return curl(endpoint, "GET", req, connType, "file_descriptor_limit") | ||
} | ||
|
||
func curl(endpoint string, method string, curlReq cURLReq, connType clientConnType, expect string) error { | ||
args := cURLPrefixArgs(endpoint, connType, false, method, curlReq) | ||
return spawnWithExpect(args, expect) | ||
} |
Oops, something went wrong.