store_v2v3_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2017 The etcd Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // +build v2v3
  15. package v2store_test
  16. import (
  17. "io/ioutil"
  18. "testing"
  19. "go.etcd.io/etcd/clientv3"
  20. "go.etcd.io/etcd/etcdserver/api/v2store"
  21. "go.etcd.io/etcd/etcdserver/api/v2v3"
  22. "go.etcd.io/etcd/integration"
  23. "google.golang.org/grpc/grpclog"
  24. )
  25. func init() {
  26. clientv3.SetLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard))
  27. }
  28. type v2v3TestStore struct {
  29. v2store.Store
  30. clus *integration.ClusterV3
  31. t *testing.T
  32. }
  33. func (s *v2v3TestStore) Close() { s.clus.Terminate(s.t) }
  34. func newTestStore(t *testing.T, ns ...string) StoreCloser {
  35. clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1})
  36. return &v2v3TestStore{
  37. v2v3.NewStore(clus.Client(0), "/v2/"),
  38. clus,
  39. t,
  40. }
  41. }