*: fix "v2store" imports

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-02-26 15:16:21 -08:00
parent 33d8126c6b
commit 811566f2f2
6 changed files with 74 additions and 75 deletions

View File

@ -1588,13 +1588,13 @@ func TestServeKeysEvent(t *testing.T) {
), ),
etcdserver.Response{ etcdserver.Response{
Event: &v2store.Event{ Event: &v2store.Event{
Action: store.CompareAndSwap, Action: v2store.CompareAndSwap,
Node: &v2store.NodeExtern{}, Node: &v2store.NodeExtern{},
}, },
}, },
http.StatusOK, http.StatusOK,
&v2store.Event{ &v2store.Event{
Action: store.CompareAndSwap, Action: v2store.CompareAndSwap,
Node: nil, Node: nil,
}, },
}, },

View File

@ -544,7 +544,7 @@ func TestClusterUpdateAttributes(t *testing.T) {
} }
func TestNodeToMember(t *testing.T) { func TestNodeToMember(t *testing.T) {
n := &store.NodeExtern{Key: "/1234", Nodes: []*v2store.NodeExtern{ n := &v2store.NodeExtern{Key: "/1234", Nodes: []*v2store.NodeExtern{
{Key: "/1234/attributes", Value: stringp(`{"name":"node1","clientURLs":null}`)}, {Key: "/1234/attributes", Value: stringp(`{"name":"node1","clientURLs":null}`)},
{Key: "/1234/raftAttributes", Value: stringp(`{"peerURLs":null}`)}, {Key: "/1234/raftAttributes", Value: stringp(`{"peerURLs":null}`)},
}} }}

View File

@ -29,7 +29,6 @@ import (
pb "github.com/coreos/etcd/etcdserver/etcdserverpb" pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/etcdserver/membership" "github.com/coreos/etcd/etcdserver/membership"
"github.com/coreos/etcd/etcdserver/v2store" "github.com/coreos/etcd/etcdserver/v2store"
"github.com/coreos/etcd/internal/store"
"github.com/coreos/etcd/lease" "github.com/coreos/etcd/lease"
"github.com/coreos/etcd/mvcc" "github.com/coreos/etcd/mvcc"
"github.com/coreos/etcd/mvcc/backend" "github.com/coreos/etcd/mvcc/backend"
@ -90,7 +89,7 @@ func TestDoLocalAction(t *testing.T) {
for i, tt := range tests { for i, tt := range tests {
st := mockstore.NewRecorder() st := mockstore.NewRecorder()
srv := &EtcdServer{ srv := &EtcdServer{
store: st, v2store: st,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
} }
resp, err := srv.Do(context.TODO(), tt.req) resp, err := srv.Do(context.TODO(), tt.req)
@ -143,7 +142,7 @@ func TestDoBadLocalAction(t *testing.T) {
for i, tt := range tests { for i, tt := range tests {
st := mockstore.NewErrRecorder(storeErr) st := mockstore.NewErrRecorder(storeErr)
srv := &EtcdServer{ srv := &EtcdServer{
store: st, v2store: st,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
} }
resp, err := srv.Do(context.Background(), tt.req) resp, err := srv.Do(context.Background(), tt.req)
@ -179,12 +178,12 @@ func TestApplyRepeat(t *testing.T) {
}) })
s := &EtcdServer{ s := &EtcdServer{
r: *r, r: *r,
store: st, v2store: st,
cluster: cl, cluster: cl,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},
} }
s.applyV2 = &applierV2store{store: s.store, cluster: s.cluster} s.applyV2 = &applierV2store{store: s.v2store, cluster: s.cluster}
s.start() s.start()
req := &pb.Request{Method: "QGET", ID: uint64(1)} req := &pb.Request{Method: "QGET", ID: uint64(1)}
ents := []raftpb.Entry{{Index: 1, Data: pbutil.MustMarshal(req)}} ents := []raftpb.Entry{{Index: 1, Data: pbutil.MustMarshal(req)}}
@ -449,8 +448,8 @@ func TestApplyRequest(t *testing.T) {
for i, tt := range tests { for i, tt := range tests {
st := mockstore.NewRecorder() st := mockstore.NewRecorder()
srv := &EtcdServer{store: st} srv := &EtcdServer{v2store: st}
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
resp := srv.applyV2Request((*RequestV2)(&tt.req)) resp := srv.applyV2Request((*RequestV2)(&tt.req))
if !reflect.DeepEqual(resp, tt.wresp) { if !reflect.DeepEqual(resp, tt.wresp) {
@ -466,10 +465,10 @@ func TestApplyRequest(t *testing.T) {
func TestApplyRequestOnAdminMemberAttributes(t *testing.T) { func TestApplyRequestOnAdminMemberAttributes(t *testing.T) {
cl := newTestCluster([]*membership.Member{{ID: 1}}) cl := newTestCluster([]*membership.Member{{ID: 1}})
srv := &EtcdServer{ srv := &EtcdServer{
store: mockstore.NewRecorder(), v2store: mockstore.NewRecorder(),
cluster: cl, cluster: cl,
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
req := pb.Request{ req := pb.Request{
Method: "PUT", Method: "PUT",
@ -686,11 +685,11 @@ func TestDoProposal(t *testing.T) {
srv := &EtcdServer{ srv := &EtcdServer{
Cfg: ServerConfig{TickMs: 1}, Cfg: ServerConfig{TickMs: 1},
r: *r, r: *r,
store: st, v2store: st,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
srv.start() srv.start()
resp, err := srv.Do(context.Background(), tt) resp, err := srv.Do(context.Background(), tt)
srv.Stop() srv.Stop()
@ -718,7 +717,7 @@ func TestDoProposalCancelled(t *testing.T) {
w: wt, w: wt,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
cancel() cancel()
@ -740,7 +739,7 @@ func TestDoProposalTimeout(t *testing.T) {
w: mockwait.NewNop(), w: mockwait.NewNop(),
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
ctx, cancel := context.WithTimeout(context.Background(), 0) ctx, cancel := context.WithTimeout(context.Background(), 0)
_, err := srv.Do(ctx, pb.Request{Method: "PUT"}) _, err := srv.Do(ctx, pb.Request{Method: "PUT"})
@ -757,7 +756,7 @@ func TestDoProposalStopped(t *testing.T) {
w: mockwait.NewNop(), w: mockwait.NewNop(),
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
srv.stopping = make(chan struct{}) srv.stopping = make(chan struct{})
close(srv.stopping) close(srv.stopping)
@ -777,7 +776,7 @@ func TestSync(t *testing.T) {
ctx: ctx, ctx: ctx,
cancel: cancel, cancel: cancel,
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
// check that sync is non-blocking // check that sync is non-blocking
done := make(chan struct{}) done := make(chan struct{})
@ -820,7 +819,7 @@ func TestSyncTimeout(t *testing.T) {
ctx: ctx, ctx: ctx,
cancel: cancel, cancel: cancel,
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
// check that sync is non-blocking // check that sync is non-blocking
done := make(chan struct{}) done := make(chan struct{})
@ -858,7 +857,7 @@ func TestSyncTrigger(t *testing.T) {
srv := &EtcdServer{ srv := &EtcdServer{
Cfg: ServerConfig{TickMs: 1}, Cfg: ServerConfig{TickMs: 1},
r: *r, r: *r,
store: mockstore.NewNop(), v2store: mockstore.NewNop(),
SyncTicker: tk, SyncTicker: tk,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
} }
@ -915,7 +914,7 @@ func TestSnapshot(t *testing.T) {
}) })
srv := &EtcdServer{ srv := &EtcdServer{
r: *r, r: *r,
store: st, v2store: st,
} }
srv.kv = mvcc.New(be, &lease.FakeLessor{}, &srv.consistIndex) srv.kv = mvcc.New(be, &lease.FakeLessor{}, &srv.consistIndex)
srv.be = be srv.be = be
@ -958,7 +957,7 @@ func TestSnapshot(t *testing.T) {
// snapshot db is applied. // snapshot db is applied.
func TestSnapshotOrdering(t *testing.T) { func TestSnapshotOrdering(t *testing.T) {
n := newNopReadyNode() n := newNopReadyNode()
st := store.New() st := v2store.New()
cl := membership.NewCluster("abc") cl := membership.NewCluster("abc")
cl.SetStore(st) cl.SetStore(st)
@ -986,12 +985,12 @@ func TestSnapshotOrdering(t *testing.T) {
s := &EtcdServer{ s := &EtcdServer{
Cfg: ServerConfig{DataDir: testdir}, Cfg: ServerConfig{DataDir: testdir},
r: *r, r: *r,
store: st, v2store: st,
snapshotter: raftsnap.New(snapdir), snapshotter: raftsnap.New(snapdir),
cluster: cl, cluster: cl,
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},
} }
s.applyV2 = &applierV2store{store: s.store, cluster: s.cluster} s.applyV2 = &applierV2store{store: s.v2store, cluster: s.cluster}
be, tmpPath := backend.NewDefaultTmpBackend() be, tmpPath := backend.NewDefaultTmpBackend()
defer os.RemoveAll(tmpPath) defer os.RemoveAll(tmpPath)
@ -1047,11 +1046,11 @@ func TestTriggerSnap(t *testing.T) {
srv := &EtcdServer{ srv := &EtcdServer{
Cfg: ServerConfig{TickMs: 1, SnapCount: uint64(snapc)}, Cfg: ServerConfig{TickMs: 1, SnapCount: uint64(snapc)},
r: *r, r: *r,
store: st, v2store: st,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},
} }
srv.applyV2 = &applierV2store{store: srv.store, cluster: srv.cluster} srv.applyV2 = &applierV2store{store: srv.v2store, cluster: srv.cluster}
srv.kv = mvcc.New(be, &lease.FakeLessor{}, &srv.consistIndex) srv.kv = mvcc.New(be, &lease.FakeLessor{}, &srv.consistIndex)
srv.be = be srv.be = be
@ -1086,7 +1085,7 @@ func TestTriggerSnap(t *testing.T) {
// proposals. // proposals.
func TestConcurrentApplyAndSnapshotV3(t *testing.T) { func TestConcurrentApplyAndSnapshotV3(t *testing.T) {
n := newNopReadyNode() n := newNopReadyNode()
st := store.New() st := v2store.New()
cl := membership.NewCluster("abc") cl := membership.NewCluster("abc")
cl.SetStore(st) cl.SetStore(st)
@ -1111,12 +1110,12 @@ func TestConcurrentApplyAndSnapshotV3(t *testing.T) {
s := &EtcdServer{ s := &EtcdServer{
Cfg: ServerConfig{DataDir: testdir}, Cfg: ServerConfig{DataDir: testdir},
r: *r, r: *r,
store: st, v2store: st,
snapshotter: raftsnap.New(testdir), snapshotter: raftsnap.New(testdir),
cluster: cl, cluster: cl,
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},
} }
s.applyV2 = &applierV2store{store: s.store, cluster: s.cluster} s.applyV2 = &applierV2store{store: s.v2store, cluster: s.cluster}
be, tmpPath := backend.NewDefaultTmpBackend() be, tmpPath := backend.NewDefaultTmpBackend()
defer func() { defer func() {
@ -1184,7 +1183,7 @@ func TestAddMember(t *testing.T) {
SoftState: &raft.SoftState{RaftState: raft.StateLeader}, SoftState: &raft.SoftState{RaftState: raft.StateLeader},
} }
cl := newTestCluster(nil) cl := newTestCluster(nil)
st := store.New() st := v2store.New()
cl.SetStore(st) cl.SetStore(st)
r := newRaftNode(raftNodeConfig{ r := newRaftNode(raftNodeConfig{
Node: n, Node: n,
@ -1194,7 +1193,7 @@ func TestAddMember(t *testing.T) {
}) })
s := &EtcdServer{ s := &EtcdServer{
r: *r, r: *r,
store: st, v2store: st,
cluster: cl, cluster: cl,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},
@ -1224,7 +1223,7 @@ func TestRemoveMember(t *testing.T) {
SoftState: &raft.SoftState{RaftState: raft.StateLeader}, SoftState: &raft.SoftState{RaftState: raft.StateLeader},
} }
cl := newTestCluster(nil) cl := newTestCluster(nil)
st := store.New() st := v2store.New()
cl.SetStore(v2store.New()) cl.SetStore(v2store.New())
cl.AddMember(&membership.Member{ID: 1234}) cl.AddMember(&membership.Member{ID: 1234})
r := newRaftNode(raftNodeConfig{ r := newRaftNode(raftNodeConfig{
@ -1235,7 +1234,7 @@ func TestRemoveMember(t *testing.T) {
}) })
s := &EtcdServer{ s := &EtcdServer{
r: *r, r: *r,
store: st, v2store: st,
cluster: cl, cluster: cl,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},
@ -1264,7 +1263,7 @@ func TestUpdateMember(t *testing.T) {
SoftState: &raft.SoftState{RaftState: raft.StateLeader}, SoftState: &raft.SoftState{RaftState: raft.StateLeader},
} }
cl := newTestCluster(nil) cl := newTestCluster(nil)
st := store.New() st := v2store.New()
cl.SetStore(st) cl.SetStore(st)
cl.AddMember(&membership.Member{ID: 1234}) cl.AddMember(&membership.Member{ID: 1234})
r := newRaftNode(raftNodeConfig{ r := newRaftNode(raftNodeConfig{
@ -1275,7 +1274,7 @@ func TestUpdateMember(t *testing.T) {
}) })
s := &EtcdServer{ s := &EtcdServer{
r: *r, r: *r,
store: st, v2store: st,
cluster: cl, cluster: cl,
reqIDGen: idutil.NewGenerator(0, time.Time{}), reqIDGen: idutil.NewGenerator(0, time.Time{}),
SyncTicker: &time.Ticker{}, SyncTicker: &time.Ticker{},

View File

@ -841,7 +841,7 @@ func TestStoreWatchSlowConsumer(t *testing.T) {
} }
// Performs a non-blocking select on an event channel. // Performs a non-blocking select on an event channel.
func nbselect(c <-chan *store.Event) *store.Event { func nbselect(c <-chan *v2store.Event) *v2store.Event {
select { select {
case e := <-c: case e := <-c:
return e return e
@ -851,7 +851,7 @@ func nbselect(c <-chan *store.Event) *store.Event {
} }
// Performs a non-blocking select on an event channel. // Performs a non-blocking select on an event channel.
func timeoutSelect(t *testing.T, c <-chan *store.Event) *store.Event { func timeoutSelect(t *testing.T, c <-chan *v2store.Event) *v2store.Event {
select { select {
case e := <-c: case e := <-c:
return e return e

View File

@ -54,28 +54,28 @@ func (s *storeRecorder) Get(path string, recursive, sorted bool) (*v2store.Event
}) })
return &v2store.Event{}, nil return &v2store.Event{}, nil
} }
func (s *storeRecorder) Set(path string, dir bool, val string, expireOpts store.TTLOptionSet) (*v2store.Event, error) { func (s *storeRecorder) Set(path string, dir bool, val string, expireOpts v2store.TTLOptionSet) (*v2store.Event, error) {
s.Record(testutil.Action{ s.Record(testutil.Action{
Name: "Set", Name: "Set",
Params: []interface{}{path, dir, val, expireOpts}, Params: []interface{}{path, dir, val, expireOpts},
}) })
return &v2store.Event{}, nil return &v2store.Event{}, nil
} }
func (s *storeRecorder) Update(path, val string, expireOpts store.TTLOptionSet) (*v2store.Event, error) { func (s *storeRecorder) Update(path, val string, expireOpts v2store.TTLOptionSet) (*v2store.Event, error) {
s.Record(testutil.Action{ s.Record(testutil.Action{
Name: "Update", Name: "Update",
Params: []interface{}{path, val, expireOpts}, Params: []interface{}{path, val, expireOpts},
}) })
return &v2store.Event{}, nil return &v2store.Event{}, nil
} }
func (s *storeRecorder) Create(path string, dir bool, val string, uniq bool, expireOpts store.TTLOptionSet) (*v2store.Event, error) { func (s *storeRecorder) Create(path string, dir bool, val string, uniq bool, expireOpts v2store.TTLOptionSet) (*v2store.Event, error) {
s.Record(testutil.Action{ s.Record(testutil.Action{
Name: "Create", Name: "Create",
Params: []interface{}{path, dir, val, uniq, expireOpts}, Params: []interface{}{path, dir, val, uniq, expireOpts},
}) })
return &v2store.Event{}, nil return &v2store.Event{}, nil
} }
func (s *storeRecorder) CompareAndSwap(path, prevVal string, prevIdx uint64, val string, expireOpts store.TTLOptionSet) (*v2store.Event, error) { func (s *storeRecorder) CompareAndSwap(path, prevVal string, prevIdx uint64, val string, expireOpts v2store.TTLOptionSet) (*v2store.Event, error) {
s.Record(testutil.Action{ s.Record(testutil.Action{
Name: "CompareAndSwap", Name: "CompareAndSwap",
Params: []interface{}{path, prevVal, prevIdx, val, expireOpts}, Params: []interface{}{path, prevVal, prevIdx, val, expireOpts},
@ -96,9 +96,9 @@ func (s *storeRecorder) CompareAndDelete(path, prevVal string, prevIdx uint64) (
}) })
return &v2store.Event{}, nil return &v2store.Event{}, nil
} }
func (s *storeRecorder) Watch(_ string, _, _ bool, _ uint64) (store.Watcher, error) { func (s *storeRecorder) Watch(_ string, _, _ bool, _ uint64) (v2store.Watcher, error) {
s.Record(testutil.Action{Name: "Watch"}) s.Record(testutil.Action{Name: "Watch"})
return store.NewNopWatcher(), nil return v2store.NewNopWatcher(), nil
} }
func (s *storeRecorder) Save() ([]byte, error) { func (s *storeRecorder) Save() ([]byte, error) {
s.Record(testutil.Action{Name: "Save"}) s.Record(testutil.Action{Name: "Save"})
@ -114,7 +114,7 @@ func (s *storeRecorder) SaveNoCopy() ([]byte, error) {
return nil, nil return nil, nil
} }
func (s *storeRecorder) Clone() store.Store { func (s *storeRecorder) Clone() v2store.Store {
s.Record(testutil.Action{Name: "Clone"}) s.Record(testutil.Action{Name: "Clone"})
return s return s
} }
@ -151,7 +151,7 @@ func (s *errStoreRecorder) Get(path string, recursive, sorted bool) (*v2store.Ev
s.storeRecorder.Get(path, recursive, sorted) s.storeRecorder.Get(path, recursive, sorted)
return nil, s.err return nil, s.err
} }
func (s *errStoreRecorder) Watch(path string, recursive, sorted bool, index uint64) (store.Watcher, error) { func (s *errStoreRecorder) Watch(path string, recursive, sorted bool, index uint64) (v2store.Watcher, error) {
s.storeRecorder.Watch(path, recursive, sorted, index) s.storeRecorder.Watch(path, recursive, sorted, index)
return nil, s.err return nil, s.err
} }