From 381768fd2baab0a302538cc4f6cb175353623716 Mon Sep 17 00:00:00 2001 From: Rafal Leszko Date: Fri, 3 Dec 2021 12:29:17 +0100 Subject: [PATCH] server: Fix unit tests --- server/segment_rpc.go | 1 - server/segment_rpc_test.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server/segment_rpc.go b/server/segment_rpc.go index 276746fb20..5a95a55917 100644 --- a/server/segment_rpc.go +++ b/server/segment_rpc.go @@ -45,7 +45,6 @@ var errFormat = errors.New("unrecognized profile output format") var errProfile = errors.New("unrecognized encoder profile") var errDuration = errors.New("invalid duration") var errCapCompat = errors.New("incompatible capabilities") -var errTimeout = errors.New("timeout") var dialTimeout = 2 * time.Second diff --git a/server/segment_rpc_test.go b/server/segment_rpc_test.go index 47f8121162..59142bf74f 100644 --- a/server/segment_rpc_test.go +++ b/server/segment_rpc_test.go @@ -2001,7 +2001,7 @@ func TestSubmitSegment_Timeout(t *testing.T) { headerTimeout = 100 * time.Millisecond lock.Unlock() _, err = SubmitSegment(sess, seg, 0, false, true) - assert.Contains(err.Error(), "header timeout: timeout") + assert.Contains(err.Error(), "context canceled") // time out body lock.Lock() @@ -2282,7 +2282,7 @@ func TestSendReqWithTimeout(t *testing.T) { resp, err = sendReqWithTimeout(req, time.Millisecond) wg.Done() assert.Nil(resp) - assert.ErrorIs(err, errTimeout) + assert.ErrorIs(err, context.Canceled) } func stubTLSServer() (*httptest.Server, *http.ServeMux) {