use client's user agent; small changes in test gulpfile; add TODO

This commit is contained in:
Kelvin Jin 2017-11-09 10:50:40 -08:00
parent 9d9404615e
commit 2c625feb9f
3 changed files with 14 additions and 11 deletions

View File

@ -1,3 +1,7 @@
// TODO: Instead of attempting to expose both implementations of gRPC in
// a single object, the tests should be re-written in a way that makes it clear
// that two separate implementations are being tested against one another.
const _ = require('lodash'); const _ = require('lodash');
function getImplementation(globalField) { function getImplementation(globalField) {

View File

@ -485,7 +485,7 @@ describe('Echo metadata', function() {
call.end(); call.end();
}); });
it('shows the correct user-agent string', function(done) { it('shows the correct user-agent string', function(done) {
var version = require('../any_grpc')['$implementationInfo'].server.corePjson.version; var version = require('../any_grpc')['$implementationInfo'].client.corePjson.version;
var call = client.unary({}, metadata, var call = client.unary({}, metadata,
function(err, data) { assert.ifError(err); }); function(err, data) { assert.ifError(err); });
call.on('metadata', function(metadata) { call.on('metadata', function(metadata) {

View File

@ -38,11 +38,11 @@ gulp.task('internal.test.clean.all', 'Delete all files created by tasks', () =>
gulp.task('internal.test.test', 'Run API-level tests', () => { gulp.task('internal.test.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
const runTestsWithFixture = (glob, fixture) => new Promise((resolve, reject) => { const apiTestGlob = `${apiTestDir}/*.js`;
const server = fixture.split('_')[0]; const runTestsWithFixture = (server, client) => new Promise((resolve, reject) => {
const client = fixture.split('_')[1]; const fixture = `${server}_${client}`;
console.log(`Running ${glob} with ${server} server + ${client} client`); console.log(`Running ${apiTestGlob} with ${server} server + ${client} client`);
gulp.src(glob) gulp.src(apiTestGlob)
.pipe(mocha({ .pipe(mocha({
reporter: 'mocha-jenkins-reporter', reporter: 'mocha-jenkins-reporter',
require: `${testDir}/fixtures/${fixture}.js` require: `${testDir}/fixtures/${fixture}.js`
@ -51,12 +51,11 @@ gulp.task('internal.test.test', 'Run API-level tests', () => {
.on('end', resolve) .on('end', resolve)
.on('error', reject); .on('error', reject);
}); });
const apiTestGlob = `${apiTestDir}/*.js`;
const runTestsArgPairs = [ const runTestsArgPairs = [
[apiTestGlob, 'native_native'], ['native', 'native'],
// [apiTestGlob, 'native_js'], // ['native', 'js'],
// [apiTestGlob, 'js_native'], // ['js', 'native'],
// [apiTestGlob, 'js_js'] // ['js', 'js']
]; ];
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]));