@@ -4200,6 +4200,71 @@ func TestFdDialer(t *testing.T) {
42004200 require .Equal (t , int8 (0 ), resp [0 ])
42014201}
42024202
4203+ func TestDoBeginRequest_IsSync (t * testing.T ) {
4204+ test_helpers .SkipIfIsSyncUnsupported (t )
4205+
4206+ conn := test_helpers .ConnectWithValidation (t , dialer , opts )
4207+ defer conn .Close ()
4208+
4209+ stream , err := conn .NewStream ()
4210+ require .NoError (t , err )
4211+
4212+ _ , err = stream .Do (NewBeginRequest ().IsSync (true )).Get ()
4213+ assert .Nil (t , err )
4214+
4215+ _ , err = stream .Do (
4216+ NewReplaceRequest ("test" ).Tuple ([]interface {}{1 , "foo" }),
4217+ ).Get ()
4218+ require .Nil (t , err )
4219+
4220+ _ , err = stream .Do (NewCommitRequest ()).Get ()
4221+ require .NotNil (t , err )
4222+ assert .Contains (t , err .Error (), "The synchronous transaction queue doesn't belong to any instance" )
4223+ }
4224+
4225+ func TestDoCommitRequest_IsSync (t * testing.T ) {
4226+ test_helpers .SkipIfIsSyncUnsupported (t )
4227+
4228+ conn := test_helpers .ConnectWithValidation (t , dialer , opts )
4229+ defer conn .Close ()
4230+
4231+ stream , err := conn .NewStream ()
4232+ require .NoError (t , err )
4233+
4234+ _ , err = stream .Do (NewBeginRequest ()).Get ()
4235+ require .Nil (t , err )
4236+
4237+ _ , err = stream .Do (
4238+ NewReplaceRequest ("test" ).Tuple ([]interface {}{1 , "foo" }),
4239+ ).Get ()
4240+ require .Nil (t , err )
4241+
4242+ _ , err = stream .Do (NewCommitRequest ().IsSync (true )).Get ()
4243+ require .NotNil (t , err )
4244+ assert .Contains (t , err .Error (), "The synchronous transaction queue doesn't belong to any instance" )
4245+ }
4246+
4247+ func TestDoCommitRequest_NoSync (t * testing.T ) {
4248+ test_helpers .SkipIfIsSyncUnsupported (t )
4249+
4250+ conn := test_helpers .ConnectWithValidation (t , dialer , opts )
4251+ defer conn .Close ()
4252+
4253+ stream , err := conn .NewStream ()
4254+ require .NoError (t , err )
4255+
4256+ _ , err = stream .Do (NewBeginRequest ()).Get ()
4257+ require .Nil (t , err )
4258+
4259+ _ , err = stream .Do (
4260+ NewReplaceRequest ("test" ).Tuple ([]interface {}{1 , "foo" }),
4261+ ).Get ()
4262+ require .Nil (t , err )
4263+
4264+ _ , err = stream .Do (NewCommitRequest ()).Get ()
4265+ assert .Nil (t , err )
4266+ }
4267+
42034268// runTestMain is a body of TestMain function
42044269// (see https://pkg.go.dev/testing#hdr-Main).
42054270// Using defer + os.Exit is not works so TestMain body
0 commit comments