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']);
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']);

View File

@ -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"
}
}

View File

@ -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<void>|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 */

View File

@ -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"
}
}

View File

@ -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

View File

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

View File

@ -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());

View File

@ -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);
}