mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 04:00:25 +03:00
move to go1.24 (#21114)
This commit is contained in:
+22
-22
@@ -74,14 +74,14 @@ func TestSingleRoundtrip(t *testing.T) {
|
||||
|
||||
// local to remote
|
||||
remoteConn := local.Connection(remoteHost)
|
||||
remoteConn.WaitForConnect(context.Background())
|
||||
remoteConn.WaitForConnect(t.Context())
|
||||
defer testlogger.T.SetErrorTB(t)()
|
||||
|
||||
t.Run("localToRemote", func(t *testing.T) {
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
start := time.Now()
|
||||
resp, err := remoteConn.Request(context.Background(), handlerTest, []byte(testPayload))
|
||||
resp, err := remoteConn.Request(t.Context(), handlerTest, []byte(testPayload))
|
||||
errFatal(err)
|
||||
if string(resp) != testPayload {
|
||||
t.Errorf("want %q, got %q", testPayload, string(resp))
|
||||
@@ -92,7 +92,7 @@ func TestSingleRoundtrip(t *testing.T) {
|
||||
t.Run("localToRemoteErr", func(t *testing.T) {
|
||||
const testPayload = "Hello Grid World!"
|
||||
start := time.Now()
|
||||
resp, err := remoteConn.Request(context.Background(), handlerTest2, []byte(testPayload))
|
||||
resp, err := remoteConn.Request(t.Context(), handlerTest2, []byte(testPayload))
|
||||
t.Log("Roundtrip:", time.Since(start))
|
||||
if len(resp) != 0 {
|
||||
t.Errorf("want nil, got %q", string(resp))
|
||||
@@ -107,7 +107,7 @@ func TestSingleRoundtrip(t *testing.T) {
|
||||
testPayload := bytes.Repeat([]byte("?"), 1<<20)
|
||||
|
||||
start := time.Now()
|
||||
resp, err := remoteConn.Request(context.Background(), handlerTest, testPayload)
|
||||
resp, err := remoteConn.Request(t.Context(), handlerTest, testPayload)
|
||||
errFatal(err)
|
||||
if string(resp) != string(testPayload) {
|
||||
t.Errorf("want %q, got %q", testPayload, string(resp))
|
||||
@@ -119,7 +119,7 @@ func TestSingleRoundtrip(t *testing.T) {
|
||||
testPayload := bytes.Repeat([]byte("!"), 1<<10)
|
||||
|
||||
start := time.Now()
|
||||
resp, err := remoteConn.Request(context.Background(), handlerTest2, testPayload)
|
||||
resp, err := remoteConn.Request(t.Context(), handlerTest2, testPayload)
|
||||
if len(resp) != 0 {
|
||||
t.Errorf("want nil, got %q", string(resp))
|
||||
}
|
||||
@@ -159,19 +159,19 @@ func TestSingleRoundtripNotReady(t *testing.T) {
|
||||
|
||||
// local to remote
|
||||
remoteConn := local.Connection(remoteHost)
|
||||
remoteConn.WaitForConnect(context.Background())
|
||||
remoteConn.WaitForConnect(t.Context())
|
||||
defer testlogger.T.SetErrorTB(t)()
|
||||
|
||||
t.Run("localToRemote", func(t *testing.T) {
|
||||
const testPayload = "Hello Grid World!"
|
||||
// Single requests should have remote errors.
|
||||
_, err := remoteConn.Request(context.Background(), handlerTest, []byte(testPayload))
|
||||
_, err := remoteConn.Request(t.Context(), handlerTest, []byte(testPayload))
|
||||
if _, ok := err.(*RemoteErr); !ok {
|
||||
t.Fatalf("Unexpected error: %v, %T", err, err)
|
||||
}
|
||||
// Streams should not be able to set up until registered.
|
||||
// Thus, the error is a local error.
|
||||
_, err = remoteConn.NewStream(context.Background(), handlerTest, []byte(testPayload))
|
||||
_, err = remoteConn.NewStream(t.Context(), handlerTest, []byte(testPayload))
|
||||
if !errors.Is(err, ErrUnknownHandler) {
|
||||
t.Fatalf("Unexpected error: %v, %T", err, err)
|
||||
}
|
||||
@@ -226,7 +226,7 @@ func TestSingleRoundtripGenerics(t *testing.T) {
|
||||
|
||||
start := time.Now()
|
||||
req := testRequest{Num: 1, String: testPayload}
|
||||
resp, err := h1.Call(context.Background(), remoteConn, &req)
|
||||
resp, err := h1.Call(t.Context(), remoteConn, &req)
|
||||
errFatal(err)
|
||||
if resp.OrgString != testPayload {
|
||||
t.Errorf("want %q, got %q", testPayload, resp.OrgString)
|
||||
@@ -235,7 +235,7 @@ func TestSingleRoundtripGenerics(t *testing.T) {
|
||||
h1.PutResponse(resp)
|
||||
|
||||
start = time.Now()
|
||||
resp, err = h2.Call(context.Background(), remoteConn, &testRequest{Num: 1, String: testPayload})
|
||||
resp, err = h2.Call(t.Context(), remoteConn, &testRequest{Num: 1, String: testPayload})
|
||||
t.Log("Roundtrip:", time.Since(start))
|
||||
if err != RemoteErr(testPayload) {
|
||||
t.Errorf("want error %v(%T), got %v(%T)", RemoteErr(testPayload), RemoteErr(testPayload), err, err)
|
||||
@@ -290,7 +290,7 @@ func TestSingleRoundtripGenericsRecycle(t *testing.T) {
|
||||
|
||||
start := time.Now()
|
||||
req := NewMSSWith(map[string]string{"test": testPayload})
|
||||
resp, err := h1.Call(context.Background(), remoteConn, req)
|
||||
resp, err := h1.Call(t.Context(), remoteConn, req)
|
||||
errFatal(err)
|
||||
if resp.Get("test") != testPayload {
|
||||
t.Errorf("want %q, got %q", testPayload, resp.Get("test"))
|
||||
@@ -299,7 +299,7 @@ func TestSingleRoundtripGenericsRecycle(t *testing.T) {
|
||||
h1.PutResponse(resp)
|
||||
|
||||
start = time.Now()
|
||||
resp, err = h2.Call(context.Background(), remoteConn, NewMSSWith(map[string]string{"err": testPayload}))
|
||||
resp, err = h2.Call(t.Context(), remoteConn, NewMSSWith(map[string]string{"err": testPayload}))
|
||||
t.Log("Roundtrip:", time.Since(start))
|
||||
if err != RemoteErr(testPayload) {
|
||||
t.Errorf("want error %v(%T), got %v(%T)", RemoteErr(testPayload), RemoteErr(testPayload), err, err)
|
||||
@@ -479,7 +479,7 @@ func testStreamRoundtrip(t *testing.T, local, remote *Manager) {
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
start := time.Now()
|
||||
stream, err := remoteConn.NewStream(context.Background(), handlerTest, []byte(testPayload))
|
||||
stream, err := remoteConn.NewStream(t.Context(), handlerTest, []byte(testPayload))
|
||||
errFatal(err)
|
||||
var n int
|
||||
stream.Requests <- []byte(strconv.Itoa(n))
|
||||
@@ -544,7 +544,7 @@ func testStreamCancel(t *testing.T, local, remote *Manager) {
|
||||
remoteConn := local.Connection(remoteHost)
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(t.Context())
|
||||
st, err := remoteConn.NewStream(ctx, handler, []byte(testPayload))
|
||||
errFatal(err)
|
||||
clientCanceled := make(chan time.Time, 1)
|
||||
@@ -659,7 +659,7 @@ func testStreamDeadline(t *testing.T, local, remote *Manager) {
|
||||
remoteConn := local.Connection(remoteHost)
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), wantDL)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), wantDL)
|
||||
defer cancel()
|
||||
st, err := remoteConn.NewStream(ctx, handler, []byte(testPayload))
|
||||
errFatal(err)
|
||||
@@ -735,7 +735,7 @@ func testServerOutCongestion(t *testing.T, local, remote *Manager) {
|
||||
remoteConn := local.Connection(remoteHost)
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), time.Minute)
|
||||
defer cancel()
|
||||
st, err := remoteConn.NewStream(ctx, handlerTest, []byte(testPayload))
|
||||
errFatal(err)
|
||||
@@ -813,7 +813,7 @@ func testServerInCongestion(t *testing.T, local, remote *Manager) {
|
||||
remoteConn := local.Connection(remoteHost)
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), time.Minute)
|
||||
defer cancel()
|
||||
st, err := remoteConn.NewStream(ctx, handlerTest, []byte(testPayload))
|
||||
errFatal(err)
|
||||
@@ -893,7 +893,7 @@ func testGenericsStreamRoundtrip(t *testing.T, local, remote *Manager) {
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
start := time.Now()
|
||||
stream, err := handler.Call(context.Background(), remoteConn, &testRequest{Num: 1, String: testPayload})
|
||||
stream, err := handler.Call(t.Context(), remoteConn, &testRequest{Num: 1, String: testPayload})
|
||||
errFatal(err)
|
||||
go func() {
|
||||
defer close(stream.Requests)
|
||||
@@ -970,7 +970,7 @@ func testGenericsStreamRoundtripSubroute(t *testing.T, local, remote *Manager) {
|
||||
remoteSub := remoteConn.Subroute(strings.Join([]string{"subroute", "1"}, "/"))
|
||||
|
||||
start := time.Now()
|
||||
stream, err := handler.Call(context.Background(), remoteSub, &testRequest{Num: 1, String: testPayload})
|
||||
stream, err := handler.Call(t.Context(), remoteSub, &testRequest{Num: 1, String: testPayload})
|
||||
errFatal(err)
|
||||
go func() {
|
||||
defer close(stream.Requests)
|
||||
@@ -1043,7 +1043,7 @@ func testServerStreamResponseBlocked(t *testing.T, local, remote *Manager) {
|
||||
remoteConn := local.Connection(remoteHost)
|
||||
const testPayload = "Hello Grid World!"
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), 5*time.Second)
|
||||
|
||||
st, err := remoteConn.NewStream(ctx, handlerTest, []byte(testPayload))
|
||||
errFatal(err)
|
||||
@@ -1125,7 +1125,7 @@ func testServerStreamNoPing(t *testing.T, local, remote *Manager, inCap int) {
|
||||
remoteConn.debugMsg(debugSetClientPingDuration, 100*time.Millisecond)
|
||||
defer remoteConn.debugMsg(debugSetClientPingDuration, clientPingInterval)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), time.Minute)
|
||||
defer cancel()
|
||||
st, err := remoteConn.NewStream(ctx, handlerTest, []byte(testPayload))
|
||||
errFatal(err)
|
||||
@@ -1198,7 +1198,7 @@ func testServerStreamPingRunning(t *testing.T, local, remote *Manager, inCap int
|
||||
remoteConn.debugMsg(debugSetClientPingDuration, 100*time.Millisecond)
|
||||
defer remoteConn.debugMsg(debugSetClientPingDuration, clientPingInterval)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), time.Minute)
|
||||
defer cancel()
|
||||
st, err := remoteConn.NewStream(ctx, handlerTest, []byte(testPayload))
|
||||
errFatal(err)
|
||||
|
||||
Reference in New Issue
Block a user