mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00

We shouldn't fail the grpc-server (completely) by a not implemented RPC. Failing whole server by remote request is anti-pattern and security risk. Refer to https://github.com/etcd-io/etcd/runs/7034342964?check_suite_focus=true#step:5:2284 ``` === RUN TestWatchRequestProgress/1-watcher panic: not implemented goroutine 83024 [running]: go.etcd.io/etcd/proxy/grpcproxy.(*watchProxyStream).recvLoop(0xc009232f00, 0x4a73e1, 0xc00e2406e0) /home/runner/work/etcd/etcd/proxy/grpcproxy/watch.go:265 +0xbf2 go.etcd.io/etcd/proxy/grpcproxy.(*watchProxy).Watch.func1(0xc0038a3bc0, 0xc009232f00) /home/runner/work/etcd/etcd/proxy/grpcproxy/watch.go:125 +0x70 created by go.etcd.io/etcd/proxy/grpcproxy.(*watchProxy).Watch /home/runner/work/etcd/etcd/proxy/grpcproxy/watch.go:123 +0x73b FAIL go.etcd.io/etcd/clientv3/integration 222.813s FAIL ``` Signed-off-by: Benjamin Wang <wachao@vmware.com>
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
// Copyright 2016 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.
|
|
|
|
// +build !cluster_proxy
|
|
|
|
package integration
|
|
|
|
import (
|
|
"go.etcd.io/etcd/clientv3"
|
|
"go.etcd.io/etcd/etcdserver/api/v3election/v3electionpb"
|
|
"go.etcd.io/etcd/etcdserver/api/v3lock/v3lockpb"
|
|
pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
|
|
)
|
|
|
|
const ThroughProxy = false
|
|
|
|
func toGRPC(c *clientv3.Client) grpcAPI {
|
|
return grpcAPI{
|
|
pb.NewClusterClient(c.ActiveConnection()),
|
|
pb.NewKVClient(c.ActiveConnection()),
|
|
pb.NewLeaseClient(c.ActiveConnection()),
|
|
pb.NewWatchClient(c.ActiveConnection()),
|
|
pb.NewMaintenanceClient(c.ActiveConnection()),
|
|
pb.NewAuthClient(c.ActiveConnection()),
|
|
v3lockpb.NewLockClient(c.ActiveConnection()),
|
|
v3electionpb.NewElectionClient(c.ActiveConnection()),
|
|
}
|
|
}
|
|
|
|
func newClientV3(cfg clientv3.Config) (*clientv3.Client, error) {
|
|
return clientv3.New(cfg)
|
|
}
|