@@ -308,7 +308,24 @@ func TestWorkspaceWatchRejectsUnsupportedWatchListOptions(t *testing.T) {
308308
309309 t .Run ("resourceVersion" , func (t * testing.T ) {
310310 watcher , err := workspaceStorage .Watch (ctx , & metainternalversion.ListOptions {ResourceVersion : "123" })
311- assertBadRequestWatchOptionsError (t , watcher , err , "resourceVersion" )
311+ if err != nil {
312+ t .Fatalf ("expected resourceVersion watch to be accepted, got %v" , err )
313+ }
314+ if watcher == nil {
315+ t .Fatal ("assertion failed: watcher must not be nil" )
316+ }
317+ watcher .Stop ()
318+ })
319+
320+ t .Run ("legacyResourceVersionZero" , func (t * testing.T ) {
321+ watcher , err := workspaceStorage .Watch (ctx , & metainternalversion.ListOptions {ResourceVersion : "0" })
322+ if err != nil {
323+ t .Fatalf ("expected resourceVersion=0 watch to be accepted, got %v" , err )
324+ }
325+ if watcher == nil {
326+ t .Fatal ("assertion failed: watcher must not be nil" )
327+ }
328+ watcher .Stop ()
312329 })
313330
314331 t .Run ("resourceVersionMatch" , func (t * testing.T ) {
@@ -338,7 +355,24 @@ func TestTemplateWatchRejectsUnsupportedWatchListOptions(t *testing.T) {
338355
339356 t .Run ("resourceVersion" , func (t * testing.T ) {
340357 watcher , err := templateStorage .Watch (ctx , & metainternalversion.ListOptions {ResourceVersion : "123" })
341- assertBadRequestWatchOptionsError (t , watcher , err , "resourceVersion" )
358+ if err != nil {
359+ t .Fatalf ("expected resourceVersion watch to be accepted, got %v" , err )
360+ }
361+ if watcher == nil {
362+ t .Fatal ("assertion failed: watcher must not be nil" )
363+ }
364+ watcher .Stop ()
365+ })
366+
367+ t .Run ("legacyResourceVersionZero" , func (t * testing.T ) {
368+ watcher , err := templateStorage .Watch (ctx , & metainternalversion.ListOptions {ResourceVersion : "0" })
369+ if err != nil {
370+ t .Fatalf ("expected resourceVersion=0 watch to be accepted, got %v" , err )
371+ }
372+ if watcher == nil {
373+ t .Fatal ("assertion failed: watcher must not be nil" )
374+ }
375+ watcher .Stop ()
342376 })
343377
344378 t .Run ("resourceVersionMatch" , func (t * testing.T ) {
@@ -381,9 +415,9 @@ func TestWatchRejectsDefaultedLegacyWatchListOptions(t *testing.T) {
381415 ResourceVersionMatch : metav1 .ResourceVersionMatchNotOlderThan ,
382416 }
383417 workspaceWatcher , err = workspaceStorage .Watch (ctx , legacyOptionsWithZeroRV )
384- assertBadRequestWatchOptionsError (t , workspaceWatcher , err , "resourceVersion " )
418+ assertBadRequestWatchOptionsError (t , workspaceWatcher , err , "sendInitialEvents " )
385419 templateWatcher , err = templateStorage .Watch (ctx , legacyOptionsWithZeroRV )
386- assertBadRequestWatchOptionsError (t , templateWatcher , err , "resourceVersion " )
420+ assertBadRequestWatchOptionsError (t , templateWatcher , err , "sendInitialEvents " )
387421}
388422
389423func TestValidateUnsupportedWatchListOptions (t * testing.T ) {
@@ -427,8 +461,8 @@ func TestValidateUnsupportedWatchListOptions(t *testing.T) {
427461 if err == nil {
428462 t .Fatal ("expected defaulted legacy watch-list options with RV=0 to be rejected" )
429463 }
430- if ! strings .Contains (err .Error (), "resourceVersion " ) {
431- t .Fatalf ("expected defaulted legacy watch-list RV=0 rejection to reference resourceVersion , got %v" , err )
464+ if ! strings .Contains (err .Error (), "sendInitialEvents " ) {
465+ t .Fatalf ("expected defaulted legacy watch-list RV=0 rejection to reference sendInitialEvents , got %v" , err )
432466 }
433467
434468 err = validateUnsupportedWatchListOptions (& metainternalversion.ListOptions {SendInitialEvents : & sendInitialEvents })
@@ -439,6 +473,11 @@ func TestValidateUnsupportedWatchListOptions(t *testing.T) {
439473 t .Fatalf ("expected sendInitialEvents error, got %v" , err )
440474 }
441475
476+ err = validateUnsupportedWatchListOptions (& metainternalversion.ListOptions {ResourceVersion : "123" })
477+ if err != nil {
478+ t .Fatalf ("expected resourceVersion to be accepted, got %v" , err )
479+ }
480+
442481 err = validateUnsupportedWatchListOptions (& metainternalversion.ListOptions {
443482 ResourceVersionMatch : metav1 .ResourceVersionMatchNotOlderThan ,
444483 })
@@ -458,8 +497,8 @@ func TestValidateUnsupportedWatchListOptions(t *testing.T) {
458497 if err == nil {
459498 t .Fatal ("expected non-legacy watch-list options to be rejected" )
460499 }
461- if ! strings .Contains (err .Error (), "resourceVersion " ) {
462- t .Fatalf ("expected non-legacy watch-list rejection to reference resourceVersion , got %v" , err )
500+ if ! strings .Contains (err .Error (), "sendInitialEvents " ) {
501+ t .Fatalf ("expected non-legacy watch-list rejection to reference sendInitialEvents , got %v" , err )
463502 }
464503}
465504
0 commit comments