mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
test(apiserver): deflake TestClientReceivedGOAWAY
protect `localAddr` from concurrent read and write Signed-off-by: knight42 <anonymousknight96@gmail.com>
This commit is contained in:
parent
6125e6b65a
commit
1f235c858c
@ -342,6 +342,7 @@ func TestClientReceivedGOAWAY(t *testing.T) {
|
||||
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
var mu sync.Mutex
|
||||
// localAddr indicates how many TCP connection set up
|
||||
localAddr := make([]string, 0)
|
||||
|
||||
@ -350,7 +351,10 @@ func TestClientReceivedGOAWAY(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("unexpect connection err: %v", err)
|
||||
}
|
||||
|
||||
mu.Lock()
|
||||
localAddr = append(localAddr, conn.LocalAddr().String())
|
||||
mu.Unlock()
|
||||
return
|
||||
})
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user