@@ -21,12 +21,11 @@ import (
2121)
2222
2323const (
24- toxiproxyDownProxyPort = 42001
25- toxiproxyLatencyProxyPort = 42002
26- toxiproxyResetProxyPort = 42003
27- toxiproxyCDCHangProxyPort = 42004
28- toxiproxyCDCCloseHangProxyPort = 42005
29- toxiproxyCloseSyncerWithTimeoutPort = 42006
24+ toxiproxyDownProxyPort = 42001
25+ toxiproxyLatencyProxyPort = 42002
26+ toxiproxyResetProxyPort = 42003
27+ toxiproxyCDCHangProxyPort = 42004
28+ toxiproxyCDCCloseHangProxyPort = 42005
3029)
3130
3231func setupMySQLConnectorWithProxy (ctx context.Context , t * testing.T , proxyName string , proxyPort int ,
@@ -271,49 +270,3 @@ func TestMySQLSSHKeepaliveCDCCloseHang(t *testing.T) {
271270 t .Fatal ("PullRecords did not return after SSH keepalive closed the connection" )
272271 }
273272}
274-
275- func TestMySQLCloseSyncerWithTimeout (t * testing.T ) {
276- t .Parallel ()
277- if os .Getenv ("CI_MYSQL_VERSION" ) == "maria" {
278- t .Skip ("Skipping for MariaDB" )
279- }
280-
281- ctx := t .Context ()
282- connector , sshProxy := setupMySQLConnectorWithProxy (
283- ctx , t , "my-close-syncer-timeout-test" , toxiproxyCloseSyncerWithTimeoutPort )
284- defer connector .Close ()
285-
286- pos , err := connector .GetMasterPos (ctx )
287- require .NoError (t , err )
288- syncer , _ , _ , _ , err := connector .startCdcStreamingFilePos (ctx , pos )
289- require .NoError (t , err )
290-
291- // Let CDC streaming establish before blocking the tunnel.
292- time .Sleep (2 * time .Second )
293-
294- // Black-hole the SSH transport so syncer.Close() hangs
295- _ , err = sshProxy .AddToxic ("latency" , "latency" , "" , 1.0 , toxiproxy.Attributes {
296- "latency" : 120000 ,
297- })
298- require .NoError (t , err )
299-
300- // Must be < SSHKeepaliveInterval so the timing bounds below prove the syncCloseTimeout
301- // (not SSH keepalive's own force-close) is what unblocked syncer.Close.
302- syncerCloseTimeout := 2 * time .Second
303- require .Less (t , syncerCloseTimeout , utils .SSHKeepaliveInterval )
304- done := make (chan struct {})
305- start := time .Now ()
306- go func () {
307- connector .closeSyncerWithTimeout (syncer , syncerCloseTimeout )
308- close (done )
309- }()
310-
311- select {
312- case <- done :
313- elapsed := time .Since (start )
314- require .GreaterOrEqual (t , elapsed , syncerCloseTimeout )
315- require .Less (t , elapsed , syncerCloseTimeout + time .Second )
316- case <- time .After (10 * time .Second ):
317- t .Fatal ("closeSyncerWithTimeout did not return on timeout" )
318- }
319- }
0 commit comments