mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: add cluster id check for hashKVHandler
Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com> Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
committed by
Marek Siarkowicz
parent
7ed8970e2d
commit
04cfb4c660
@@ -52,13 +52,14 @@ func TestCompactionHash(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
testutil.TestCompactionHash(context.Background(), t, hashTestCase{cc, clus.Members[0].GRPCURL(), client}, 1000)
|
||||
testutil.TestCompactionHash(context.Background(), t, hashTestCase{cc, clus.Members[0].GRPCURL(), client, clus.Members[0].s}, 1000)
|
||||
}
|
||||
|
||||
type hashTestCase struct {
|
||||
*clientv3.Client
|
||||
url string
|
||||
http *http.Client
|
||||
url string
|
||||
http *http.Client
|
||||
server *etcdserver.EtcdServer
|
||||
}
|
||||
|
||||
func (tc hashTestCase) Put(ctx context.Context, key, value string) error {
|
||||
@@ -72,7 +73,7 @@ func (tc hashTestCase) Delete(ctx context.Context, key string) error {
|
||||
}
|
||||
|
||||
func (tc hashTestCase) HashByRev(ctx context.Context, rev int64) (testutil.KeyValueHash, error) {
|
||||
resp, err := etcdserver.HashByRev(ctx, tc.http, "http://unix", rev)
|
||||
resp, err := etcdserver.HashByRev(ctx, tc.server.Cluster().ID(), tc.http, "http://unix", rev)
|
||||
return testutil.KeyValueHash{Hash: resp.Hash, CompactRevision: resp.CompactRevision, Revision: resp.Header.Revision}, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user