@@ -35,7 +35,7 @@ func compressHelper(t *testing.T, mc *mysqlConn, uncompressedPacket []byte) []by
35
35
}
36
36
37
37
// 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 {
39
39
// mocking out buf variable
40
40
conn := new (mockConn )
41
41
conn .data = compressedPacket
@@ -47,16 +47,13 @@ func uncompressHelper(t *testing.T, mc *mysqlConn, compressedPacket []byte, expS
47
47
t .Fatalf ("non-nil/non-EOF error when reading contents: %s" , err .Error ())
48
48
}
49
49
}
50
- if len (uncompressedPacket ) != expSize {
51
- t .Errorf ("uncompressed size is unexpected. expected %d but got %d" , expSize , len (uncompressedPacket ))
52
- }
53
50
return uncompressedPacket
54
51
}
55
52
56
53
// roundtripHelper compresses then uncompresses uncompressedPacket and checks state variables
57
54
func roundtripHelper (t * testing.T , cSend * mysqlConn , cReceive * mysqlConn , uncompressedPacket []byte ) []byte {
58
55
compressed := compressHelper (t , cSend , uncompressedPacket )
59
- return uncompressHelper (t , cReceive , compressed , len ( uncompressedPacket ) )
56
+ return uncompressHelper (t , cReceive , compressed )
60
57
}
61
58
62
59
// TestRoundtrip tests two connections, where one is reading and the other is writing
@@ -102,10 +99,13 @@ func TestRoundtrip(t *testing.T) {
102
99
cReceive .resetSequence ()
103
100
104
101
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
+ }
105
106
if ! bytes .Equal (uncompressed , test .uncompressed ) {
106
- t .Fatalf ("roundtrip failed" )
107
+ t .Errorf ("roundtrip failed" )
107
108
}
108
-
109
109
if cSend .sequence != cReceive .sequence {
110
110
t .Errorf ("inconsistent sequence number: send=%v recv=%v" ,
111
111
cSend .sequence , cReceive .sequence )
0 commit comments