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