@@ -14,6 +14,7 @@ import (
1414 "crypto/x509"
1515 "errors"
1616 "fmt"
17+ "github.com/gocql/gocql/internal/streams"
1718 "io"
1819 "io/ioutil"
1920 "math/rand"
@@ -24,8 +25,6 @@ import (
2425 "sync/atomic"
2526 "testing"
2627 "time"
27-
28- "github.com/gocql/gocql/internal/streams"
2928)
3029
3130const (
@@ -672,6 +671,7 @@ func TestQueryTimeoutClose(t *testing.T) {
672671func TestStream0 (t * testing.T ) {
673672 // TODO: replace this with type check
674673 const expErr = "gocql: received unexpected frame on stream 0"
674+ const maxRequestsPerConn = 13
675675
676676 var buf bytes.Buffer
677677 f := newFramer (nil , protoVersion4 )
@@ -685,13 +685,22 @@ func TestStream0(t *testing.T) {
685685 t .Fatal (err )
686686 }
687687
688+ srv := NewTestServer (t , defaultProto , context .Background ())
689+ defer srv .Stop ()
690+ cluster := testCluster (defaultProto , srv .Address )
691+ s , err := cluster .CreateSession ()
692+ s .cfg .MaxRequestsPerConn = maxRequestsPerConn
693+ if err != nil {
694+ t .Fatalf ("NewCluster: %v" , err )
695+ }
696+
688697 conn := & Conn {
689698 r : bufio .NewReader (& buf ),
690- streams : streams .New ( protoVersion4 ),
699+ streams : streams .NewStreamIDGenerator ( defaultProto , s . cfg . MaxRequestsPerConn ),
691700 logger : & defaultLogger {},
692701 }
693702
694- err : = conn .recv (context .Background ())
703+ err = conn .recv (context .Background ())
695704 if err == nil {
696705 t .Fatal ("expected to get an error on stream 0" )
697706 } else if ! strings .HasPrefix (err .Error (), expErr ) {
0 commit comments