forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an automated cherry-pick of pingcap#46040
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
- Loading branch information
1 parent
75a26f7
commit 4cc7f25
Showing
5 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2022 PingCAP, Inc. Licensed under Apache-2.0. | ||
|
||
package storage_test | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/pingcap/tidb/br/pkg/storage" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDefaultHttpTransport(t *testing.T) { | ||
transport, ok := storage.CloneDefaultHttpTransport() | ||
require.True(t, ok) | ||
require.True(t, transport.MaxConnsPerHost == 0) | ||
require.True(t, transport.MaxIdleConns > 0) | ||
} | ||
|
||
func TestDefaultHttpClient(t *testing.T) { | ||
var concurrency uint = 128 | ||
transport, ok := storage.GetDefaultHttpClient(concurrency).Transport.(*http.Transport) | ||
require.True(t, ok) | ||
require.Equal(t, int(concurrency), transport.MaxIdleConnsPerHost) | ||
require.Equal(t, int(concurrency), transport.MaxIdleConns) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters