{"action":"created","comment":{"url":"https://api.github.com/repos/inetCatapult/service-maker/pulls/comments/35248670","id":35248670,"diff_hunk":"@@ -0,0 +1,357 @@\n+\"use strict\";\n+\n+var AWS        = require(\"aws-sdk\");\n+var sinon      = require(\"sinon\");\n+var expect     = require(\"chai\").expect;\n+var SshAdapter = require(\"../../../lib/services/sshAdapter\");\n+var Bluebird   = require(\"bluebird\");\n+var options    = {};\n+var ec2        = new AWS.EC2();\n+\n+Bluebird.promisifyAll(ec2);\n+options.ec2 =  ec2;\n+\n+describe(\"The SSH Adapter Class\", function () {\n+\tvar id                   = \"i-fbf47257\";\n+\tvar SSH_POLLING_INTERVAL = 30; //Time in Seconds\n+\n+\tdescribe(\"Can Ssh\", function () {\n+\t\tvar instanceStatusStub;\n+\t\tvar result;\n+\t\tvar sshAdapter = new SshAdapter(ec2);\n+\t\tbefore(function () {\n+\t\t\tinstanceStatusStub = sinon.stub(ec2,\"describeInstanceStatusAsync\", function () {\n+\t\t\t\tvar data = {\n+\t\t\t\t\tInstanceStatuses : [ {\n+\t\t\t\t\t\tSystemStatus : {\n+\t\t\t\t\t\t\tDetails : [ {\n+\t\t\t\t\t\t\t\tStatus : \"passed\"\n+\t\t\t\t\t\t\t} ]\n+\t\t\t\t\t\t}\n+\t\t\t\t\t} ]\n+\t\t\t\t};\n+\t\t\t\treturn (Bluebird.resolve(data));\n+\t\t\t});\n+\t\t\tsshAdapter.canSsh(id)\n+\t\t\t.then(function (data) {\n+\t\t\t\tresult = data;\n+\t\t\t})\n+\t\t\t.catch(function (err) {\n+\t\t\t\tresult = err;\n+\t\t\t});\n+\t\t});\n+\n+\t\tafter(function () {\n+\t\t\tinstanceStatusStub.restore();\n+\t\t});\n+\n+\t\tit(\"is able to connect\", function () {\n+\t\t\texpect(instanceStatusStub.called).to.be.true;\n+\t\t\texpect(instanceStatusStub.args[ 0 ][ 0 ].InstanceIds[ 0 ]).to.equal(id);\n+\t\t\texpect(result).to.be.true;\n+\t\t});\n+\t});\n+\n+\tdescribe(\"Tries to ssh\", function () {\n+\t\tdescribe(\"as soon as instance is created\", function () {\n+\t\t\tvar instanceStatusStub;\n+\t\t\tvar result;\n+\t\t\tvar sshAdapter = new SshAdapter(ec2);\n+\t\t\tbefore(function () {\n+\t\t\t\tinstanceStatusStub = sinon.stub(ec2,\"describeInstanceStatusAsync\", function () {\n+\t\t\t\t\tvar data = {\n+\t\t\t\t\t\tInstanceStatuses : []\n+\t\t\t\t\t};\n+\t\t\t\t\treturn (Bluebird.resolve(data));\n+\t\t\t\t});\n+\t\t\t\tsshAdapter.canSsh(id)\n+\t\t\t\t.then(function (data) {\n+\t\t\t\t\tresult = data;\n+\t\t\t\t})\n+\t\t\t\t.catch(function (err) {\n+\t\t\t\t\tresult = err;\n+\t\t\t\t});\n+\t\t\t});\n+\n+\t\t\tafter(function () {\n+\t\t\t\tinstanceStatusStub.restore();\n+\t\t\t});\n+\n+\t\t\tit(\"is not able to connect\", function () {\n+\t\t\t\texpect(instanceStatusStub.called).to.be.true;\n+\t\t\t\texpect(instanceStatusStub.args[ 0 ][ 0 ].InstanceIds[ 0 ]).to.equal(id);\n+\t\t\t\texpect(result).to.be.false;\n+\t\t\t});\n+\t\t});\n+\n+\t\tdescribe(\"when system checks have failed\", function () {\n+\t\t\tvar instanceStatusStub;\n+\t\t\tvar result;\n+\t\t\tvar sshAdapter = new SshAdapter(ec2);\n+\t\t\tbefore(function () {\n+\t\t\t\tinstanceStatusStub = sinon.stub(ec2,\"describeInstanceStatusAsync\", function () {\n+\t\t\t\t\tvar data = {\n+\t\t\t\t\t\tInstanceStatuses : [ {\n+\t\t\t\t\t\t\tSystemStatus : {\n+\t\t\t\t\t\t\t\tDetails : [ {\n+\t\t\t\t\t\t\t\t\tStatus : \"failed\"\n+\t\t\t\t\t\t\t\t} ]\n+\t\t\t\t\t\t\t}\n+\t\t\t\t\t\t} ]\n+\t\t\t\t\t};\n+\t\t\t\t\treturn (Bluebird.resolve(data));\n+\t\t\t\t});\n+\t\t\t\tsshAdapter.canSsh(id)\n+\t\t\t\t.then(function (data) {\n+\t\t\t\t\tresult = data;\n+\t\t\t\t})\n+\t\t\t\t.catch(function (err) {\n+\t\t\t\t\tresult = err;\n+\t\t\t\t});\n+\t\t\t});\n+\n+\t\t\tafter(function () {\n+\t\t\t\tinstanceStatusStub.restore();\n+\t\t\t});\n+\n+\t\t\tit(\"it returns an error as system checks have failed\", function () {","path":"test/unit/services/sshAdapter_spec.js","position":117,"original_position":117,"commit_id":"ea1638e58c91f5dd7d6b0b606a2bd193d074aacc","original_commit_id":"ea1638e58c91f5dd7d6b0b606a2bd193d074aacc","user":{"login":"jagoda","id":655686,"avatar_url":"https://avatars.githubusercontent.com/u/655686?v=3","gravatar_id":"","url":"https://api.github.com/users/jagoda","html_url":"https://github.com/jagoda","followers_url":"https://api.github.com/users/jagoda/followers","following_url":"https://api.github.com/users/jagoda/following{/other_user}","gists_url":"https://api.github.com/users/jagoda/gists{/gist_id}","starred_url":"https://api.github.com/users/jagoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jagoda/subscriptions","organizations_url":"https://api.github.com/users/jagoda/orgs","repos_url":"https://api.github.com/users/jagoda/repos","events_url":"https://api.github.com/users/jagoda/events{/privacy}","received_events_url":"https://api.github.com/users/jagoda/received_events","type":"User","site_admin":false},"body":"It is probably sufficient to just use \"it returns an error\" here.","created_at":"2015-07-22T18:45:46Z","updated_at":"2015-07-22T18:45:46Z","html_url":"https://github.com/inetCatapult/service-maker/pull/85#discussion_r35248670","pull_request_url":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/inetCatapult/service-maker/pulls/comments/35248670"},"html":{"href":"https://github.com/inetCatapult/service-maker/pull/85#discussion_r35248670"},"pull_request":{"href":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85","id":40572791,"html_url":"https://github.com/inetCatapult/service-maker/pull/85","diff_url":"https://github.com/inetCatapult/service-maker/pull/85.diff","patch_url":"https://github.com/inetCatapult/service-maker/pull/85.patch","issue_url":"https://api.github.com/repos/inetCatapult/service-maker/issues/85","number":85,"state":"open","locked":false,"title":"Issue60 merge","user":{"login":"rrpod","id":6464042,"avatar_url":"https://avatars.githubusercontent.com/u/6464042?v=3","gravatar_id":"","url":"https://api.github.com/users/rrpod","html_url":"https://github.com/rrpod","followers_url":"https://api.github.com/users/rrpod/followers","following_url":"https://api.github.com/users/rrpod/following{/other_user}","gists_url":"https://api.github.com/users/rrpod/gists{/gist_id}","starred_url":"https://api.github.com/users/rrpod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrpod/subscriptions","organizations_url":"https://api.github.com/users/rrpod/orgs","repos_url":"https://api.github.com/users/rrpod/repos","events_url":"https://api.github.com/users/rrpod/events{/privacy}","received_events_url":"https://api.github.com/users/rrpod/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-22T14:46:14Z","updated_at":"2015-07-22T18:45:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4276360f58e6fa891573d6e5bc9d3e42209fb94d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85/commits","review_comments_url":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85/comments","review_comment_url":"https://api.github.com/repos/inetCatapult/service-maker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inetCatapult/service-maker/issues/85/comments","statuses_url":"https://api.github.com/repos/inetCatapult/service-maker/statuses/ea1638e58c91f5dd7d6b0b606a2bd193d074aacc","head":{"label":"rrpod:issue60_merge","ref":"issue60_merge","sha":"ea1638e58c91f5dd7d6b0b606a2bd193d074aacc","user":{"login":"rrpod","id":6464042,"avatar_url":"https://avatars.githubusercontent.com/u/6464042?v=3","gravatar_id":"","url":"https://api.github.com/users/rrpod","html_url":"https://github.com/rrpod","followers_url":"https://api.github.com/users/rrpod/followers","following_url":"https://api.github.com/users/rrpod/following{/other_user}","gists_url":"https://api.github.com/users/rrpod/gists{/gist_id}","starred_url":"https://api.github.com/users/rrpod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrpod/subscriptions","organizations_url":"https://api.github.com/users/rrpod/orgs","repos_url":"https://api.github.com/users/rrpod/repos","events_url":"https://api.github.com/users/rrpod/events{/privacy}","received_events_url":"https://api.github.com/users/rrpod/received_events","type":"User","site_admin":false},"repo":{"id":38839759,"name":"service-maker","full_name":"rrpod/service-maker","owner":{"login":"rrpod","id":6464042,"avatar_url":"https://avatars.githubusercontent.com/u/6464042?v=3","gravatar_id":"","url":"https://api.github.com/users/rrpod","html_url":"https://github.com/rrpod","followers_url":"https://api.github.com/users/rrpod/followers","following_url":"https://api.github.com/users/rrpod/following{/other_user}","gists_url":"https://api.github.com/users/rrpod/gists{/gist_id}","starred_url":"https://api.github.com/users/rrpod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrpod/subscriptions","organizations_url":"https://api.github.com/users/rrpod/orgs","repos_url":"https://api.github.com/users/rrpod/repos","events_url":"https://api.github.com/users/rrpod/events{/privacy}","received_events_url":"https://api.github.com/users/rrpod/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rrpod/service-maker","description":"","fork":true,"url":"https://api.github.com/repos/rrpod/service-maker","forks_url":"https://api.github.com/repos/rrpod/service-maker/forks","keys_url":"https://api.github.com/repos/rrpod/service-maker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rrpod/service-maker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rrpod/service-maker/teams","hooks_url":"https://api.github.com/repos/rrpod/service-maker/hooks","issue_events_url":"https://api.github.com/repos/rrpod/service-maker/issues/events{/number}","events_url":"https://api.github.com/repos/rrpod/service-maker/events","assignees_url":"https://api.github.com/repos/rrpod/service-maker/assignees{/user}","branches_url":"https://api.github.com/repos/rrpod/service-maker/branches{/branch}","tags_url":"https://api.github.com/repos/rrpod/service-maker/tags","blobs_url":"https://api.github.com/repos/rrpod/service-maker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rrpod/service-maker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rrpod/service-maker/git/refs{/sha}","trees_url":"https://api.github.com/repos/rrpod/service-maker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rrpod/service-maker/statuses/{sha}","languages_url":"https://api.github.com/repos/rrpod/service-maker/languages","stargazers_url":"https://api.github.com/repos/rrpod/service-maker/stargazers","contributors_url":"https://api.github.com/repos/rrpod/service-maker/contributors","subscribers_url":"https://api.github.com/repos/rrpod/service-maker/subscribers","subscription_url":"https://api.github.com/repos/rrpod/service-maker/subscription","commits_url":"https://api.github.com/repos/rrpod/service-maker/commits{/sha}","git_commits_url":"https://api.github.com/repos/rrpod/service-maker/git/commits{/sha}","comments_url":"https://api.github.com/repos/rrpod/service-maker/comments{/number}","issue_comment_url":"https://api.github.com/repos/rrpod/service-maker/issues/comments{/number}","contents_url":"https://api.github.com/repos/rrpod/service-maker/contents/{+path}","compare_url":"https://api.github.com/repos/rrpod/service-maker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rrpod/service-maker/merges","archive_url":"https://api.github.com/repos/rrpod/service-maker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rrpod/service-maker/downloads","issues_url":"https://api.github.com/repos/rrpod/service-maker/issues{/number}","pulls_url":"https://api.github.com/repos/rrpod/service-maker/pulls{/number}","milestones_url":"https://api.github.com/repos/rrpod/service-maker/milestones{/number}","notifications_url":"https://api.github.com/repos/rrpod/service-maker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rrpod/service-maker/labels{/name}","releases_url":"https://api.github.com/repos/rrpod/service-maker/releases{/id}","created_at":"2015-07-09T19:05:50Z","updated_at":"2015-07-09T19:05:51Z","pushed_at":"2015-07-22T14:45:13Z","git_url":"git://github.com/rrpod/service-maker.git","ssh_url":"git@github.com:rrpod/service-maker.git","clone_url":"https://github.com/rrpod/service-maker.git","svn_url":"https://github.com/rrpod/service-maker","homepage":null,"size":294,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"inetCatapult:v1.0","ref":"v1.0","sha":"ec87b2134c7301c522643675dedcb127292f591f","user":{"login":"inetCatapult","id":1799831,"avatar_url":"https://avatars.githubusercontent.com/u/1799831?v=3","gravatar_id":"","url":"https://api.github.com/users/inetCatapult","html_url":"https://github.com/inetCatapult","followers_url":"https://api.github.com/users/inetCatapult/followers","following_url":"https://api.github.com/users/inetCatapult/following{/other_user}","gists_url":"https://api.github.com/users/inetCatapult/gists{/gist_id}","starred_url":"https://api.github.com/users/inetCatapult/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inetCatapult/subscriptions","organizations_url":"https://api.github.com/users/inetCatapult/orgs","repos_url":"https://api.github.com/users/inetCatapult/repos","events_url":"https://api.github.com/users/inetCatapult/events{/privacy}","received_events_url":"https://api.github.com/users/inetCatapult/received_events","type":"Organization","site_admin":false},"repo":{"id":29730754,"name":"service-maker","full_name":"inetCatapult/service-maker","owner":{"login":"inetCatapult","id":1799831,"avatar_url":"https://avatars.githubusercontent.com/u/1799831?v=3","gravatar_id":"","url":"https://api.github.com/users/inetCatapult","html_url":"https://github.com/inetCatapult","followers_url":"https://api.github.com/users/inetCatapult/followers","following_url":"https://api.github.com/users/inetCatapult/following{/other_user}","gists_url":"https://api.github.com/users/inetCatapult/gists{/gist_id}","starred_url":"https://api.github.com/users/inetCatapult/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inetCatapult/subscriptions","organizations_url":"https://api.github.com/users/inetCatapult/orgs","repos_url":"https://api.github.com/users/inetCatapult/repos","events_url":"https://api.github.com/users/inetCatapult/events{/privacy}","received_events_url":"https://api.github.com/users/inetCatapult/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inetCatapult/service-maker","description":"","fork":false,"url":"https://api.github.com/repos/inetCatapult/service-maker","forks_url":"https://api.github.com/repos/inetCatapult/service-maker/forks","keys_url":"https://api.github.com/repos/inetCatapult/service-maker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inetCatapult/service-maker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inetCatapult/service-maker/teams","hooks_url":"https://api.github.com/repos/inetCatapult/service-maker/hooks","issue_events_url":"https://api.github.com/repos/inetCatapult/service-maker/issues/events{/number}","events_url":"https://api.github.com/repos/inetCatapult/service-maker/events","assignees_url":"https://api.github.com/repos/inetCatapult/service-maker/assignees{/user}","branches_url":"https://api.github.com/repos/inetCatapult/service-maker/branches{/branch}","tags_url":"https://api.github.com/repos/inetCatapult/service-maker/tags","blobs_url":"https://api.github.com/repos/inetCatapult/service-maker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inetCatapult/service-maker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inetCatapult/service-maker/git/refs{/sha}","trees_url":"https://api.github.com/repos/inetCatapult/service-maker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inetCatapult/service-maker/statuses/{sha}","languages_url":"https://api.github.com/repos/inetCatapult/service-maker/languages","stargazers_url":"https://api.github.com/repos/inetCatapult/service-maker/stargazers","contributors_url":"https://api.github.com/repos/inetCatapult/service-maker/contributors","subscribers_url":"https://api.github.com/repos/inetCatapult/service-maker/subscribers","subscription_url":"https://api.github.com/repos/inetCatapult/service-maker/subscription","commits_url":"https://api.github.com/repos/inetCatapult/service-maker/commits{/sha}","git_commits_url":"https://api.github.com/repos/inetCatapult/service-maker/git/commits{/sha}","comments_url":"https://api.github.com/repos/inetCatapult/service-maker/comments{/number}","issue_comment_url":"https://api.github.com/repos/inetCatapult/service-maker/issues/comments{/number}","contents_url":"https://api.github.com/repos/inetCatapult/service-maker/contents/{+path}","compare_url":"https://api.github.com/repos/inetCatapult/service-maker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inetCatapult/service-maker/merges","archive_url":"https://api.github.com/repos/inetCatapult/service-maker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inetCatapult/service-maker/downloads","issues_url":"https://api.github.com/repos/inetCatapult/service-maker/issues{/number}","pulls_url":"https://api.github.com/repos/inetCatapult/service-maker/pulls{/number}","milestones_url":"https://api.github.com/repos/inetCatapult/service-maker/milestones{/number}","notifications_url":"https://api.github.com/repos/inetCatapult/service-maker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inetCatapult/service-maker/labels{/name}","releases_url":"https://api.github.com/repos/inetCatapult/service-maker/releases{/id}","created_at":"2015-01-23T11:57:25Z","updated_at":"2015-06-26T19:55:03Z","pushed_at":"2015-07-22T14:46:14Z","git_url":"git://github.com/inetCatapult/service-maker.git","ssh_url":"git@github.com:inetCatapult/service-maker.git","clone_url":"https://github.com/inetCatapult/service-maker.git","svn_url":"https://github.com/inetCatapult/service-maker","homepage":null,"size":729,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85"},"html":{"href":"https://github.com/inetCatapult/service-maker/pull/85"},"issue":{"href":"https://api.github.com/repos/inetCatapult/service-maker/issues/85"},"comments":{"href":"https://api.github.com/repos/inetCatapult/service-maker/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/inetCatapult/service-maker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inetCatapult/service-maker/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/inetCatapult/service-maker/statuses/ea1638e58c91f5dd7d6b0b606a2bd193d074aacc"}}}}