File tree Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Expand file tree Collapse file tree 1 file changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,9 @@ import (
12
12
"io"
13
13
"net/http"
14
14
"reflect"
15
- "runtime"
16
15
"strconv"
17
- "sync"
18
16
"testing"
17
+ "testing/synctest"
19
18
"time"
20
19
)
21
20
@@ -497,7 +496,6 @@ func TestServer_Push_RejectAfterGoAway(t *testing.T) {
497
496
synctestTest (t , testServer_Push_RejectAfterGoAway )
498
497
}
499
498
func testServer_Push_RejectAfterGoAway (t testing.TB ) {
500
- var readyOnce sync.Once
501
499
ready := make (chan struct {})
502
500
errc := make (chan error , 2 )
503
501
st := newServerTester (t , func (w http.ResponseWriter , r * http.Request ) {
@@ -513,24 +511,8 @@ func testServer_Push_RejectAfterGoAway(t testing.TB) {
513
511
514
512
// Send GOAWAY and wait for it to be processed.
515
513
st .fr .WriteGoAway (1 , ErrCodeNo , nil )
516
- go func () {
517
- for {
518
- select {
519
- case <- ready :
520
- return
521
- default :
522
- if runtime .GOARCH == "wasm" {
523
- // Work around https://go.dev/issue/65178 to avoid goroutine starvation.
524
- runtime .Gosched ()
525
- }
526
- }
527
- st .sc .serveMsgCh <- func (loopNum int ) {
528
- if ! st .sc .pushEnabled {
529
- readyOnce .Do (func () { close (ready ) })
530
- }
531
- }
532
- }
533
- }()
514
+ synctest .Wait ()
515
+ close (ready )
534
516
if err := <- errc ; err != nil {
535
517
t .Error (err )
536
518
}
You can’t perform that action at this time.
0 commit comments