Revert "Add coverage reporting for JavaScript and TypeScript files"

This commit is contained in:
Jan Tattermusch 2018-05-15 18:29:06 -07:00 committed by GitHub
parent ec3ba77bdf
commit 1b4d66b382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 104 deletions

View File

@ -102,7 +102,7 @@ gulp.task('test.only', 'Run tests without rebuilding anything',
['js.core.test', 'native.test.only']); ['js.core.test', 'native.test.only']);
gulp.task('test', 'Run all tests', (callback) => { 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']); gulp.task('doc.gen', 'Generate documentation', ['native.core.doc.gen']);

View File

@ -17,7 +17,6 @@
"@types/node": "^8.0.32", "@types/node": "^8.0.32",
"@types/pify": "^3.0.0", "@types/pify": "^3.0.0",
"@types/semver": "^5.5.0", "@types/semver": "^5.5.0",
"coveralls": "^3.0.1",
"del": "^3.0.0", "del": "^3.0.0",
"execa": "^0.8.0", "execa": "^0.8.0",
"gulp": "^3.9.1", "gulp": "^3.9.1",
@ -36,11 +35,8 @@
"mocha": "^3.5.3", "mocha": "^3.5.3",
"mocha-jenkins-reporter": "^0.3.9", "mocha-jenkins-reporter": "^0.3.9",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"nyc": "^11.7.2",
"pify": "^3.0.0", "pify": "^3.0.0",
"run-sequence": "^2.2.0",
"semver": "^5.5.0", "semver": "^5.5.0",
"symlink": "^2.1.0",
"through2": "^2.0.3", "through2": "^2.0.3",
"ts-node": "^3.3.0", "ts-node": "^3.3.0",
"tslint": "^5.5.0", "tslint": "^5.5.0",
@ -52,19 +48,8 @@
"name": "Google Inc." "name": "Google Inc."
} }
], ],
"nyc": { "dependencies": {
"include": [ "run-sequence": "^2.2.0",
"packages/grpc-health-check/health.js", "symlink": "^2.1.0"
"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"
} }
} }

View File

