Skip to content

Commit

Permalink
Skip WatchRequestProgress test in grpc-proxy mode.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ahrtr committed Jun 27, 2022
1 parent 4e88cce commit da04676
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions clientv3/integration/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ func TestConfigurableWatchProgressNotifyInterval(t *testing.T) {
}

func TestWatchRequestProgress(t *testing.T) {
if integration.ThroughProxy {
t.Skip("grpc-proxy does not support WatchProgress yet")
}
testCases := []struct {
name string
watchers []string
Expand Down
2 changes: 1 addition & 1 deletion integration/cluster_direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
)

const throughProxy = false
const ThroughProxy = false

func toGRPC(c *clientv3.Client) grpcAPI {
return grpcAPI{
Expand Down
2 changes: 1 addition & 1 deletion integration/cluster_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"go.etcd.io/etcd/proxy/grpcproxy/adapter"
)

const throughProxy = true
const ThroughProxy = true

var (
pmu sync.Mutex
Expand Down
2 changes: 1 addition & 1 deletion integration/v3_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ func TestV3WatchCancellation(t *testing.T) {
}

var expected string
if throughProxy {
if ThroughProxy {
// grpc proxy has additional 2 watches open
expected = "3"
} else {
Expand Down
3 changes: 2 additions & 1 deletion proxy/grpcproxy/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ func (wps *watchProxyStream) recvLoop() error {
case *pb.WatchRequest_CancelRequest:
wps.delete(uv.CancelRequest.WatchId)
default:
panic("not implemented")
// Panic or Fatalf would allow network clients to crash the serve remotely.
//panic("not implemented")
}
}
}
Expand Down

0 comments on commit da04676

Please sign in to comment.