diff --git a/gulpfile.ts b/gulpfile.ts index dac1421e..388a74f4 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -102,7 +102,7 @@ gulp.task('test.only', 'Run tests without rebuilding anything', ['js.core.test', 'native.test.only']); gulp.task('test', 'Run all tests', (callback) => { - runSequence('build', 'test.only', 'internal.test.test', callback); + runSequence('build', 'test.only', callback); }); gulp.task('doc.gen', 'Generate documentation', ['native.core.doc.gen']); diff --git a/package.json b/package.json index e8d7a112..fb626214 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "@types/node": "^8.0.32", "@types/pify": "^3.0.0", "@types/semver": "^5.5.0", - "coveralls": "^3.0.1", "del": "^3.0.0", "execa": "^0.8.0", "gulp": "^3.9.1", @@ -36,11 +35,8 @@ "mocha": "^3.5.3", "mocha-jenkins-reporter": "^0.3.9", "ncp": "^2.0.0", - "nyc": "^11.7.2", "pify": "^3.0.0", - "run-sequence": "^2.2.0", "semver": "^5.5.0", - "symlink": "^2.1.0", "through2": "^2.0.3", "ts-node": "^3.3.0", "tslint": "^5.5.0", @@ -52,19 +48,8 @@ "name": "Google Inc." } ], - "nyc": { - "include": [ - "packages/grpc-health-check/health.js", - "packages/grpc-js-core/build/src/*", - "packages/grpc-native-core/index.js", - "packages/grpc-native-core/src/*.js", - "packages/grpc-protobufjs/build/src/*" - ], - "cache": true, - "all": true - }, - "scripts": { - "test": "nyc gulp test", - "coverage": "nyc report --reporter=text-lcov | coveralls" + "dependencies": { + "run-sequence": "^2.2.0", + "symlink": "^2.1.0" } } diff --git a/packages/grpc-js-core/src/channel.ts b/packages/grpc-js-core/src/channel.ts index 40b5a93d..c03389d8 100644 --- a/packages/grpc-js-core/src/channel.ts +++ b/packages/grpc-js-core/src/channel.ts @@ -82,15 +82,6 @@ export interface Channel extends EventEmitter { /* tslint:enable:no-any */ } -/* This should be a real subchannel class that contains a ClientHttp2Session, - * but for now this serves its purpose */ -type Http2SubChannel = http2.ClientHttp2Session & { - /* Count the number of currently active streams associated with the session. - * The purpose of this is to keep the session reffed if and only if there - * is at least one active stream */ - streamCount?: number; -}; - export class Http2Channel extends EventEmitter implements Channel { private readonly userAgent: string; private readonly target: url.URL; @@ -100,7 +91,7 @@ export class Http2Channel extends EventEmitter implements Channel { private connecting: Promise|null = null; /* For now, we have up to one subchannel, which will exist as long as we are * connecting or trying to connect */ - private subChannel: Http2SubChannel|null = null; + private subChannel: http2.ClientHttp2Session|null = null; private filterStackFactory: FilterStackFactory; private subChannelConnectCallback: () => void = () => {}; @@ -169,7 +160,7 @@ export class Http2Channel extends EventEmitter implements Channel { } private startConnecting(): void { - let subChannel: Http2SubChannel; + let subChannel: http2.ClientHttp2Session; const secureContext = this.credentials.getSecureContext(); if (secureContext === null) { subChannel = http2.connect(this.target); @@ -269,25 +260,11 @@ export class Http2Channel extends EventEmitter implements Channel { headers[HTTP2_HEADER_PATH] = methodName; headers[HTTP2_HEADER_TE] = 'trailers'; if (this.connectivityState === ConnectivityState.READY) { - const session: Http2SubChannel = this.subChannel!; - let http2Stream = session.request(headers); - /* This is a very ad-hoc reference counting scheme. This should be - * handled by a subchannel class */ - session.ref(); - if (!session.streamCount) { - session.streamCount = 0; - } - session.streamCount += 1; - http2Stream.on('close', () => { - if (!session.streamCount) { - session.streamCount = 0; - } - session.streamCount -= 1; - if (session.streamCount <= 0) { - session.unref(); - } - }); - stream.attachHttp2Stream(http2Stream); + const session: http2.ClientHttp2Session = this.subChannel!; + // Prevent the HTTP/2 session from keeping the process alive. + // Note: this function is only available in Node 9 + session.unref(); + stream.attachHttp2Stream(session.request(headers)); } else { /* In this case, we lost the connection while finalizing * metadata. That should be very unusual */ diff --git a/packages/grpc-protobufjs/package.json b/packages/grpc-protobufjs/package.json index 8890edb8..1ed26975 100644 --- a/packages/grpc-protobufjs/package.json +++ b/packages/grpc-protobufjs/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/proto-loader", - "version": "0.2.0", + "version": "0.1.0", "author": "Google Inc.", "contributors": [ { @@ -47,8 +47,5 @@ "clang-format": "^1.2.2", "gts": "^0.5.3", "typescript": "~2.7.2" - }, - "engines": { - "node": ">=6" } } diff --git a/run-tests.sh b/run-tests.sh index 4484d40b..300a2527 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -39,25 +39,9 @@ npm install --unsafe-perm mkdir -p reports export JOBS=8 -export JUNIT_REPORT_STACK=1 - -OS=$(uname) - -if [ "$OS" = "Linux" ] -then - gsutil cp gs://grpc-testing-secrets/coveralls_credentials/grpc-node.rc /tmp - set +x - . /tmp/grpc-node.rc - set -x - export COVERALLS_REPO_TOKEN - export COVERALLS_SERVICE_NAME=Kokoro - export COVERALLS_SERVICE_JOB_ID=$KOKORO_BUILD_ID -fi # TODO(mlumish): Add electron tests -FAILED="false" - for version in ${node_versions} do # Install and setup node for the version we want. @@ -67,8 +51,6 @@ do nvm use $version set -ex - export JUNIT_REPORT_PATH="reports/node$version/" - # https://github.com/mapbox/node-pre-gyp/issues/362 npm install -g node-gyp @@ -80,8 +62,8 @@ do ./node_modules/.bin/gulp clean.all ./node_modules/.bin/gulp setup - # npm test calls nyc gulp test - npm test || FAILED="true" + # Rebuild libraries and run tests. + JUNIT_REPORT_PATH="reports/node$version/" JUNIT_REPORT_STACK=1 ./node_modules/.bin/gulp test || FAILED="true" done set +ex @@ -90,12 +72,7 @@ set -ex node merge_kokoro_logs.js -if [ "$FAILED" = "true" ] +if [ "$FAILED" != "" ] then exit 1 -else - if [ "$OS" = "Linux" ] - then - npm run coverage - fi fi diff --git a/test/api/interop_sanity_test.js b/test/api/interop_sanity_test.js index 0ff4c28b..1152b310 100644 --- a/test/api/interop_sanity_test.js +++ b/test/api/interop_sanity_test.js @@ -68,7 +68,7 @@ describe('Interop tests', function() { throw new Error(`Server exited with signal ${signal}`); } } - }); + }) }); after(function() { serverProcess.send({}); diff --git a/test/gulpfile.js b/test/gulpfile.js index 2aa1c9c2..61ff1658 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -21,7 +21,6 @@ const mocha = require('gulp-mocha'); const execa = require('execa'); const path = require('path'); const del = require('del'); -const semver = require('semver'); const linkSync = require('../util').linkSync; // gulp-help monkeypatches tasks to have an additional description parameter @@ -39,10 +38,6 @@ gulp.task('clean.all', 'Delete all files created by tasks', () => {}); gulp.task('test', 'Run API-level tests', () => { // run mocha tests matching a glob with a pre-required fixture, // returning the associated gulp stream - if (!semver.satisfies(process.version, '>=9.4')) { - console.log(`Skipping cross-implementation tests for Node ${process.version}`); - return; - } const apiTestGlob = `${apiTestDir}/*.js`; const runTestsWithFixture = (server, client) => new Promise((resolve, reject) => { const fixture = `${server}_${client}`; @@ -56,19 +51,12 @@ gulp.task('test', 'Run API-level tests', () => { .on('end', resolve) .on('error', reject); }); - var runTestsArgPairs; - if (semver.satisfies(process.version, '>=9.4')) { - runTestsArgPairs = [ - ['native', 'native'], - ['native', 'js'], - // ['js', 'native'], - // ['js', 'js'] - ]; - } else { - runTestsArgPairs = [ - ['native', 'native'] - ]; - } + const runTestsArgPairs = [ + ['native', 'native'], + ['native', 'js'], + // ['js', 'native'], + // ['js', 'js'] + ]; return runTestsArgPairs.reduce((previousPromise, argPair) => { return previousPromise.then(runTestsWithFixture.bind(null, argPair[0], argPair[1])); }, Promise.resolve()); diff --git a/test/interop/interop_client.js b/test/interop/interop_client.js index 195ef8d4..fb6026e0 100644 --- a/test/interop/interop_client.js +++ b/test/interop/interop_client.js @@ -616,12 +616,8 @@ if (require.main === module) { }; runTest(argv.server_host + ':' + argv.server_port, argv.server_host_override, argv.test_case, argv.use_tls === 'true', argv.use_test_ca === 'true', - function (err) { - if (err) { - throw err; - } else { - console.log('OK:', argv.test_case); - } + function () { + console.log('OK:', argv.test_case); }, extra_args); }