storage/etcd: add TestWatchDispatchBookmarkEvents unit test

This commit is contained in:
Lukasz Szaszkiewicz 2023-09-01 13:45:44 +02:00
parent 6058540f3d
commit 875b00137f
3 changed files with 14 additions and 3 deletions

View File

@ -312,7 +312,7 @@ func TestNamespaceScopedWatch(t *testing.T) {
func TestWatchDispatchBookmarkEvents(t *testing.T) {
ctx, cacher, terminate := testSetup(t)
t.Cleanup(terminate)
storagetesting.RunTestWatchDispatchBookmarkEvents(ctx, t, cacher)
storagetesting.RunTestWatchDispatchBookmarkEvents(ctx, t, cacher, true)
}
func TestWatchBookmarksWithCorrectResourceVersion(t *testing.T) {

View File

@ -104,6 +104,17 @@ func TestProgressNotify(t *testing.T) {
storagetesting.RunOptionalTestProgressNotify(ctx, t, store)
}
// TestWatchDispatchBookmarkEvents makes sure that
// setting allowWatchBookmarks query param against
// etcd implementation doesn't have any effect.
func TestWatchDispatchBookmarkEvents(t *testing.T) {
clusterConfig := testserver.NewTestConfig(t)
clusterConfig.ExperimentalWatchProgressNotifyInterval = time.Second
ctx, store, _ := testSetup(t, withClientConfig(clusterConfig))
storagetesting.RunTestWatchDispatchBookmarkEvents(ctx, t, store, false)
}
func TestSendInitialEventsBackwardCompatibility(t *testing.T) {
ctx, store, _ := testSetup(t)
storagetesting.RunSendInitialEventsBackwardCompatibility(ctx, t, store)

View File

@ -1042,7 +1042,7 @@ func RunTestNamespaceScopedWatch(ctx context.Context, t *testing.T, store storag
// TODO(#109831): ProgressNotify feature is effectively implementing the same
//
// functionality, so we should refactor this functionality to share the same input.
func RunTestWatchDispatchBookmarkEvents(ctx context.Context, t *testing.T, store storage.Interface) {
func RunTestWatchDispatchBookmarkEvents(ctx context.Context, t *testing.T, store storage.Interface, expectedWatchBookmarks bool) {
key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test-ns"}})
startRV := storedObj.ResourceVersion
@ -1061,7 +1061,7 @@ func RunTestWatchDispatchBookmarkEvents(ctx context.Context, t *testing.T, store
{
name: "allowWatchBookmarks=true",
timeout: 3 * time.Second,
expected: true,
expected: expectedWatchBookmarks,
allowWatchBookmarks: true,
},
}