storage/etcd: add TestWatchDispatchBookmarkEvents unit test
This commit is contained in:
		| @@ -312,7 +312,7 @@ func TestNamespaceScopedWatch(t *testing.T) { | |||||||
| func TestWatchDispatchBookmarkEvents(t *testing.T) { | func TestWatchDispatchBookmarkEvents(t *testing.T) { | ||||||
| 	ctx, cacher, terminate := testSetup(t) | 	ctx, cacher, terminate := testSetup(t) | ||||||
| 	t.Cleanup(terminate) | 	t.Cleanup(terminate) | ||||||
| 	storagetesting.RunTestWatchDispatchBookmarkEvents(ctx, t, cacher) | 	storagetesting.RunTestWatchDispatchBookmarkEvents(ctx, t, cacher, true) | ||||||
| } | } | ||||||
|  |  | ||||||
| func TestWatchBookmarksWithCorrectResourceVersion(t *testing.T) { | func TestWatchBookmarksWithCorrectResourceVersion(t *testing.T) { | ||||||
|   | |||||||
| @@ -104,6 +104,17 @@ func TestProgressNotify(t *testing.T) { | |||||||
| 	storagetesting.RunOptionalTestProgressNotify(ctx, t, store) | 	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) { | func TestSendInitialEventsBackwardCompatibility(t *testing.T) { | ||||||
| 	ctx, store, _ := testSetup(t) | 	ctx, store, _ := testSetup(t) | ||||||
| 	storagetesting.RunSendInitialEventsBackwardCompatibility(ctx, t, store) | 	storagetesting.RunSendInitialEventsBackwardCompatibility(ctx, t, store) | ||||||
|   | |||||||
| @@ -1042,7 +1042,7 @@ func RunTestNamespaceScopedWatch(ctx context.Context, t *testing.T, store storag | |||||||
| // TODO(#109831): ProgressNotify feature is effectively implementing the same | // TODO(#109831): ProgressNotify feature is effectively implementing the same | ||||||
| // | // | ||||||
| //	functionality, so we should refactor this functionality to share the same input. | //	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"}}) | 	key, storedObj := testPropagateStore(ctx, t, store, &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test-ns"}}) | ||||||
| 	startRV := storedObj.ResourceVersion | 	startRV := storedObj.ResourceVersion | ||||||
|  |  | ||||||
| @@ -1061,7 +1061,7 @@ func RunTestWatchDispatchBookmarkEvents(ctx context.Context, t *testing.T, store | |||||||
| 		{ | 		{ | ||||||
| 			name:                "allowWatchBookmarks=true", | 			name:                "allowWatchBookmarks=true", | ||||||
| 			timeout:             3 * time.Second, | 			timeout:             3 * time.Second, | ||||||
| 			expected:            true, | 			expected:            expectedWatchBookmarks, | ||||||
| 			allowWatchBookmarks: true, | 			allowWatchBookmarks: true, | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Lukasz Szaszkiewicz
					Lukasz Szaszkiewicz