File tree Expand file tree Collapse file tree 6 files changed +29
-24
lines changed Expand file tree Collapse file tree 6 files changed +29
-24
lines changed Original file line number Diff line number Diff line change @@ -4,23 +4,23 @@ on: [push]
44jobs :
55 fmt :
66 runs-on : ubuntu-latest
7- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
7+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
88 steps :
99 - uses : actions/checkout@v1
1010 with :
1111 fetch-depth : 1
1212 - run : ./ci/fmt.sh
1313 lint :
1414 runs-on : ubuntu-latest
15- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
15+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
1616 steps :
1717 - uses : actions/checkout@v1
1818 with :
1919 fetch-depth : 1
2020 - run : ./ci/lint.sh
2121 test :
2222 runs-on : ubuntu-latest
23- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
23+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
2424 steps :
2525 - uses : actions/checkout@v1
2626 with :
3030 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
3131 wasm :
3232 runs-on : ubuntu-latest
33- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
33+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
3434 steps :
3535 - uses : actions/checkout@v1
3636 with :
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ fmt() {
1818 go run go.coder.com/go-tools/cmd/goimports -w " -local=$( go list -m) " .
1919 go run mvdan.cc/sh/cmd/shfmt -i 2 -w -s -sr .
2020 # shellcheck disable=SC2046
21- npx prettier \
21+ npx -q prettier \
2222 --write \
2323 --print-width 120 \
2424 --no-semi \
Original file line number Diff line number Diff line change @@ -4,22 +4,29 @@ set -euo pipefail
44cd " $( dirname " ${0} " ) "
55cd " $( git rev-parse --show-toplevel) "
66
7- stdout=" $( mktemp -d) /stdout"
8- mkfifo " $stdout "
9- go run ./internal/wsecho/cmd > " $stdout " &
7+ wsEchoOut=" $( mktemp) "
8+ go run ./internal/wsecho/cmd >> " $wsEchoOut " &
109
11- WS_ECHO_SERVER_URL=" $( head -n 1 " $stdout " ) "
10+ # Give it max 30 seconds.
11+ for _ in {1..30}; do
12+ WS_ECHO_SERVER_URL=" $( cat " $wsEchoOut " ) "
13+ if [[ -n $WS_ECHO_SERVER_URL ]]; then
14+ break
15+ fi
16+ sleep 1
17+ done
18+
19+ if [[ -z $WS_ECHO_SERVER_URL ]]; then
20+ echo " wsecho/cmd did not start in time"
21+ exit 1
22+ fi
1223
1324GOOS=js GOARCH=wasm go vet ./...
1425go install golang.org/x/lint/golint
1526GOOS=js GOARCH=wasm golint -set_exit_status ./...
1627go install github.com/agnivade/wasmbrowsertest
17- GOOS=js GOARCH=wasm go test -exec=" wasmbrowsertest" ./... -args " $WS_ECHO_SERVER_URL "
28+ GOOS=js GOARCH=wasm go test -exec=wasmbrowsertest ./... -args " $WS_ECHO_SERVER_URL "
1829
19- echo kill
20- jobs
2130kill %1
22- echo wait
2331wait -n || true
24- jobs
25- echo over
32+ rm " $wsEchoOut "
Original file line number Diff line number Diff line change @@ -30,16 +30,16 @@ func Serve(w http.ResponseWriter, r *http.Request) {
3030
3131// Loop echos every msg received from c until an error
3232// occurs or the context expires.
33- // The read limit is set to 1 << 40 .
33+ // The read limit is set to 1 << 30 .
3434func Loop (ctx context.Context , c * websocket.Conn ) {
3535 defer c .Close (websocket .StatusInternalError , "" )
3636
37- c .SetReadLimit (1 << 40 )
37+ c .SetReadLimit (1 << 30 )
3838
3939 ctx , cancel := context .WithTimeout (ctx , time .Minute )
4040 defer cancel ()
4141
42- b := make ([]byte , 32768 )
42+ b := make ([]byte , 32 << 10 )
4343 echo := func () error {
4444 typ , r , err := c .Reader (ctx )
4545 if err != nil {
Original file line number Diff line number Diff line change @@ -2,20 +2,18 @@ package websocket_test
22
33import (
44 "context"
5+ "flag"
56 "net/http"
6- "os"
77 "testing"
88 "time"
99
1010 "nhooyr.io/websocket"
1111)
1212
13- var wsEchoServerURL = os .Args [1 ]
14-
1513func TestWebSocket (t * testing.T ) {
1614 t .Parallel ()
1715
18- t . Skip ( "???" )
16+ wsEchoServerURL := flag . Arg ( 0 )
1917
2018 ctx , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
2119 defer cancel ()
Original file line number Diff line number Diff line change @@ -963,7 +963,7 @@ func TestAutobahn(t *testing.T) {
963963 return err
964964 }
965965 defer c .Close (websocket .StatusInternalError , "" )
966- c .SetReadLimit (1 << 40 )
966+ c .SetReadLimit (1 << 30 )
967967
968968 ctx := r .Context ()
969969 if testingClient {
@@ -997,7 +997,7 @@ func TestAutobahn(t *testing.T) {
997997 t .Fatal (err )
998998 }
999999 defer c .Close (websocket .StatusInternalError , "" )
1000- c .SetReadLimit (1 << 40 )
1000+ c .SetReadLimit (1 << 30 )
10011001
10021002 if testingClient {
10031003 err = fn (ctx , c )
You can’t perform that action at this time.
0 commit comments