Skip to content

Commit

Permalink
Skipping cancellation tests for Edge (grpc#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusLongmuir authored Aug 23, 2018
1 parent 77c8f41 commit 61e071d
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 125 deletions.
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ env:
- GLOBAL_TESTSERVER=true
- SEPARATE_TEST_SUITES=true
matrix:
# Browsers that do not support trusting self-signed certs for wss:// connections are disabled (see https://github.com/improbable-eng/grpc-web/issues/165)
- GOTEST=1
- BROWSER=nodejs
- BROWSER=edge14_win
- BROWSER=edge13_win
- BROWSER=ie11_win DISABLE_WEBSOCKET_TESTS=true
- BROWSER=firefox53_osx
- BROWSER=firefox39_osx
- BROWSER=firefox38_osx
Expand All @@ -28,6 +25,12 @@ env:
- BROWSER=chrome_43
- BROWSER=chrome_42
- BROWSER=chrome_41
# Edge does not support aborting fetch requests (documented known limitation in project README)
- BROWSER=edge15_win DISABLE_ABORT_TESTS=true
- BROWSER=edge14_win DISABLE_ABORT_TESTS=true
- BROWSER=edge13_win DISABLE_ABORT_TESTS=true
# Browsers that do not support trusting self-signed certs for wss:// connections are disabled (see https://github.com/improbable-eng/grpc-web/issues/165)
- BROWSER=ie11_win DISABLE_WEBSOCKET_TESTS=true
- BROWSER=safari11 DISABLE_WEBSOCKET_TESTS=true
- BROWSER=safari9_1 DISABLE_WEBSOCKET_TESTS=true
- BROWSER=safari8 DISABLE_WEBSOCKET_TESTS=true
Expand All @@ -37,16 +40,14 @@ cache:
- node_modules
before_install:
- sudo apt-get install unzip
- bash install-protobuf.sh
- . ./install-protobuf.sh
- true && `base64 --decode <<< ZXhwb3J0IEJST1dTRVJfU1RBQ0tfVVNFUk5BTUU9aW1wcm9iYWJsZWVuZ2JvdDEK`
- true && `base64 --decode <<< ZXhwb3J0IEJST1dTRVJfU1RBQ0tfQUNDRVNTX0tFWT1SRG1Cc2pwQUJ4RlljcEVkeVp5bwo=`
install:
- go get -u github.com/golang/dep/cmd/dep
- go get -u golang.org/x/tools/cmd/goimports
- go get -u github.com/robertkrimen/godocdown/godocdown
- go get -u github.com/golang/protobuf/protoc-gen-go
- dep ensure
- export PATH=/home/travis/gopath/src/github.com/improbable-eng/grpc-web/protobuf/bin:$PATH
- nvm install
- npm install
before_script:
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,17 @@ The code here is `alpha` quality. It is being used for a subset of Improbable's

## Known Limitations

### Edge - Unable to abort RPCs

When using Fetch - the default transport for Edge 13+ - RPCs will fail to be aborted. The signal to abort will not be received by the server, potentially resulting in zombie streams in the case of infinite server-streams.

The connection will be closed as normal if the user navigates away from the browser context making the RPC.

See this issue: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13009916/

### Server-side streaming with XHR

Browsers that don't support [Fetch with `body.getReader`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) (Currently only supported by Edge 14+, Chrome 43+ - full ReadableStream was added in Chrome 52, but only `body.getReader()` is used) or `XMLHttpRequest.responseType = moz-chunked-arraybuffer` (Firefox 38+) use [XmlHttpRequest (XHR)](https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest).
Browsers that don't support [Fetch with `body.getReader`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) (Currently only supported by Edge 13+, Chrome 43+ - full ReadableStream was added in Chrome 52, but only `body.getReader()` is used) or `XMLHttpRequest.responseType = moz-chunked-arraybuffer` (Firefox 38+) use [XmlHttpRequest (XHR)](https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest).

XHR keeps the entire server response in memory. This means that a long-lived or otherwise large streaming response will consume a large amount of memory in the browser and may cause instability. Fetch does not suffer from this issue. It is therefore advised that you don't use open-ended or large payload server streaming if you intend to support browsers that do not support Fetch.

Expand Down
4 changes: 3 additions & 1 deletion install-protobuf.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
#!/bin/bash
# This is intended to be run by Travis CI

set -ex
wget https://github.com/google/protobuf/releases/download/v$PROTOBUF_VER/protoc-$PROTOBUF_VER-linux-x86_64.zip
unzip protoc-$PROTOBUF_VER-linux-x86_64.zip -d protobuf

export PATH=`pwd`/protobuf/bin:$PATH
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"name": "grpc-web-ci",
"scripts": {
"install": "(cd ts && npm install) && (cd test && npm install)",
"test:integration": "cd test && npm test",
"test:golang": "cd go && go test ./...",
"test": "npm run test:golang && npm run test:integration"
"test": "cd test && npm run test"
},
"author": "Improbable",
"license": "Apache-2.0",
Expand Down
17 changes: 15 additions & 2 deletions test/browsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@ import {SuiteEnum} from "./ts/suiteUtils";

function browser(browserName, browserVersion, os, osVersion) {
const browsers = [];
if (process.env.SEPARATE_TEST_SUITES) {
if (process.env.TEST_SUITE_NAME) {
browsers.push({
configName: `${os}_${osVersion}_${browserName}_${browserVersion}_${process.env.TEST_SUITE_NAME}`,
base: 'CustomWebDriver',
capabilities: {
testSuite: process.env.TEST_SUITE_NAME,
browserName: browserName,
browserVersion: browserVersion,
os: os,
os_version: osVersion
}
});
} else if (process.env.SEPARATE_TEST_SUITES) {
for (let suiteName in SuiteEnum) {
if (isNaN(Number(suiteName))) {
browsers.push({
Expand All @@ -17,7 +29,7 @@ function browser(browserName, browserVersion, os, osVersion) {
}
});
}
};
}
} else {
browsers.push({
configName: `${os}_${osVersion}_${browserName}_${browserVersion}_allsuites`,
Expand All @@ -37,6 +49,7 @@ function browser(browserName, browserVersion, os, osVersion) {
// Browser versions that should not have any Fetch/XHR differences in functionality to other (tested) versions are
// commented out.
const browsers = {
edge15_win: browser("edge", "15", "Windows", "10"),
edge14_win: browser("edge", "14", "Windows", "10"),
edge13_win: browser('edge', "13", 'Windows', "10"),
ie11_win: browser('ie', "11", 'Windows', "7"),
Expand Down
3 changes: 1 addition & 2 deletions test/go/_proto/improbable/grpcweb/test/test.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion test/protogen_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ PROTOBUF_DIR=${PROTOBUF_DIR-${SCRIPT_DIR}/proto}
PROTOGEN_DIR=go/_proto
GENERATION_DIR=${GENERATION_DIR-${SCRIPT_DIR}/${PROTOGEN_DIR}}

if [[ "$GOBIN" == "" ]]; then
if [[ "$GOPATH" == "" ]]; then
echo "Required env var GOPATH is not set; aborting with error; see the following documentation which can be invoked via the 'go help gopath' command."
go help gopath
exit -1
fi

echo "Optional env var GOBIN is not set; using default derived from GOPATH as: \"$GOPATH/bin\""
export GOBIN="$GOPATH/bin"
fi

# Install protoc-gen-go from the vendored protobuf package to $GOBIN
(cd ../vendor/github.com/golang/protobuf && make install)

# Builds all .proto files in a given package dirctory.
# NOTE: All .proto files in a given package must be processed *together*, otherwise the self-referencing
# between files in the same proto package will not work.
Expand All @@ -15,7 +29,8 @@ function proto_build_dir {
DIR_REL=${DIR_REL#/}
echo -n "protogen_go: $DIR_REL "
mkdir -p ${GENERATION_DIR}/${DIR_REL} 2> /dev/null
PATH=${GOPATH}/bin:$PATH protoc \
protoc \
--plugin=protoc-gen-go=${GOBIN}/protoc-gen-go \
-I${PROTOBUF_DIR} \
--go_out=plugins=grpc:${GENERATION_DIR} \
${DIR_FULL}/*.proto || exit $?
Expand Down
11 changes: 10 additions & 1 deletion test/test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#!/bin/bash
# Runs the tests in the environment
npm run build

set -ex

if [ "$GOTEST" == "1" ]; then
# This is a test of just the go backend
npm run build:proto
cd ../go/
go test ./...
exit 0
fi

npm run build

if [ -z "$BROWSER" ]; then
# No environment is specified - run all tests
npm run test:node
Expand Down
Loading

0 comments on commit 61e071d

Please sign in to comment.