Skip WatchRequestProgress test in grpc-proxy mode.

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>
This commit is contained in:
Benjamin Wang
2022-06-24 09:38:52 +08:00
parent f1c59dcfac
commit 6958ee8ff2
5 changed files with 8 additions and 4 deletions

View File

@ -607,6 +607,9 @@ func TestConfigurableWatchProgressNotifyInterval(t *testing.T) {
} }
func TestWatchRequestProgress(t *testing.T) { func TestWatchRequestProgress(t *testing.T) {
if integration.ThroughProxy {
t.Skip("grpc-proxy does not support WatchProgress yet")
}
testCases := []struct { testCases := []struct {
name string name string
watchers []string watchers []string

View File

@ -23,7 +23,7 @@ import (
pb "go.etcd.io/etcd/etcdserver/etcdserverpb" pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
) )
const throughProxy = false const ThroughProxy = false
func toGRPC(c *clientv3.Client) grpcAPI { func toGRPC(c *clientv3.Client) grpcAPI {
return grpcAPI{ return grpcAPI{

View File

@ -26,7 +26,7 @@ import (
"go.etcd.io/etcd/proxy/grpcproxy/adapter" "go.etcd.io/etcd/proxy/grpcproxy/adapter"
) )
const throughProxy = true const ThroughProxy = true
var ( var (
pmu sync.Mutex pmu sync.Mutex

View File

@ -1242,7 +1242,7 @@ func TestV3WatchCancellation(t *testing.T) {
} }
var expected string var expected string
if throughProxy { if ThroughProxy {
// grpc proxy has additional 2 watches open // grpc proxy has additional 2 watches open
expected = "3" expected = "3"
} else { } else {

View File

@ -262,7 +262,8 @@ func (wps *watchProxyStream) recvLoop() error {
case *pb.WatchRequest_CancelRequest: case *pb.WatchRequest_CancelRequest:
wps.delete(uv.CancelRequest.WatchId) wps.delete(uv.CancelRequest.WatchId)
default: default:
panic("not implemented") // Panic or Fatalf would allow network clients to crash the serve remotely.
//panic("not implemented")
} }
} }
} }