go.etcd.io/etcd@v3.3.27+incompatible/store/store_v2v3_test.go (about) 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 15 // +build v2v3 16 17 package store_test 18 19 import ( 20 "io/ioutil" 21 "testing" 22 23 "github.com/coreos/etcd/clientv3" 24 "github.com/coreos/etcd/etcdserver/api/v2v3" 25 "github.com/coreos/etcd/integration" 26 "github.com/coreos/etcd/store" 27 28 "github.com/coreos/pkg/capnslog" 29 "google.golang.org/grpc/grpclog" 30 ) 31 32 func init() { 33 capnslog.SetGlobalLogLevel(capnslog.CRITICAL) 34 clientv3.SetLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard)) 35 } 36 37 type v2v3TestStore struct { 38 store.Store 39 clus *integration.ClusterV3 40 t *testing.T 41 } 42 43 func (s *v2v3TestStore) Close() { s.clus.Terminate(s.t) } 44 45 func newTestStore(t *testing.T, ns ...string) StoreCloser { 46 clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) 47 return &v2v3TestStore{ 48 v2v3.NewStore(clus.Client(0), "/v2/"), 49 clus, 50 t, 51 } 52 }