@@ -2606,6 +2606,59 @@ func TestConnectionDoSelectRequest(t *testing.T) {
26062606 testConnectionDoSelectRequestCheck (t , resp , err , false , 10 , 1010 )
26072607}
26082608
2609+ func TestConnectionDoWatchOnceRequest (t * testing.T ) {
2610+ watchOnceNotSupported , err := test_helpers .IsTarantoolVersionLess (3 , 0 , 0 )
2611+ if err != nil {
2612+ log .Fatalf ("Could not check the Tarantool version" )
2613+ }
2614+ if watchOnceNotSupported {
2615+ return
2616+ }
2617+
2618+ conn := test_helpers .ConnectWithValidation (t , server , opts )
2619+ defer conn .Close ()
2620+
2621+ _ , err = conn .Do (NewBroadcastRequest ("hello" ).Value ("world" )).Get ()
2622+ if err != nil {
2623+ t .Fatalf ("Failed to create a broadcast : %s" , err .Error ())
2624+ }
2625+
2626+ resp , err := conn .Do (NewWatchOnceRequest ("hello" )).Get ()
2627+ if err != nil {
2628+ t .Fatalf ("Failed to WatchOnce: %s" , err .Error ())
2629+ }
2630+ if resp .Code != OkCode {
2631+ t .Errorf ("Failed to WatchOnce: wrong code returned %d" , resp .Code )
2632+ }
2633+ if len (resp .Data ) < 1 || resp .Data [0 ] != "world" {
2634+ t .Errorf ("Failed to WatchOnce: wrong value returned %v" , resp .Data )
2635+ }
2636+ }
2637+
2638+ func TestConnectionDoWatchOnceOnEmptyKey (t * testing.T ) {
2639+ watchOnceNotSupported , err := test_helpers .IsTarantoolVersionLess (3 , 0 , 0 )
2640+ if err != nil {
2641+ log .Fatalf ("Could not check the Tarantool version" )
2642+ }
2643+ if watchOnceNotSupported {
2644+ return
2645+ }
2646+
2647+ conn := test_helpers .ConnectWithValidation (t , server , opts )
2648+ defer conn .Close ()
2649+
2650+ resp , err := conn .Do (NewWatchOnceRequest ("hello" )).Get ()
2651+ if err != nil {
2652+ t .Fatalf ("Failed to WatchOnce: %s" , err .Error ())
2653+ }
2654+ if resp .Code != OkCode {
2655+ t .Errorf ("Failed to WatchOnce: wrong code returned %d" , resp .Code )
2656+ }
2657+ if len (resp .Data ) > 0 {
2658+ t .Errorf ("Failed to WatchOnce: wrong value returned %v" , resp .Data )
2659+ }
2660+ }
2661+
26092662func TestConnectionDoSelectRequest_fetch_pos (t * testing.T ) {
26102663 test_helpers .SkipIfPaginationUnsupported (t )
26112664
0 commit comments