From 0fe5704ad754804bdf30c1da04bc97b7a5156a4f Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 13 Sep 2017 13:54:13 -0700 Subject: [PATCH] Get tests from the C-based library working and add corresponding gulp tasks --- .gitignore | 4 +- gulpfile.js | 17 ++++-- package.json | 7 ++- packages/grpc-health-check/gulpfile.js | 18 ++++-- packages/grpc-health-check/package.json | 2 +- .../test/health_test.js | 6 +- packages/grpc-js-core/package.json | 3 - packages/grpc-native-core/gulpfile.js | 31 ++++++++++ packages/grpc-native-core/index.js | 2 +- packages/grpc-native-core/package.json | 2 +- packages/grpc-native-core/src/client.js | 2 +- .../grpc-native-core/src/grpc_extension.js | 2 +- packages/grpc-native-core/test/async_test.js | 2 +- packages/grpc-native-core/test/server_test.js | 4 +- .../test => test/api}/credentials_test.js | 8 +-- .../test => test/api}/echo_service.proto | 0 .../test => test/api}/interop_sanity_test.js | 0 .../test => test/api}/surface_test.js | 61 +++++-------------- test/api/test_messages.proto | 45 ++++++++++++++ .../test => test/api}/test_service.json | 0 .../test => test/api}/test_service.proto | 0 .../test => test}/data/README | 0 .../test => test}/data/ca.pem | 0 .../test => test}/data/server1.key | 0 .../test => test}/data/server1.pem | 0 test/gulpfile.js | 16 +++-- test/interop/interop_client.js | 4 +- test/interop/interop_server.js | 6 +- 28 files changed, 157 insertions(+), 85 deletions(-) rename packages/{grpc-native-core => grpc-health-check}/test/health_test.js (96%) create mode 100644 packages/grpc-native-core/gulpfile.js rename {packages/grpc-native-core/test => test/api}/credentials_test.js (98%) rename {packages/grpc-native-core/test => test/api}/echo_service.proto (100%) rename {packages/grpc-native-core/test => test/api}/interop_sanity_test.js (100%) rename {packages/grpc-native-core/test => test/api}/surface_test.js (96%) create mode 100644 test/api/test_messages.proto rename {packages/grpc-native-core/test => test/api}/test_service.json (100%) rename {packages/grpc-native-core/test => test/api}/test_service.proto (100%) rename {packages/grpc-native-core/test => test}/data/README (100%) rename {packages/grpc-native-core/test => test}/data/ca.pem (100%) rename {packages/grpc-native-core/test => test}/data/server1.key (100%) rename {packages/grpc-native-core/test => test}/data/server1.pem (100%) diff --git a/.gitignore b/.gitignore index aec475c0..58368339 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ npm-debug.log yarn-error.log yarn.lock -*~ \ No newline at end of file +*~ + +packages/grpc-native-core/src/node/ \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 050b0324..2c0011d9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,16 +6,25 @@ const gulp = help(_gulp); require('./packages/grpc-health-check/gulpfile'); require('./packages/grpc-js-core/gulpfile'); +require('./packages/grpc-native-core/gulpfile'); require('./test/gulpfile'); -gulp.task('lint', 'Emit linting errors in source and test files', ['js.core.lint']); +gulp.task('lint', 'Emit linting errors in source and test files', + ['js.core.lint', 'native.core.lint']); -gulp.task('link', 'Link local packages together', ['internal.test.link']); +gulp.task('link', 'Link local packages together', + ['health-check.link', 'internal.test.link']); -gulp.task('build', 'Build packages', ['js.core.compile', 'link']); +gulp.task('build', 'Build packages', + ['js.core.compile', 'native.core.build', 'link']); gulp.task('clean', 'Delete generated files', ['js.core.clean']); -gulp.task('test', 'Run all tests', ['js.core.test']); +gulp.task('test.only', 'Run tests without rebuilding anything', + ['js.core.test', 'native.core.test', 'internal.test.test', 'health-check.test']); + +gulp.task('test', 'Run all tests', ['build', 'link'], () => { + gulp.start('test.only'); +}); gulp.task('default', ['help']); diff --git a/package.json b/package.json index ee3b4830..82aa3a18 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "grpc": "^1.6.0", "gulp": "^3.9.1", "gulp-help": "^1.6.1", - "gulp-run": "^1.7.1", "lodash": "^4.17.4", "poisson-process": "^0.2.2" }, @@ -27,5 +26,9 @@ { "name": "Google Inc." } - ] + ], + "dependencies": { + "gulp-mocha": "^4.3.1", + "mocha": "^3.5.3" + } } diff --git a/packages/grpc-health-check/gulpfile.js b/packages/grpc-health-check/gulpfile.js index 2cbff4aa..79e0e437 100644 --- a/packages/grpc-health-check/gulpfile.js +++ b/packages/grpc-health-check/gulpfile.js @@ -1,10 +1,20 @@ const _gulp = require('gulp'); const help = require('gulp-help'); -const run = require('gulp-run'); +const mocha = require('gulp-mocha'); +const exec = require('child_process').exec; +const path = require('path'); const gulp = help(_gulp); -gulp.task('health-check.link', 'Link local copy of grpc', () => { - return run(`npm link ${__dirname}/grpc-native-core`).exec() - .pipe(gulp.dest('output')); +const hcCoreDir = __dirname; +const baseDir = path.resolve(hcCoreDir, '..', '..'); +const testDir = path.resolve(hcCoreDir, 'test'); + +gulp.task('health-check.link', 'Link local copy of grpc', (cb) => { + return exec(`cd ${hcCoreDir} && npm link ${baseDir}/packages/grpc-native-core`, cb); }); + +gulp.task('health-check.test', 'Run health check tests', ['health-check.link'], + () => { + return gulp.src(`${testDir}/*.js`).pipe(mocha()); + }); diff --git a/packages/grpc-health-check/package.json b/packages/grpc-health-check/package.json index 2f2ccb21..20c4584e 100644 --- a/packages/grpc-health-check/package.json +++ b/packages/grpc-health-check/package.json @@ -16,7 +16,7 @@ ], "dependencies": { "google-protobuf": "^3.0.0", - "grpc": "^1.7.0-dev", + "grpc": "^1.6.0", "lodash": "^3.9.3" }, "files": [ diff --git a/packages/grpc-native-core/test/health_test.js b/packages/grpc-health-check/test/health_test.js similarity index 96% rename from packages/grpc-native-core/test/health_test.js rename to packages/grpc-health-check/test/health_test.js index dc008644..a31d3b37 100644 --- a/packages/grpc-native-core/test/health_test.js +++ b/packages/grpc-health-check/test/health_test.js @@ -20,13 +20,13 @@ var assert = require('assert'); -var health = require('../health_check/health'); +var health = require('../health'); -var health_messages = require('../health_check/v1/health_pb'); +var health_messages = require('../v1/health_pb'); var ServingStatus = health_messages.HealthCheckResponse.ServingStatus; -var grpc = require('../'); +var grpc = require('grpc'); describe('Health Checking', function() { var statusMap = { diff --git a/packages/grpc-js-core/package.json b/packages/grpc-js-core/package.json index b6089fce..ac271387 100644 --- a/packages/grpc-js-core/package.json +++ b/packages/grpc-js-core/package.json @@ -20,14 +20,11 @@ "clang-format": "^1.0.53", "del": "^3.0.0", "google-ts-style": "^0.2.0", - "gulp-help": "^1.6.1", - "gulp-mocha": "^4.3.1", "gulp-sourcemaps": "^2.6.1", "gulp-tslint": "^8.1.1", "gulp-typescript": "^3.2.2", "gulp-util": "^3.0.8", "merge2": "^1.1.0", - "mocha": "^3.5.0", "through2": "^2.0.3", "tslint": "^5.5.0", "typescript": "^2.5.1" diff --git a/packages/grpc-native-core/gulpfile.js b/packages/grpc-native-core/gulpfile.js new file mode 100644 index 00000000..def55c31 --- /dev/null +++ b/packages/grpc-native-core/gulpfile.js @@ -0,0 +1,31 @@ +const _gulp = require('gulp'); +const help = require('gulp-help'); + +// gulp-help monkeypatches tasks to have an additional description parameter +const gulp = help(_gulp); + +const jshint = require('gulp-jshint'); +const mocha = require('gulp-mocha'); +const exec = require('child_process').exec; +const path = require('path'); + +const nativeCoreDir = __dirname; +const srcDir = path.resolve(nativeCoreDir, 'src'); +const testDir = path.resolve(nativeCoreDir, 'test'); + +const pkg = require('./package'); +const jshintConfig = pkg.jshintConfig; + +gulp.task('native.core.lint', 'Emits linting errors', () => { + return gulp.src([`${nativeCoreDir}/index.js`, `${srcDir}/*.js`, `${testDir}/*.js`]) + .pipe(jshint(pkg.jshintConfig)) + .pipe(jshint.reporter('default')); +}); + +gulp.task('native.core.build', 'Build native package', (cb) => { + return exec(`cd ${nativeCoreDir} && ${nativeCoreDir}/node_modules/.bin/node-pre-gyp build`, cb); +}); + +gulp.task('native.core.test', 'Run all tests', ['native.core.build'], () => { + return gulp.src(`${testDir}/*.js`).pipe(mocha()); +}); diff --git a/packages/grpc-native-core/index.js b/packages/grpc-native-core/index.js index 452b11f6..0d814cc3 100644 --- a/packages/grpc-native-core/index.js +++ b/packages/grpc-native-core/index.js @@ -21,7 +21,7 @@ var path = require('path'); var fs = require('fs'); -var SSL_ROOTS_PATH = path.resolve(__dirname, '..', '..', 'etc', 'roots.pem'); +var SSL_ROOTS_PATH = path.resolve(__dirname, 'deps', 'grpc', 'etc', 'roots.pem'); var _ = require('lodash'); diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index e6e744e7..47c37ba3 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -31,6 +31,7 @@ ], "dependencies": { "arguejs": "^0.2.3", + "gulp-jshint": "^2.0.4", "lodash": "^4.15.0", "nan": "^2.0.0", "node-pre-gyp": "^0.6.35", @@ -47,7 +48,6 @@ "jsdoc": "^3.3.2", "jshint": "^2.5.0", "minimist": "^1.1.0", - "mocha": "^3.0.2", "mocha-jenkins-reporter": "^0.2.3", "poisson-process": "^0.2.1" }, diff --git a/packages/grpc-native-core/src/client.js b/packages/grpc-native-core/src/client.js index edc51b78..0d8120d3 100644 --- a/packages/grpc-native-core/src/client.js +++ b/packages/grpc-native-core/src/client.js @@ -51,7 +51,7 @@ var Readable = stream.Readable; var Writable = stream.Writable; var Duplex = stream.Duplex; var util = require('util'); -var version = require('../../../package.json').version; +var version = require('../package.json').version; /** * Initial response metadata sent by the server when it starts processing the diff --git a/packages/grpc-native-core/src/grpc_extension.js b/packages/grpc-native-core/src/grpc_extension.js index af43eaca..77476f01 100644 --- a/packages/grpc-native-core/src/grpc_extension.js +++ b/packages/grpc-native-core/src/grpc_extension.js @@ -26,7 +26,7 @@ var binary = require('node-pre-gyp/lib/pre-binding'); var path = require('path'); var binding_path = - binary.find(path.resolve(path.join(__dirname, '../../../package.json'))); + binary.find(path.resolve(path.join(__dirname, '../package.json'))); var binding = require(binding_path); module.exports = binding; diff --git a/packages/grpc-native-core/test/async_test.js b/packages/grpc-native-core/test/async_test.js index b62b4149..e2f124e5 100644 --- a/packages/grpc-native-core/test/async_test.js +++ b/packages/grpc-native-core/test/async_test.js @@ -21,7 +21,7 @@ var assert = require('assert'); var grpc = require('..'); -var math = grpc.load(__dirname + '/../../proto/math/math.proto').math; +var math = grpc.load(__dirname + '/../deps/grpc/src/proto/math/math.proto').math; /** diff --git a/packages/grpc-native-core/test/server_test.js b/packages/grpc-native-core/test/server_test.js index 454acbda..c1b94194 100644 --- a/packages/grpc-native-core/test/server_test.js +++ b/packages/grpc-native-core/test/server_test.js @@ -72,8 +72,8 @@ describe('server', function() { }); it('should bind to an unused port with ssl credentials', function() { var port; - var key_path = path.join(__dirname, '../test/data/server1.key'); - var pem_path = path.join(__dirname, '../test/data/server1.pem'); + var key_path = path.join(__dirname, '../../../test/data/server1.key'); + var pem_path = path.join(__dirname, '../../../test/data/server1.pem'); var key_data = fs.readFileSync(key_path); var pem_data = fs.readFileSync(pem_path); var creds = grpc.ServerCredentials.createSsl(null, diff --git a/packages/grpc-native-core/test/credentials_test.js b/test/api/credentials_test.js similarity index 98% rename from packages/grpc-native-core/test/credentials_test.js rename to test/api/credentials_test.js index 0ff838e7..96879994 100644 --- a/packages/grpc-native-core/test/credentials_test.js +++ b/test/api/credentials_test.js @@ -22,7 +22,7 @@ var assert = require('assert'); var fs = require('fs'); var path = require('path'); -var grpc = require('..'); +var grpc = require('grpc'); /** * This is used for testing functions with multiple asynchronous calls that @@ -67,9 +67,9 @@ var fakeFailingGoogleCredentials = { var key_data, pem_data, ca_data; before(function() { - var key_path = path.join(__dirname, './data/server1.key'); - var pem_path = path.join(__dirname, './data/server1.pem'); - var ca_path = path.join(__dirname, '../test/data/ca.pem'); + var key_path = path.join(__dirname, '../data/server1.key'); + var pem_path = path.join(__dirname, '../data/server1.pem'); + var ca_path = path.join(__dirname, '../data/ca.pem'); key_data = fs.readFileSync(key_path); pem_data = fs.readFileSync(pem_path); ca_data = fs.readFileSync(ca_path); diff --git a/packages/grpc-native-core/test/echo_service.proto b/test/api/echo_service.proto similarity index 100% rename from packages/grpc-native-core/test/echo_service.proto rename to test/api/echo_service.proto diff --git a/packages/grpc-native-core/test/interop_sanity_test.js b/test/api/interop_sanity_test.js similarity index 100% rename from packages/grpc-native-core/test/interop_sanity_test.js rename to test/api/interop_sanity_test.js diff --git a/packages/grpc-native-core/test/surface_test.js b/test/api/surface_test.js similarity index 96% rename from packages/grpc-native-core/test/surface_test.js rename to test/api/surface_test.js index 0b0b393e..0203931b 100644 --- a/packages/grpc-native-core/test/surface_test.js +++ b/test/api/surface_test.js @@ -21,19 +21,13 @@ var assert = require('assert'); var _ = require('lodash'); -var surface_client = require('../src/client.js'); -var common = require('../src/common'); - var ProtoBuf = require('protobufjs'); -var grpc = require('..'); +var grpc = require('grpc'); -var math_proto = ProtoBuf.loadProtoFile(__dirname + - '/../../proto/math/math.proto'); - -var mathService = math_proto.lookup('math.Math'); -var mathServiceAttrs = grpc.loadObject( - mathService, common.defaultGrpcOptions).service; +var MathClient = grpc.load( + __dirname + '/../../packages/grpc-native-core/deps/grpc/src/proto/math/math.proto').math.Math; +var mathServiceAttrs = MathClient.service; /** * This is used for testing functions with multiple asynchronous calls that @@ -100,31 +94,6 @@ describe('surface Server', function() { server.tryShutdown(done); }); }); -describe('Server.prototype.addProtoService', function() { - var server; - var dummyImpls = { - 'div': function() {}, - 'divMany': function() {}, - 'fib': function() {}, - 'sum': function() {} - }; - beforeEach(function() { - server = new grpc.Server(); - }); - afterEach(function() { - server.forceShutdown(); - }); - it('Should succeed with a single proto service', function() { - assert.doesNotThrow(function() { - server.addProtoService(mathService, dummyImpls); - }); - }); - it('Should succeed with a single service attributes object', function() { - assert.doesNotThrow(function() { - server.addProtoService(mathServiceAttrs, dummyImpls); - }); - }); -}); describe('Server.prototype.addService', function() { var server; var dummyImpls = { @@ -158,7 +127,7 @@ describe('Server.prototype.addService', function() { 'Sum': function() {} }; assert.doesNotThrow(function() { - server.addProtoService(mathService, altDummyImpls); + server.addService(mathServiceAttrs, altDummyImpls); }); }); it('Should have a conflict between name variations', function() { @@ -171,9 +140,9 @@ describe('Server.prototype.addService', function() { 'Fib': function() {}, 'Sum': function() {} }; - server.addProtoService(mathService, altDummyImpls); + server.addProtoService(mathServiceAttrs, altDummyImpls); assert.throws(function() { - server.addProtoService(mathService, dummyImpls); + server.addProtoService(mathServiceAttrs, dummyImpls); }); }); it('Should fail if the server has been started', function() { @@ -187,9 +156,8 @@ describe('Server.prototype.addService', function() { beforeEach(function() { server.addService(mathServiceAttrs, {}); var port = server.bind('localhost:0', server_insecure_creds); - var Client = grpc.loadObject(mathService); - client = new Client('localhost:' + port, - grpc.credentials.createInsecure()); + client = new MathClient('localhost:' + port, + grpc.credentials.createInsecure()); server.start(); }); it('should respond to a unary call with UNIMPLEMENTED', function(done) { @@ -253,13 +221,12 @@ describe('Client constructor building', function() { describe('waitForClientReady', function() { var server; var port; - var Client; + var Client = MathClient; var client; before(function() { server = new grpc.Server(); port = server.bind('localhost:0', grpc.ServerCredentials.createInsecure()); server.start(); - Client = grpc.loadObject(mathService); }); beforeEach(function() { client = new Client('localhost:' + port, grpc.credentials.createInsecure()); @@ -520,7 +487,7 @@ describe('Echo metadata', function() { call.end(); }); it('shows the correct user-agent string', function(done) { - var version = require('../../../package.json').version; + var version = require('grpc/package.json').version; var call = client.unary({}, metadata, function(err, data) { assert.ifError(err); }); call.on('metadata', function(metadata) { @@ -887,8 +854,8 @@ describe('Other conditions', function() { responseDeserialize: _.identity } }; - var Client = surface_client.makeClientConstructor(test_service_attrs, - 'TestService'); + var Client = grpc.makeGenericClientConstructor(test_service_attrs, + 'TestService'); misbehavingClient = new Client('localhost:' + port, grpc.credentials.createInsecure()); }); @@ -1310,7 +1277,7 @@ describe('Cancelling surface client', function() { 'sum': function(stream) {} }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = surface_client.makeClientConstructor(mathServiceAttrs); + var Client = grpc.makeGenericClientConstructor(mathServiceAttrs); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); diff --git a/test/api/test_messages.proto b/test/api/test_messages.proto new file mode 100644 index 00000000..da1ef565 --- /dev/null +++ b/test/api/test_messages.proto @@ -0,0 +1,45 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +message LongValues { + int64 int_64 = 1; + uint64 uint_64 = 2; + sint64 sint_64 = 3; + fixed64 fixed_64 = 4; + sfixed64 sfixed_64 = 5; +} + +message SequenceValues { + bytes bytes_field = 1; + repeated int32 repeated_field = 2; +} + +message OneOfValues { + oneof oneof_choice { + int32 int_choice = 1; + string string_choice = 2; + } +} + +enum TestEnum { + ZERO = 0; + ONE = 1; + TWO = 2; +} + +message EnumValues { + TestEnum enum_value = 1; +} diff --git a/packages/grpc-native-core/test/test_service.json b/test/api/test_service.json similarity index 100% rename from packages/grpc-native-core/test/test_service.json rename to test/api/test_service.json diff --git a/packages/grpc-native-core/test/test_service.proto b/test/api/test_service.proto similarity index 100% rename from packages/grpc-native-core/test/test_service.proto rename to test/api/test_service.proto diff --git a/packages/grpc-native-core/test/data/README b/test/data/README similarity index 100% rename from packages/grpc-native-core/test/data/README rename to test/data/README diff --git a/packages/grpc-native-core/test/data/ca.pem b/test/data/ca.pem similarity index 100% rename from packages/grpc-native-core/test/data/ca.pem rename to test/data/ca.pem diff --git a/packages/grpc-native-core/test/data/server1.key b/test/data/server1.key similarity index 100% rename from packages/grpc-native-core/test/data/server1.key rename to test/data/server1.key diff --git a/packages/grpc-native-core/test/data/server1.pem b/test/data/server1.pem similarity index 100% rename from packages/grpc-native-core/test/data/server1.pem rename to test/data/server1.pem diff --git a/test/gulpfile.js b/test/gulpfile.js index 98f308c0..ffe53c6d 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -1,11 +1,19 @@ const _gulp = require('gulp'); const help = require('gulp-help'); -const run = require('gulp-run'); +const mocha = require('gulp-mocha'); +const exec = require('child_process').exec; +const path = require('path'); // gulp-help monkeypatches tasks to have an additional description parameter const gulp = help(_gulp); -gulp.task('internal.test.link', 'Link local copies of grpc packages', () => { - return run(`npm link ${__dirname}/../packages/grpc-native-core`).exec() - .pipe(gulp.dest('output')); +const testDir = __dirname; +const apiTestDir = path.resolve(testDir, 'api'); + +gulp.task('internal.test.link', 'Link local copies of grpc packages', (cb) => { + return exec(`npm link ${testDir}/../packages/grpc-native-core`, cb); +}); + +gulp.task('internal.test.test', 'Run API-level tests', ['internal.test.link'], () => { + return gulp.src(`${apiTestDir}/*.js`).pipe(mocha()); }); diff --git a/test/interop/interop_client.js b/test/interop/interop_client.js index 4a764f4e..5fad82bf 100644 --- a/test/interop/interop_client.js +++ b/test/interop/interop_client.js @@ -23,7 +23,7 @@ var path = require('path'); // TODO(murgatroid99): use multiple grpc implementations var grpc = require('grpc'); var testProto = grpc.load({ - root: __dirname + '/../packages/grpc-native-core/ext/grpc', + root: __dirname + '/../../packages/grpc-native-core/deps/grpc', file: 'src/proto/grpc/testing/test.proto'}).grpc.testing; var GoogleAuth = require('google-auth-library'); @@ -566,7 +566,7 @@ function runTest(address, host_override, test_case, tls, test_ca, done, extra) { if (tls) { var ca_path; if (test_ca) { - ca_path = path.join(__dirname, '../test/data/ca.pem'); + ca_path = path.join(__dirname, '../data/ca.pem'); var ca_data = fs.readFileSync(ca_path); creds = grpc.credentials.createSsl(ca_data); } else { diff --git a/test/interop/interop_server.js b/test/interop/interop_server.js index 94bfd53a..65bb088d 100644 --- a/test/interop/interop_server.js +++ b/test/interop/interop_server.js @@ -25,7 +25,7 @@ var AsyncDelayQueue = require('./async_delay_queue'); // TODO(murgatroid99): use multiple grpc implementations var grpc = require('grpc'); var testProto = grpc.load({ - root: __dirname + '/../packages/grpc-native-core/ext/grpc', + root: __dirname + '/../../packages/grpc-native-core/deps/grpc', file: 'src/proto/grpc/testing/test.proto'}).grpc.testing; var ECHO_INITIAL_KEY = 'x-grpc-test-echo-initial'; @@ -202,8 +202,8 @@ function getServer(port, tls) { var options = {}; var server_creds; if (tls) { - var key_path = path.join(__dirname, '../test/data/server1.key'); - var pem_path = path.join(__dirname, '../test/data/server1.pem'); + var key_path = path.join(__dirname, '../data/server1.key'); + var pem_path = path.join(__dirname, '../data/server1.pem'); var key_data = fs.readFileSync(key_path); var pem_data = fs.readFileSync(pem_path);