From 2c625feb9fd12c4c01602483f199e50b5eac5a90 Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Thu, 9 Nov 2017 10:50:40 -0800 Subject: [PATCH] use client's user agent; small changes in test gulpfile; add TODO --- test/any_grpc.js | 4 ++++ test/api/surface_test.js | 2 +- test/gulpfile.js | 19 +++++++++---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/test/any_grpc.js b/test/any_grpc.js index 7360ac55..d6d008c2 100644 --- a/test/any_grpc.js +++ b/test/any_grpc.js @@ -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) { diff --git a/test/api/surface_test.js b/test/api/surface_test.js index 83896a4e..5fdcbcfb 100644 --- a/test/api/surface_test.js +++ b/test/api/surface_test.js @@ -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) { diff --git a/test/gulpfile.js b/test/gulpfile.js index d1d06633..1c70056e 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -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]));