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');
function getImplementation(globalField) {

View File

@ -485,7 +485,7 @@ describe('Echo metadata', function() {
call.end();
});
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,
function(err, data) { assert.ifError(err); });
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', () => {
// run mocha tests matching a glob with a pre-required fixture,
// returning the associated gulp stream
const runTestsWithFixture = (glob, fixture) => new Promise((resolve, reject) => {
const server = fixture.split('_')[0];
const client = fixture.split('_')[1];
console.log(`Running ${glob} with ${server} server + ${client} client`);
gulp.src(glob)
const apiTestGlob = `${apiTestDir}/*.js`;
const runTestsWithFixture = (server, client) => new Promise((resolve, reject) => {
const fixture = `${server}_${client}`;
console.log(`Running ${apiTestGlob} with ${server} server + ${client} client`);
gulp.src(apiTestGlob)
.pipe(mocha({
reporter: 'mocha-jenkins-reporter',
require: `${testDir}/fixtures/${fixture}.js`
@ -51,12 +51,11 @@ gulp.task('internal.test.test', 'Run API-level tests', () => {
.on('end', resolve)
.on('error', reject);
});
const apiTestGlob = `${apiTestDir}/*.js`;
const runTestsArgPairs = [
[apiTestGlob, 'native_native'],
// [apiTestGlob, 'native_js'],
// [apiTestGlob, 'js_native'],
// [apiTestGlob, 'js_js']
['native', 'native'],
// ['native', 'js'],
// ['js', 'native'],
// ['js', 'js']
];
return runTestsArgPairs.reduce((previousPromise, argPair) => {
return previousPromise.then(runTestsWithFixture.bind(null, argPair[0], argPair[1]));