Skip to content

Commit 198f0bf

Browse files
committed
Revert "re-implement TestRegression801"
This reverts commit 3ae4b2f.
1 parent 3ae4b2f commit 198f0bf

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

packets_test.go

+33-30
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
package mysql
1010

1111
import (
12-
"bytes"
1312
"context"
1413
"io"
1514
"net"
@@ -272,32 +271,36 @@ func TestReadPacketFail(t *testing.T) {
272271
})
273272
}
274273

275-
// https://github.com/go-sql-driver/mysql/pull/801
276-
// not-NUL terminated plugin_name in init packet
277-
func TestRegression801(t *testing.T) {
278-
conn, mc := newRWMockConn(t, 42)
279-
280-
go func() {
281-
conn.Write([]byte{72, 0, 0, 42, 10, 53, 46, 53, 46, 56, 0, 165, 0, 0, 0,
282-
60, 70, 63, 58, 68, 104, 34, 97, 0, 223, 247, 33, 2, 0, 15, 128, 21, 0,
283-
0, 0, 0, 0, 0, 0, 0, 0, 0, 98, 120, 114, 47, 85, 75, 109, 99, 51, 77,
284-
50, 64, 0, 109, 121, 115, 113, 108, 95, 110, 97, 116, 105, 118, 101, 95,
285-
112, 97, 115, 115, 119, 111, 114, 100})
286-
conn.Close()
287-
}()
288-
289-
authData, pluginName, err := mc.readHandshakePacket(context.Background())
290-
if err != nil {
291-
t.Fatalf("got error: %v", err)
292-
}
293-
294-
if pluginName != "mysql_native_password" {
295-
t.Errorf("expected plugin name 'mysql_native_password', got '%s'", pluginName)
296-
}
297-
298-
expectedAuthData := []byte{60, 70, 63, 58, 68, 104, 34, 97, 98, 120, 114,
299-
47, 85, 75, 109, 99, 51, 77, 50, 64}
300-
if !bytes.Equal(authData, expectedAuthData) {
301-
t.Errorf("expected authData '%v', got '%v'", expectedAuthData, authData)
302-
}
303-
}
274+
// // https://github.com/go-sql-driver/mysql/pull/801
275+
// // not-NUL terminated plugin_name in init packet
276+
// func TestRegression801(t *testing.T) {
277+
// conn := new(mockConn)
278+
// mc := &mysqlConn{
279+
// buf: newBuffer(conn),
280+
// cfg: new(Config),
281+
// sequence: 42,
282+
// closech: make(chan struct{}),
283+
// }
284+
285+
// conn.data = []byte{72, 0, 0, 42, 10, 53, 46, 53, 46, 56, 0, 165, 0, 0, 0,
286+
// 60, 70, 63, 58, 68, 104, 34, 97, 0, 223, 247, 33, 2, 0, 15, 128, 21, 0,
287+
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, 120, 114, 47, 85, 75, 109, 99, 51, 77,
288+
// 50, 64, 0, 109, 121, 115, 113, 108, 95, 110, 97, 116, 105, 118, 101, 95,
289+
// 112, 97, 115, 115, 119, 111, 114, 100}
290+
// conn.maxReads = 1
291+
292+
// authData, pluginName, err := mc.readHandshakePacket()
293+
// if err != nil {
294+
// t.Fatalf("got error: %v", err)
295+
// }
296+
297+
// if pluginName != "mysql_native_password" {
298+
// t.Errorf("expected plugin name 'mysql_native_password', got '%s'", pluginName)
299+
// }
300+
301+
// expectedAuthData := []byte{60, 70, 63, 58, 68, 104, 34, 97, 98, 120, 114,
302+
// 47, 85, 75, 109, 99, 51, 77, 50, 64}
303+
// if !bytes.Equal(authData, expectedAuthData) {
304+
// t.Errorf("expected authData '%v', got '%v'", expectedAuthData, authData)
305+
// }
306+
// }

0 commit comments

Comments
 (0)