@@ -44,7 +44,7 @@ func TestWatch(t *testing.T) {
4444 defer w .Close ()
4545
4646 w .Watch (0 , testKey , nil , 0 )
47- if ! s .synced .contains (string (testKey )) {
47+ if ! s .( * watchableStore ). synced .contains (string (testKey )) {
4848 // the key must have had an entry in synced
4949 t .Errorf ("existence = false, want true" )
5050 }
@@ -67,7 +67,7 @@ func TestNewWatcherCancel(t *testing.T) {
6767 t .Error (err )
6868 }
6969
70- if s .synced .contains (string (testKey )) {
70+ if s .( * watchableStore ). synced .contains (string (testKey )) {
7171 // the key shoud have been deleted
7272 t .Errorf ("existence = true, want false" )
7373 }
@@ -340,7 +340,9 @@ func TestWatchNoEventLossOnCompact(t *testing.T) {
340340 require .NoError (t , err )
341341 }
342342 // fill up w.Chan() with 1 buf via 2 compacted watch response
343- s .syncWatchers ([]mvccpb.Event {})
343+ sImpl , ok := s .(* watchableStore )
344+ require .Truef (t , ok , "TestWatchNoEventLossOnCompact: needs a WatchableKV implementation" )
345+ sImpl .syncWatchers ([]mvccpb.Event {})
344346
345347 for len (watchers ) > 0 {
346348 resp := <- w .Chan ()
@@ -355,7 +357,7 @@ func TestWatchNoEventLossOnCompact(t *testing.T) {
355357 require .Equalf (t , nextRev , ev .Kv .ModRevision , "got event revision %d but want %d for watcher with watch ID %d" , ev .Kv .ModRevision , nextRev , resp .WatchID )
356358 nextRev ++
357359 }
358- if nextRev == s .rev ()+ 1 {
360+ if nextRev == sImpl .rev ()+ 1 {
359361 delete (watchers , resp .WatchID )
360362 }
361363 }
@@ -566,10 +568,13 @@ func TestWatchBatchUnsynced(t *testing.T) {
566568 }
567569 assert .Equal (t , tc .expectRevisionBatches , revisionBatches )
568570
569- s .store .revMu .Lock ()
570- defer s .store .revMu .Unlock ()
571- assert .Equal (t , 1 , s .synced .size ())
572- assert .Equal (t , 0 , s .unsynced .size ())
571+ sImpl , ok := s .(* watchableStore )
572+ require .Truef (t , ok , "TestWatchBatchUnsynced: needs a WatchableKV implementation" )
573+
574+ sImpl .store .revMu .Lock ()
575+ defer sImpl .store .revMu .Unlock ()
576+ assert .Equal (t , 1 , sImpl .synced .size ())
577+ assert .Equal (t , 0 , sImpl .unsynced .size ())
573578 })
574579 }
575580}
0 commit comments