File tree 6 files changed +23
-26
lines changed
6 files changed +23
-26
lines changed Original file line number Diff line number Diff line change @@ -4,23 +4,23 @@ on: [push]
4
4
jobs :
5
5
fmt :
6
6
runs-on : ubuntu-latest
7
- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
7
+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
8
8
steps :
9
9
- uses : actions/checkout@v1
10
10
with :
11
11
fetch-depth : 1
12
12
- run : ./ci/fmt.sh
13
13
lint :
14
14
runs-on : ubuntu-latest
15
- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
15
+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
16
16
steps :
17
17
- uses : actions/checkout@v1
18
18
with :
19
19
fetch-depth : 1
20
20
- run : ./ci/lint.sh
21
21
test :
22
22
runs-on : ubuntu-latest
23
- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
23
+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
24
24
steps :
25
25
- uses : actions/checkout@v1
26
26
with :
30
30
CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
31
31
wasm :
32
32
runs-on : ubuntu-latest
33
- container : docker://nhooyr/websocket-ci@sha256:97aa0fddfcf1ba7d90a21b1e7978884b7f4c1ca9668d2ed1891ff61f778aeaf0
33
+ container : docker://nhooyr/websocket-ci@sha256:9f69035d64afdb2062a631d35748d46f440ecf2a1985845fc99b8c97ab14ca58
34
34
steps :
35
35
- uses : actions/checkout@v1
36
36
with :
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ fmt() {
18
18
go run go.coder.com/go-tools/cmd/goimports -w " -local=$( go list -m) " .
19
19
go run mvdan.cc/sh/cmd/shfmt -i 2 -w -s -sr .
20
20
# shellcheck disable=SC2046
21
- npx prettier \
21
+ npx -q prettier \
22
22
--write \
23
23
--print-width 120 \
24
24
--no-semi \
Original file line number Diff line number Diff line change @@ -4,22 +4,21 @@ set -euo pipefail
4
4
cd " $( dirname " ${0} " ) "
5
5
cd " $( git rev-parse --show-toplevel) "
6
6
7
- stdout=" $( mktemp -d) /stdout"
8
- mkfifo " $stdout "
9
- go run ./internal/wsecho/cmd > " $stdout " &
10
-
11
- WS_ECHO_SERVER_URL=" $( head -n 1 " $stdout " ) "
12
-
13
7
GOOS=js GOARCH=wasm go vet ./...
8
+
14
9
go install golang.org/x/lint/golint
15
10
GOOS=js GOARCH=wasm golint -set_exit_status ./...
11
+
12
+ wsEchoOut=" $( mktemp) "
13
+ go run ./internal/wsecho/cmd >> " $wsEchoOut " &
14
+
15
+ WS_ECHO_SERVER_URL=" $( tail -f " $wsEchoOut " | timeout 10s head -n 1) " || true
16
+ if [[ -z $WS_ECHO_SERVER_URL ]]; then
17
+ echo " ./internal/wsecho/cmd failed to start in 10s"
18
+ fi
19
+
16
20
go install github.com/agnivade/wasmbrowsertest
17
- GOOS=js GOARCH=wasm go test -exec=" wasmbrowsertest" ./... -args " $WS_ECHO_SERVER_URL "
21
+ GOOS=js GOARCH=wasm go test -exec=wasmbrowsertest ./... -args " $WS_ECHO_SERVER_URL "
18
22
19
- echo kill
20
- jobs
21
23
kill %1
22
- echo wait
23
24
wait -n || true
24
- jobs
25
- echo over
Original file line number Diff line number Diff line change @@ -30,16 +30,16 @@ func Serve(w http.ResponseWriter, r *http.Request) {
30
30
31
31
// Loop echos every msg received from c until an error
32
32
// occurs or the context expires.
33
- // The read limit is set to 1 << 40 .
33
+ // The read limit is set to 1 << 30 .
34
34
func Loop (ctx context.Context , c * websocket.Conn ) {
35
35
defer c .Close (websocket .StatusInternalError , "" )
36
36
37
- c .SetReadLimit (1 << 40 )
37
+ c .SetReadLimit (1 << 30 )
38
38
39
39
ctx , cancel := context .WithTimeout (ctx , time .Minute )
40
40
defer cancel ()
41
41
42
- b := make ([]byte , 32768 )
42
+ b := make ([]byte , 32 << 10 )
43
43
echo := func () error {
44
44
typ , r , err := c .Reader (ctx )
45
45
if err != nil {
Original file line number Diff line number Diff line change @@ -2,20 +2,18 @@ package websocket_test
2
2
3
3
import (
4
4
"context"
5
+ "flag"
5
6
"net/http"
6
- "os"
7
7
"testing"
8
8
"time"
9
9
10
10
"nhooyr.io/websocket"
11
11
)
12
12
13
- var wsEchoServerURL = os .Args [1 ]
14
-
15
13
func TestWebSocket (t * testing.T ) {
16
14
t .Parallel ()
17
15
18
- t . Skip ( "???" )
16
+ wsEchoServerURL := flag . Arg ( 0 )
19
17
20
18
ctx , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
21
19
defer cancel ()
Original file line number Diff line number Diff line change @@ -963,7 +963,7 @@ func TestAutobahn(t *testing.T) {
963
963
return err
964
964
}
965
965
defer c .Close (websocket .StatusInternalError , "" )
966
- c .SetReadLimit (1 << 40 )
966
+ c .SetReadLimit (1 << 30 )
967
967
968
968
ctx := r .Context ()
969
969
if testingClient {
@@ -997,7 +997,7 @@ func TestAutobahn(t *testing.T) {
997
997
t .Fatal (err )
998
998
}
999
999
defer c .Close (websocket .StatusInternalError , "" )
1000
- c .SetReadLimit (1 << 40 )
1000
+ c .SetReadLimit (1 << 30 )
1001
1001
1002
1002
if testingClient {
1003
1003
err = fn (ctx , c )
You can’t perform that action at this time.
0 commit comments