@ -82,15 +82,6 @@ export interface Channel extends EventEmitter {
/* tslint:enable:no-any */ /* 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 { export class Http2Channel extends EventEmitter implements Channel {
private readonly userAgent: string; private readonly userAgent: string;
private readonly target: url.URL; private readonly target: url.URL;
@ -100,7 +91,7 @@ export class Http2Channel extends EventEmitter implements Channel {
private connecting: Promise<void>|null = null; private connecting: Promise<void>|null = null;
/* For now, we have up to one subchannel, which will exist as long as we are /* For now, we have up to one subchannel, which will exist as long as we are
* connecting or trying to connect */ * connecting or trying to connect */
private subChannel: Http2SubChannel|null = null; private subChannel: http2.ClientHttp2Session|null = null;
private filterStackFactory: FilterStackFactory; private filterStackFactory: FilterStackFactory;
private subChannelConnectCallback: () => void = () => {}; private subChannelConnectCallback: () => void = () => {};
@ -169,7 +160,7 @@ export class Http2Channel extends EventEmitter implements Channel {
} }
private startConnecting(): void { private startConnecting(): void {
let subChannel: Http2SubChannel; let subChannel: http2.ClientHttp2Session;
const secureContext = this.credentials.getSecureContext(); const secureContext = this.credentials.getSecureContext();
if (secureContext === null) { if (secureContext === null) {
subChannel = http2.connect(this.target); subChannel = http2.connect(this.target);
@ -269,25 +260,11 @@ export class Http2Channel extends EventEmitter implements Channel {
headers[HTTP2_HEADER_PATH] = methodName; headers[HTTP2_HEADER_PATH] = methodName;
headers[HTTP2_HEADER_TE] = 'trailers'; headers[HTTP2_HEADER_TE] = 'trailers';
if (this.connectivityState === ConnectivityState.READY) { if (this.connectivityState === ConnectivityState.READY) {
const session: Http2SubChannel = this.subChannel!; const session: http2.ClientHttp2Session = this.subChannel!;
let http2Stream = session.request(headers); // Prevent the HTTP/2 session from keeping the process alive.
/* This is a very ad-hoc reference counting scheme. This should be // Note: this function is only available in Node 9
* handled by a subchannel class */ session.unref();
session.ref(); stream.attachHttp2Stream(session.request(headers));
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);
} else { } else {
/* In this case, we lost the connection while finalizing /* In this case, we lost the connection while finalizing
* metadata. That should be very unusual */ * metadata. That should be very unusual */

View File

@ -1,6 +1,6 @@
{ {
"name": "@grpc/proto-loader", "name": "@grpc/proto-loader",
"version": "0.2.0", "version": "0.1.0",
"author": "Google Inc.", "author": "Google Inc.",
"contributors": [ "contributors": [
{ {
@ -47,8 +47,5 @@
"clang-format": "^1.2.2", "clang-format": "^1.2.2",
"gts": "^0.5.3", "gts": "^0.5.3",
"typescript": "~2.7.2" "typescript": "~2.7.2"
},
"engines": {
"node": ">=6"
} }
} }

View File

@ -39,25 +39,9 @@ npm install --unsafe-perm
mkdir -p reports mkdir -p reports
export JOBS=8 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 # TODO(mlumish): Add electron tests
FAILED="false"
for version in ${node_versions} for version in ${node_versions}
do do
# Install and setup node for the version we want. # Install and setup node for the version we want.
@ -67,8 +51,6 @@ do
nvm use $version nvm use $version
set -ex set -ex
export JUNIT_REPORT_PATH="reports/node$version/"
# https://github.com/mapbox/node-pre-gyp/issues/362 # https://github.com/mapbox/node-pre-gyp/issues/362
npm install -g node-gyp npm install -g node-gyp
@ -80,8 +62,8 @@ do
./node_modules/.bin/gulp clean.all ./node_modules/.bin/gulp clean.all
./node_modules/.bin/gulp setup ./node_modules/.bin/gulp setup
# npm test calls nyc gulp test # Rebuild libraries and run tests.
npm test || FAILED="true" JUNIT_REPORT_PATH="reports/node$version/" JUNIT_REPORT_STACK=1 ./node_modules/.bin/gulp test || FAILED="true"
done done
set +ex set +ex
@ -90,12 +72,7 @@ set -ex
node merge_kokoro_logs.js node merge_kokoro_logs.js
if [ "$FAILED" = "true" ] if [ "$FAILED" != "" ]
then then
exit 1 exit 1
else
if [ "$OS" = "Linux" ]
then
npm run coverage
fi
fi fi

View File

@ -68,7 +68,7 @@ describe('Interop tests', function() {
throw new Error(`Server exited with signal ${signal}`); throw new Error(`Server exited with signal ${signal}`);
} }
} }
}); })
}); });
after(function() { after(function() {
serverProcess.send({}); serverProcess.send({});

View File

@ -21,7 +21,6 @@ const mocha = require('gulp-mocha');
const execa = require('execa'); const execa = require('execa');
const path = require('path'); const path = require('path');
const del = require('del'); const del = require('del');
const semver = require('semver');
const linkSync = require('../util').linkSync; const linkSync = require('../util').linkSync;
// gulp-help monkeypatches tasks to have an additional description parameter // 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', () => { gulp.task('test', 'Run API-level tests', () => {
// run mocha tests matching a glob with a pre-required fixture, // run mocha tests matching a glob with a pre-required fixture,
// returning the associated gulp stream // 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 apiTestGlob = `${apiTestDir}/*.js`;
const runTestsWithFixture = (server, client) => new Promise((resolve, reject) => { const runTestsWithFixture = (server, client) => new Promise((resolve, reject) => {
const fixture = `${server}_${client}`; const fixture = `${server}_${client}`;
@ -56,19 +51,12 @@ gulp.task('test', 'Run API-level tests', () => {
.on('end', resolve) .on('end', resolve)
.on('error', reject); .on('error', reject);
}); });
var runTestsArgPairs; const runTestsArgPairs = [
if (semver.satisfies(process.version, '>=9.4')) { ['native', 'native'],
runTestsArgPairs = [ ['native', 'js'],
['native', 'native'], // ['js', 'native'],
['native', 'js'], // ['js', 'js']
// ['js', 'native'], ];
// ['js', 'js']
];
} else {
runTestsArgPairs = [
['native', 'native']
];
}
return runTestsArgPairs.reduce((previousPromise, argPair) => { return runTestsArgPairs.reduce((previousPromise, argPair) => {
return previousPromise.then(runTestsWithFixture.bind(null, argPair[0], argPair[1])); return previousPromise.then(runTestsWithFixture.bind(null, argPair[0], argPair[1]));
}, Promise.resolve()); }, Promise.resolve());

View File

@ -616,12 +616,8 @@ if (require.main === module) {
}; };
runTest(argv.server_host + ':' + argv.server_port, argv.server_host_override, runTest(argv.server_host + ':' + argv.server_port, argv.server_host_override,
argv.test_case, argv.use_tls === 'true', argv.use_test_ca === 'true', argv.test_case, argv.use_tls === 'true', argv.use_test_ca === 'true',
function (err) { function () {
if (err) { console.log('OK:', argv.test_case);
throw err;
} else {
console.log('OK:', argv.test_case);
}
}, extra_args); }, extra_args);
} }