@@ -39,10 +39,10 @@ func TestMinExpireTime(t *testing.T) {
3939 var eidx uint64 = 1
4040 e , err := s .Get ("/foo" , true , false )
4141 assert .NoError (t , err )
42- assert .Equal (t , e .EtcdIndex , eidx )
43- assert .Equal (t , e . Action , "get" )
44- assert .Equal (t , e .Node .Key , "/foo" )
45- assert .Equal (t , e .Node .TTL , int64 ( 0 ) )
42+ assert .Equal (t , eidx , e .EtcdIndex )
43+ assert .Equal (t , "get" , e . Action )
44+ assert .Equal (t , "/foo" , e .Node .Key )
45+ assert .Equal (t , int64 ( 0 ), e .Node .TTL )
4646}
4747
4848// TestStoreGetDirectory ensures that the store can recursively retrieve a directory listing.
@@ -61,15 +61,15 @@ func TestStoreGetDirectory(t *testing.T) {
6161 var eidx uint64 = 7
6262 e , err := s .Get ("/foo" , true , false )
6363 assert .NoError (t , err )
64- assert .Equal (t , e .EtcdIndex , eidx )
65- assert .Equal (t , e . Action , "get" )
66- assert .Equal (t , e .Node .Key , "/foo" )
64+ assert .Equal (t , eidx , e .EtcdIndex )
65+ assert .Equal (t , "get" , e . Action )
66+ assert .Equal (t , "/foo" , e .Node .Key )
6767 assert .Len (t , e .Node .Nodes , 2 )
6868 var bazNodes NodeExterns
6969 for _ , node := range e .Node .Nodes {
7070 switch node .Key {
7171 case "/foo/bar" :
72- assert .Equal (t , * node .Value , "X" )
72+ assert .Equal (t , "X" , * node .Value )
7373 assert .False (t , node .Dir )
7474 case "/foo/baz" :
7575 assert .True (t , node .Dir )
@@ -82,12 +82,12 @@ func TestStoreGetDirectory(t *testing.T) {
8282 for _ , node := range bazNodes {
8383 switch node .Key {
8484 case "/foo/baz/bat" :
85- assert .Equal (t , * node .Value , "Y" )
85+ assert .Equal (t , "Y" , * node .Value )
8686 assert .False (t , node .Dir )
8787 case "/foo/baz/ttl" :
88- assert .Equal (t , * node .Value , "Y" )
88+ assert .Equal (t , "Y" , * node .Value )
8989 assert .False (t , node .Dir )
90- assert .Equal (t , node . TTL , int64 (3 ))
90+ assert .Equal (t , int64 (3 ), node . TTL )
9191 default :
9292 t .Errorf ("key = %s, not matched" , node .Key )
9393 }
@@ -105,13 +105,13 @@ func TestStoreUpdateValueTTL(t *testing.T) {
105105 _ , err := s .Update ("/foo" , "baz" , TTLOptionSet {ExpireTime : fc .Now ().Add (500 * time .Millisecond )})
106106 assert .NoError (t , err )
107107 e , _ := s .Get ("/foo" , false , false )
108- assert .Equal (t , * e .Node .Value , "baz" )
109- assert .Equal (t , e .EtcdIndex , eidx )
108+ assert .Equal (t , "baz" , * e .Node .Value )
109+ assert .Equal (t , eidx , e .EtcdIndex )
110110 fc .Advance (600 * time .Millisecond )
111111 s .DeleteExpiredKeys (fc .Now ())
112112 e , err = s .Get ("/foo" , false , false )
113113 assert .Nil (t , e )
114- assert .Equal (t , err .(* v2error.Error ).ErrorCode , v2error . EcodeKeyNotFound )
114+ assert .Equal (t , v2error . EcodeKeyNotFound , err .(* v2error.Error ).ErrorCode )
115115}
116116
117117// TestStoreUpdateDirTTL ensures that the store can update the TTL on a directory.
@@ -128,16 +128,16 @@ func TestStoreUpdateDirTTL(t *testing.T) {
128128 e , err := s .Update ("/foo/bar" , "" , TTLOptionSet {ExpireTime : fc .Now ().Add (500 * time .Millisecond )})
129129 assert .NoError (t , err )
130130 assert .False (t , e .Node .Dir )
131- assert .Equal (t , e .EtcdIndex , eidx )
131+ assert .Equal (t , eidx , e .EtcdIndex )
132132 e , _ = s .Get ("/foo/bar" , false , false )
133- assert .Equal (t , * e .Node .Value , "" )
134- assert .Equal (t , e .EtcdIndex , eidx )
133+ assert .Equal (t , "" , * e .Node .Value )
134+ assert .Equal (t , eidx , e .EtcdIndex )
135135
136136 fc .Advance (600 * time .Millisecond )
137137 s .DeleteExpiredKeys (fc .Now ())
138138 e , err = s .Get ("/foo/bar" , false , false )
139139 assert .Nil (t , e )
140- assert .Equal (t , err .(* v2error.Error ).ErrorCode , v2error . EcodeKeyNotFound )
140+ assert .Equal (t , v2error . EcodeKeyNotFound , err .(* v2error.Error ).ErrorCode )
141141}
142142
143143// TestStoreWatchExpire ensures that the store can watch for key expiration.
@@ -152,29 +152,29 @@ func TestStoreWatchExpire(t *testing.T) {
152152 s .Create ("/foodir" , true , "" , false , TTLOptionSet {ExpireTime : fc .Now ().Add (500 * time .Millisecond )})
153153
154154 w , _ := s .Watch ("/" , true , false , 0 )
155- assert .Equal (t , w .StartIndex (), eidx )
155+ assert .Equal (t , eidx , w .StartIndex ())
156156 c := w .EventChan ()
157157 e := nbselect (c )
158158 assert .Nil (t , e )
159159 fc .Advance (600 * time .Millisecond )
160160 s .DeleteExpiredKeys (fc .Now ())
161161 eidx = 4
162162 e = nbselect (c )
163- assert .Equal (t , e .EtcdIndex , eidx )
164- assert .Equal (t , e . Action , "expire" )
165- assert .Equal (t , e .Node .Key , "/foo" )
163+ assert .Equal (t , eidx , e .EtcdIndex )
164+ assert .Equal (t , "expire" , e . Action )
165+ assert .Equal (t , "/foo" , e .Node .Key )
166166 w , _ = s .Watch ("/" , true , false , 5 )
167167 eidx = 6
168- assert .Equal (t , w .StartIndex (), eidx )
168+ assert .Equal (t , eidx , w .StartIndex ())
169169 e = nbselect (w .EventChan ())
170- assert .Equal (t , e .EtcdIndex , eidx )
171- assert .Equal (t , e . Action , "expire" )
172- assert .Equal (t , e .Node .Key , "/foofoo" )
170+ assert .Equal (t , eidx , e .EtcdIndex )
171+ assert .Equal (t , "expire" , e . Action )
172+ assert .Equal (t , "/foofoo" , e .Node .Key )
173173 w , _ = s .Watch ("/" , true , false , 6 )
174174 e = nbselect (w .EventChan ())
175- assert .Equal (t , e .EtcdIndex , eidx )
176- assert .Equal (t , e . Action , "expire" )
177- assert .Equal (t , e .Node .Key , "/foodir" )
175+ assert .Equal (t , eidx , e .EtcdIndex )
176+ assert .Equal (t , "expire" , e . Action )
177+ assert .Equal (t , "/foodir" , e .Node .Key )
178178 assert .True (t , e .Node .Dir )
179179}
180180
@@ -190,28 +190,28 @@ func TestStoreWatchExpireRefresh(t *testing.T) {
190190
191191 // Make sure we set watch updates when Refresh is true for newly created keys
192192 w , _ := s .Watch ("/" , true , false , 0 )
193- assert .Equal (t , w .StartIndex (), eidx )
193+ assert .Equal (t , eidx , w .StartIndex ())
194194 c := w .EventChan ()
195195 e := nbselect (c )
196196 assert .Nil (t , e )
197197 fc .Advance (600 * time .Millisecond )
198198 s .DeleteExpiredKeys (fc .Now ())
199199 eidx = 3
200200 e = nbselect (c )
201- assert .Equal (t , e .EtcdIndex , eidx )
202- assert .Equal (t , e . Action , "expire" )
203- assert .Equal (t , e .Node .Key , "/foo" )
201+ assert .Equal (t , eidx , e .EtcdIndex )
202+ assert .Equal (t , "expire" , e . Action )
203+ assert .Equal (t , "/foo" , e .Node .Key )
204204
205205 s .Update ("/foofoo" , "" , TTLOptionSet {ExpireTime : fc .Now ().Add (500 * time .Millisecond ), Refresh : true })
206206 w , _ = s .Watch ("/" , true , false , 4 )
207207 fc .Advance (700 * time .Millisecond )
208208 s .DeleteExpiredKeys (fc .Now ())
209209 eidx = 5 // We should skip 4 because a TTL update should occur with no watch notification if set `TTLOptionSet.Refresh` to true
210- assert .Equal (t , w .StartIndex (), eidx - 1 )
210+ assert .Equal (t , eidx - 1 , w .StartIndex ())
211211 e = nbselect (w .EventChan ())
212- assert .Equal (t , e .EtcdIndex , eidx )
213- assert .Equal (t , e . Action , "expire" )
214- assert .Equal (t , e .Node .Key , "/foofoo" )
212+ assert .Equal (t , eidx , e .EtcdIndex )
213+ assert .Equal (t , "expire" , e . Action )
214+ assert .Equal (t , "/foofoo" , e .Node .Key )
215215}
216216
217217// TestStoreWatchExpireEmptyRefresh ensures that the store can watch for key expiration when refreshing with an empty value.
@@ -231,12 +231,12 @@ func TestStoreWatchExpireEmptyRefresh(t *testing.T) {
231231 fc .Advance (700 * time .Millisecond )
232232 s .DeleteExpiredKeys (fc .Now ())
233233 eidx = 3 // We should skip 2 because a TTL update should occur with no watch notification if set `TTLOptionSet.Refresh` to true
234- assert .Equal (t , w .StartIndex (), eidx - 1 )
234+ assert .Equal (t , eidx - 1 , w .StartIndex ())
235235 e := nbselect (w .EventChan ())
236- assert .Equal (t , e .EtcdIndex , eidx )
237- assert .Equal (t , e . Action , "expire" )
238- assert .Equal (t , e .Node .Key , "/foo" )
239- assert .Equal (t , * e .PrevNode .Value , "bar" )
236+ assert .Equal (t , eidx , e .EtcdIndex )
237+ assert .Equal (t , "expire" , e . Action )
238+ assert .Equal (t , "/foo" , e .Node .Key )
239+ assert .Equal (t , "bar" , * e .PrevNode .Value )
240240}
241241
242242// TestStoreWatchNoRefresh updates TTL of a key (set TTLOptionSet.Refresh to false) and send notification
@@ -257,12 +257,12 @@ func TestStoreWatchNoRefresh(t *testing.T) {
257257 fc .Advance (700 * time .Millisecond )
258258 s .DeleteExpiredKeys (fc .Now ())
259259 eidx = 2
260- assert .Equal (t , w .StartIndex (), eidx )
260+ assert .Equal (t , eidx , w .StartIndex ())
261261 e := nbselect (w .EventChan ())
262- assert .Equal (t , e .EtcdIndex , eidx )
263- assert .Equal (t , e . Action , "update" )
264- assert .Equal (t , e .Node .Key , "/foo" )
265- assert .Equal (t , * e .PrevNode .Value , "bar" )
262+ assert .Equal (t , eidx , e .EtcdIndex )
263+ assert .Equal (t , "update" , e . Action )
264+ assert .Equal (t , "/foo" , e .Node .Key )
265+ assert .Equal (t , "bar" , * e .PrevNode .Value )
266266}
267267
268268// TestStoreRefresh ensures that the store can update the TTL on a value with refresh.
@@ -313,8 +313,8 @@ func TestStoreRecoverWithExpiration(t *testing.T) {
313313
314314 e , err := s .Get ("/foo/x" , false , false )
315315 assert .NoError (t , err )
316- assert .Equal (t , e .EtcdIndex , eidx )
317- assert .Equal (t , * e .Node .Value , "bar" )
316+ assert .Equal (t , eidx , e .EtcdIndex )
317+ assert .Equal (t , "bar" , * e .Node .Value )
318318
319319 e , err = s .Get ("/foo/y" , false , false )
320320 require .Error (t , err )
@@ -341,8 +341,8 @@ func TestStoreWatchExpireWithHiddenKey(t *testing.T) {
341341 fc .Advance (600 * time .Millisecond )
342342 s .DeleteExpiredKeys (fc .Now ())
343343 e = nbselect (c )
344- assert .Equal (t , e . Action , "expire" )
345- assert .Equal (t , e .Node .Key , "/foofoo" )
344+ assert .Equal (t , "expire" , e . Action )
345+ assert .Equal (t , "/foofoo" , e .Node .Key )
346346}
347347
348348// newFakeClock creates a new FakeClock that has been advanced to at least minExpireTime
0 commit comments