@@ -44,7 +44,7 @@ func TestWatch(t *testing.T) {
44
44
defer w .Close ()
45
45
46
46
w .Watch (0 , testKey , nil , 0 )
47
- if ! s .synced .contains (string (testKey )) {
47
+ if ! s .( * watchableStore ). synced .contains (string (testKey )) {
48
48
// the key must have had an entry in synced
49
49
t .Errorf ("existence = false, want true" )
50
50
}
@@ -67,7 +67,7 @@ func TestNewWatcherCancel(t *testing.T) {
67
67
t .Error (err )
68
68
}
69
69
70
- if s .synced .contains (string (testKey )) {
70
+ if s .( * watchableStore ). synced .contains (string (testKey )) {
71
71
// the key shoud have been deleted
72
72
t .Errorf ("existence = true, want false" )
73
73
}
@@ -340,7 +340,9 @@ func TestWatchNoEventLossOnCompact(t *testing.T) {
340
340
require .NoError (t , err )
341
341
}
342
342
// 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 {})
344
346
345
347
for len (watchers ) > 0 {
346
348
resp := <- w .Chan ()
@@ -355,7 +357,7 @@ func TestWatchNoEventLossOnCompact(t *testing.T) {
355
357
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 )
356
358
nextRev ++
357
359
}
358
- if nextRev == s .rev ()+ 1 {
360
+ if nextRev == sImpl .rev ()+ 1 {
359
361
delete (watchers , resp .WatchID )
360
362
}
361
363
}
@@ -566,10 +568,13 @@ func TestWatchBatchUnsynced(t *testing.T) {
566
568
}
567
569
assert .Equal (t , tc .expectRevisionBatches , revisionBatches )
568
570
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 ())
573
578
})
574
579
}
575
580
}
0 commit comments