Skip to content

Commit

Permalink
integration: test namespacing on proxy layer
Browse files Browse the repository at this point in the history
Hardcode a namespace over the testing grpcproxy.
  • Loading branch information
Anthony Romano committed Mar 22, 2017
1 parent 2e837a4 commit f4ddda0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions integration/cluster_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{}
Expand All @@ -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),
Expand Down

0 comments on commit f4ddda0

Please sign in to comment.