Skip to content

Commit

Permalink
With agent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
131 committed Sep 16, 2019
1 parent c85ed55 commit 911cfaa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./lib/client",
"engines": { "node": ">=5.2.0" },
"dependencies": {
"ssh2-streams": "~0.4.4"
"ssh2-streams": "~0.4.5"
},
"scripts": {
"test": "node test/test.js"
Expand Down
16 changes: 14 additions & 2 deletions test/test-client-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var crypto = require('crypto');
var path = require('path');
var join = path.join;
var inspect = require('util').inspect;
var cp = require('child_process');
var assert = require('assert');

var t = -1;
Expand Down Expand Up @@ -922,17 +923,20 @@ var tests = [
var server;
var r;
var out = '';
var agent;
var agent_sock = '/tmp/foobar';

r = setup(
this,
{ username: USER,
password: PASSWORD,
agent: '/foo/bar/baz'
agent: agent_sock,
},
{ hostKeys: [HOST_KEY_RSA] }
);
client = r.client;
server = r.server;
agent = cp.spawn('ssh-agent', ['-d', '-a', agent_sock]);

server.on('connection', function(conn) {
conn.on('authentication', function(ctx) {
Expand All @@ -951,7 +955,15 @@ var tests = [
stream.write(inspect(authAgentReq));
stream.exit(100);
stream.end();
conn.end();

conn.openssh_authAgent(function(err, stream) {
assert(!err, makeMsg('Unexpected openssh_authAgent error: ' + err));
assert(stream.type === '[email protected]',
makeMsg('Unexpected openssh_authAgent channel type : ' + stream.type));

conn.end();
agent && agent.kill();
});
});
});
});
Expand Down

0 comments on commit 911cfaa

Please sign in to comment.