mirror of https://github.com/grpc/grpc-node.git
Added interop support for default root SSL certs
This commit is contained in:
parent
c1e61622b3
commit
924cd36e18
|
@ -280,11 +280,16 @@ var test_cases = {
|
||||||
* @param {function} done Callback to call when the test is completed. Included
|
* @param {function} done Callback to call when the test is completed. Included
|
||||||
* primarily for use with mocha
|
* primarily for use with mocha
|
||||||
*/
|
*/
|
||||||
function runTest(address, host_override, test_case, tls, done) {
|
function runTest(address, host_override, test_case, tls, test_ca, done) {
|
||||||
// TODO(mlumish): enable TLS functionality
|
// TODO(mlumish): enable TLS functionality
|
||||||
var options = {};
|
var options = {};
|
||||||
if (tls) {
|
if (tls) {
|
||||||
var ca_path = path.join(__dirname, '../test/data/ca.pem');
|
var ca_path;
|
||||||
|
if (test_ca) {
|
||||||
|
ca_path = path.join(__dirname, '../test/data/ca.pem');
|
||||||
|
} else {
|
||||||
|
ca_path = process.env.SSL_CERT_FILE;
|
||||||
|
}
|
||||||
var ca_data = fs.readFileSync(ca_path);
|
var ca_data = fs.readFileSync(ca_path);
|
||||||
var creds = grpc.Credentials.createSsl(ca_data);
|
var creds = grpc.Credentials.createSsl(ca_data);
|
||||||
options.credentials = creds;
|
options.credentials = creds;
|
||||||
|
@ -304,7 +309,10 @@ if (require.main === module) {
|
||||||
'use_tls', 'use_test_ca']
|
'use_tls', 'use_test_ca']
|
||||||
});
|
});
|
||||||
runTest(argv.server_host + ':' + argv.server_port, argv.server_host_override,
|
runTest(argv.server_host + ':' + argv.server_port, argv.server_host_override,
|
||||||
argv.test_case, argv.use_tls === 'true');
|
argv.test_case, argv.use_tls === 'true', argv.use_test_ca === 'true',
|
||||||
|
function () {
|
||||||
|
console.log('OK:', argv.test_case);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,30 +53,35 @@ describe('Interop tests', function() {
|
||||||
});
|
});
|
||||||
// This depends on not using a binary stream
|
// This depends on not using a binary stream
|
||||||
it('should pass empty_unary', function(done) {
|
it('should pass empty_unary', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'empty_unary', true, done);
|
interop_client.runTest(port, name_override, 'empty_unary', true, true,
|
||||||
|
done);
|
||||||
});
|
});
|
||||||
// This fails due to an unknown bug
|
// This fails due to an unknown bug
|
||||||
it('should pass large_unary', function(done) {
|
it('should pass large_unary', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'large_unary', true, done);
|
interop_client.runTest(port, name_override, 'large_unary', true, true,
|
||||||
|
done);
|
||||||
});
|
});
|
||||||
it('should pass client_streaming', function(done) {
|
it('should pass client_streaming', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'client_streaming', true, done);
|
interop_client.runTest(port, name_override, 'client_streaming', true, true,
|
||||||
|
done);
|
||||||
});
|
});
|
||||||
it('should pass server_streaming', function(done) {
|
it('should pass server_streaming', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'server_streaming', true, done);
|
interop_client.runTest(port, name_override, 'server_streaming', true, true,
|
||||||
|
done);
|
||||||
});
|
});
|
||||||
it('should pass ping_pong', function(done) {
|
it('should pass ping_pong', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'ping_pong', true, done);
|
interop_client.runTest(port, name_override, 'ping_pong', true, true, done);
|
||||||
});
|
});
|
||||||
it('should pass empty_stream', function(done) {
|
it('should pass empty_stream', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'empty_stream', true, done);
|
interop_client.runTest(port, name_override, 'empty_stream', true, true,
|
||||||
|
done);
|
||||||
});
|
});
|
||||||
it('should pass cancel_after_begin', function(done) {
|
it('should pass cancel_after_begin', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'cancel_after_begin', true,
|
interop_client.runTest(port, name_override, 'cancel_after_begin', true,
|
||||||
done);
|
true, done);
|
||||||
});
|
});
|
||||||
it('should pass cancel_after_first_response', function(done) {
|
it('should pass cancel_after_first_response', function(done) {
|
||||||
interop_client.runTest(port, name_override, 'cancel_after_first_response',
|
interop_client.runTest(port, name_override, 'cancel_after_first_response',
|
||||||
true, done);
|
true, true, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue