integration: test namespacing on proxy layer
Hardcode a namespace over the testing grpcproxy.
@@ -20,6 +20,7 @@ import (
"sync"
"github.com/coreos/etcd/clientv3"
+ "github.com/coreos/etcd/clientv3/namespace"
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/proxy/grpcproxy"
"github.com/coreos/etcd/proxy/grpcproxy/adapter"
@@ -30,6 +31,8 @@ var (
proxies map[*clientv3.Client]grpcClientProxy = make(map[*clientv3.Client]grpcClientProxy)
)
+const proxyNamespace = "proxy-namespace"
+
type grpcClientProxy struct {
grpc grpcAPI
wdonec <-chan struct{}
@@ -44,9 +47,16 @@ func toGRPC(c *clientv3.Client) grpcAPI {
if v, ok := proxies[c]; ok {
return v.grpc
}
+
+ // test namespacing proxy
+ c.KV = namespace.NewKV(c.KV, proxyNamespace)
+ c.Watcher = namespace.NewWatcher(c.Watcher, proxyNamespace)
+ c.Lease = namespace.NewLease(c.Lease, proxyNamespace)
+ // test coalescing/caching proxy
kvp, kvpch := grpcproxy.NewKvProxy(c)
wp, wpch := grpcproxy.NewWatchProxy(c)
lp, lpch := grpcproxy.NewLeaseProxy(c)
+
grpc := grpcAPI{
pb.NewClusterClient(c.ActiveConnection()),
adapter.KvServerToKvClient(kvp),
