@@ -35,7 +35,7 @@ func compressHelper(t *testing.T, mc *mysqlConn, uncompressedPacket []byte) []by
3535}
3636
3737// uncompressHelper uncompresses compressedPacket and checks state variables
38- func uncompressHelper (t * testing.T , mc * mysqlConn , compressedPacket []byte , expSize int ) []byte {
38+ func uncompressHelper (t * testing.T , mc * mysqlConn , compressedPacket []byte ) []byte {
3939 // mocking out buf variable
4040 conn := new (mockConn )
4141 conn .data = compressedPacket
@@ -47,16 +47,13 @@ func uncompressHelper(t *testing.T, mc *mysqlConn, compressedPacket []byte, expS
4747 t .Fatalf ("non-nil/non-EOF error when reading contents: %s" , err .Error ())
4848 }
4949 }
50- if len (uncompressedPacket ) != expSize {
51- t .Errorf ("uncompressed size is unexpected. expected %d but got %d" , expSize , len (uncompressedPacket ))
52- }
5350 return uncompressedPacket
5451}
5552
5653// roundtripHelper compresses then uncompresses uncompressedPacket and checks state variables
5754func roundtripHelper (t * testing.T , cSend * mysqlConn , cReceive * mysqlConn , uncompressedPacket []byte ) []byte {
5855 compressed := compressHelper (t , cSend , uncompressedPacket )
59- return uncompressHelper (t , cReceive , compressed , len ( uncompressedPacket ) )
56+ return uncompressHelper (t , cReceive , compressed )
6057}
6158
6259// TestRoundtrip tests two connections, where one is reading and the other is writing
@@ -102,10 +99,13 @@ func TestRoundtrip(t *testing.T) {
10299 cReceive .resetSequence ()
103100
104101 uncompressed := roundtripHelper (t , cSend , cReceive , test .uncompressed )
102+ if len (uncompressed ) != len (test .uncompressed ) {
103+ t .Errorf ("uncompressed size is unexpected. expected %d but got %d" ,
104+ len (test .uncompressed ), len (uncompressed ))
105+ }
105106 if ! bytes .Equal (uncompressed , test .uncompressed ) {
106- t .Fatalf ("roundtrip failed" )
107+ t .Errorf ("roundtrip failed" )
107108 }
108-
109109 if cSend .sequence != cReceive .sequence {
110110 t .Errorf ("inconsistent sequence number: send=%v recv=%v" ,
111111 cSend .sequence , cReceive .sequence )
0 commit comments