Generate modification index only if f.TestIndex is specified.

This is for compatibility with existing tests.
pull/6/head
Kouhei Ueno 2014-07-31 16:01:28 +09:00
parent b82bb37c89
commit e40cdd50ed
1 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,7 @@ type FakeEtcdClient struct {
Err error
t TestLogger
Ix int
TestIndex bool
ChangeIndex uint64
// Will become valid after Watch is called; tester may write to it. Tester may
@ -72,6 +73,10 @@ func MakeFakeEtcdClient(t TestLogger) *FakeEtcdClient {
}
func (f *FakeEtcdClient) generateIndex() uint64 {
if !f.TestIndex {
return 0
}
f.ChangeIndex++
return f.ChangeIndex
}