{"action":"created","comment":{"url":"https://api.github.com/repos/diogomonica/actuary/pulls/comments/125717829","pull_request_review_id":48131616,"id":125717829,"diff_hunk":"@@ -0,0 +1,205 @@\n+package actuary\n+\n+\n+import (\n+\n+\t\"encoding/json\"\n+\t\"testing\"\n+\t\"github.com/docker/engine-api/types\"\n+)\n+\n+//2. Docker daemon configuration\n+\n+//This function is used in all functions that call getProcCmdLine -- replacing the output of getProcCmdLine for the pass case and fail case\n+func procCmdLineHelper(t *testing.T, orig func(t Target) Result, procPass []string, procFail []string, err1 string, err2 string){\n+\n+\tprocFunction = func(procname string) (cmd []string, err error){\n+\t\t\terr = nil\n+\t\t\tcmd = procPass\n+\t\t\treturn\n+\t\t}\n+\n+\tfor i := 0; i< 2; i++{\n+\n+\t\tres := orig(testTarget)\n+\n+\t\tif i == 0 && res.Status != \"PASS\" {\n+\t\t\t\tt.Errorf(err1)\n+\t\t}\n+\n+\t\t//test fail case\n+\n+\t\tprocFunction = func(procname string) (cmd []string, err error){\n+\t\t\terr = nil\n+\t\t\tcmd = procFail\n+\t\t\treturn\n+\t\t}\n+\n+\t\tif i == 1 && res.Status == \"PASS\" {\n+\t\t\t\tt.Errorf(err2)\n+\t\t}\n+\t}\n+\n+\t//restore\n+\tprocFunction = getProcCmdline\n+}\n+\n+\n+func TestRestrictNetTraffic(t *testing.T) {\n+\t//calls .NetworkList(context.TODO(), netargs), fake a response network","path":"cmd/actuary/dockerconf_test.go","position":49,"original_position":49,"commit_id":"95212576a08c650ed999dae273397a1a8bfc913b","original_commit_id":"95212576a08c650ed999dae273397a1a8bfc913b","user":{"login":"diogomonica","id":55332,"avatar_url":"https://avatars1.githubusercontent.com/u/55332?v=3","gravatar_id":"","url":"https://api.github.com/users/diogomonica","html_url":"https://github.com/diogomonica","followers_url":"https://api.github.com/users/diogomonica/followers","following_url":"https://api.github.com/users/diogomonica/following{/other_user}","gists_url":"https://api.github.com/users/diogomonica/gists{/gist_id}","starred_url":"https://api.github.com/users/diogomonica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diogomonica/subscriptions","organizations_url":"https://api.github.com/users/diogomonica/orgs","repos_url":"https://api.github.com/users/diogomonica/repos","events_url":"https://api.github.com/users/diogomonica/events{/privacy}","received_events_url":"https://api.github.com/users/diogomonica/received_events","type":"User","site_admin":false},"body":"Comments on the function should be before the function, not inside of it.","created_at":"2017-07-05T18:10:17Z","updated_at":"2017-07-05T18:28:33Z","html_url":"https://github.com/diogomonica/actuary/pull/31#discussion_r125717829","pull_request_url":"https://api.github.com/repos/diogomonica/actuary/pulls/31","_links":{"self":{"href":"https://api.github.com/repos/diogomonica/actuary/pulls/comments/125717829"},"html":{"href":"https://github.com/diogomonica/actuary/pull/31#discussion_r125717829"},"pull_request":{"href":"https://api.github.com/repos/diogomonica/actuary/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/diogomonica/actuary/pulls/31","id":128705965,"html_url":"https://github.com/diogomonica/actuary/pull/31","diff_url":"https://github.com/diogomonica/actuary/pull/31.diff","patch_url":"https://github.com/diogomonica/actuary/pull/31.patch","issue_url":"https://api.github.com/repos/diogomonica/actuary/issues/31","number":31,"state":"open","locked":false,"title":"Added tests for actuary code","user":{"login":"oliviabarnett","id":17032867,"avatar_url":"https://avatars1.githubusercontent.com/u/17032867?v=3","gravatar_id":"","url":"https://api.github.com/users/oliviabarnett","html_url":"https://github.com/oliviabarnett","followers_url":"https://api.github.com/users/oliviabarnett/followers","following_url":"https://api.github.com/users/oliviabarnett/following{/other_user}","gists_url":"https://api.github.com/users/oliviabarnett/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviabarnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviabarnett/subscriptions","organizations_url":"https://api.github.com/users/oliviabarnett/orgs","repos_url":"https://api.github.com/users/oliviabarnett/repos","events_url":"https://api.github.com/users/oliviabarnett/events{/privacy}","received_events_url":"https://api.github.com/users/oliviabarnett/received_events","type":"User","site_admin":false},"body":"Tests split into 6 files.\r\n\r\nMain methods of testing the functions:\r\n1. Created a testTarget object that could be manipulated. Easy to use fake input to functions that request information only from the target parameter. (see dockerhost_test.go, dockerconf_test.go, images_test.go). Also used for all the functions that check container runtime settings -- could change testTarget's containers to either pass/fail for testing (see runtime_test.go)\r\n\r\n2. /testdata folder holds fake files. Rewrote a lot of the hardcoded lines (ex. /etc/fstab) in check functions as variables so that I could run the functions on files within /testdata during testing only. Similarly, used a \"changePath\" function to force the functions to look for expected files in /testdata first. (see dockerhost_test.go, dockerfiles_test.go)\r\n\r\n3. Mock server. Created a testServer function that handles calls to the docker API and returns fake  data to the functions. (see dockerhost_test.go, runtime_test.go, secops_test.go)\r\n\r\n4. Wrote a function that calls getProcCmdLine as a variable. For all the functions that call getProcCmdLine could replace with a different function call that returns fake data. (see dockerconf_test.go, dockerfiles_test.go)\r\n\r\nNoted potential problems in comments. Most unfinished test functions are in runtime_test.go -- reasons are noted.\r\n\r\n\r\n\r\n@diogomonica @cyli ","created_at":"2017-07-03T23:41:02Z","updated_at":"2017-07-05T18:28:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68af59f0def8560216bc2b32c34409c0dac3c00b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/diogomonica/actuary/pulls/31/commits","review_comments_url":"https://api.github.com/repos/diogomonica/actuary/pulls/31/comments","review_comment_url":"https://api.github.com/repos/diogomonica/actuary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/diogomonica/actuary/issues/31/comments","statuses_url":"https://api.github.com/repos/diogomonica/actuary/statuses/95212576a08c650ed999dae273397a1a8bfc913b","head":{"label":"oliviabarnett:proc-tests-actuary","ref":"proc-tests-actuary","sha":"95212576a08c650ed999dae273397a1a8bfc913b","user":{"login":"oliviabarnett","id":17032867,"avatar_url":"https://avatars1.githubusercontent.com/u/17032867?v=3","gravatar_id":"","url":"https://api.github.com/users/oliviabarnett","html_url":"https://github.com/oliviabarnett","followers_url":"https://api.github.com/users/oliviabarnett/followers","following_url":"https://api.github.com/users/oliviabarnett/following{/other_user}","gists_url":"https://api.github.com/users/oliviabarnett/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviabarnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviabarnett/subscriptions","organizations_url":"https://api.github.com/users/oliviabarnett/orgs","repos_url":"https://api.github.com/users/oliviabarnett/repos","events_url":"https://api.github.com/users/oliviabarnett/events{/privacy}","received_events_url":"https://api.github.com/users/oliviabarnett/received_events","type":"User","site_admin":false},"repo":{"id":95076467,"name":"actuary","full_name":"oliviabarnett/actuary","owner":{"login":"oliviabarnett","id":17032867,"avatar_url":"https://avatars1.githubusercontent.com/u/17032867?v=3","gravatar_id":"","url":"https://api.github.com/users/oliviabarnett","html_url":"https://github.com/oliviabarnett","followers_url":"https://api.github.com/users/oliviabarnett/followers","following_url":"https://api.github.com/users/oliviabarnett/following{/other_user}","gists_url":"https://api.github.com/users/oliviabarnett/gists{/gist_id}","starred_url":"https://api.github.com/users/oliviabarnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliviabarnett/subscriptions","organizations_url":"https://api.github.com/users/oliviabarnett/orgs","repos_url":"https://api.github.com/users/oliviabarnett/repos","events_url":"https://api.github.com/users/oliviabarnett/events{/privacy}","received_events_url":"https://api.github.com/users/oliviabarnett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/oliviabarnett/actuary","description":"An actuary is a business professional who analyzes the financial consequences of risk. ","fork":true,"url":"https://api.github.com/repos/oliviabarnett/actuary","forks_url":"https://api.github.com/repos/oliviabarnett/actuary/forks","keys_url":"https://api.github.com/repos/oliviabarnett/actuary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/oliviabarnett/actuary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/oliviabarnett/actuary/teams","hooks_url":"https://api.github.com/repos/oliviabarnett/actuary/hooks","issue_events_url":"https://api.github.com/repos/oliviabarnett/actuary/issues/events{/number}","events_url":"https://api.github.com/repos/oliviabarnett/actuary/events","assignees_url":"https://api.github.com/repos/oliviabarnett/actuary/assignees{/user}","branches_url":"https://api.github.com/repos/oliviabarnett/actuary/branches{/branch}","tags_url":"https://api.github.com/repos/oliviabarnett/actuary/tags","blobs_url":"https://api.github.com/repos/oliviabarnett/actuary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/oliviabarnett/actuary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/oliviabarnett/actuary/git/refs{/sha}","trees_url":"https://api.github.com/repos/oliviabarnett/actuary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/oliviabarnett/actuary/statuses/{sha}","languages_url":"https://api.github.com/repos/oliviabarnett/actuary/languages","stargazers_url":"https://api.github.com/repos/oliviabarnett/actuary/stargazers","contributors_url":"https://api.github.com/repos/oliviabarnett/actuary/contributors","subscribers_url":"https://api.github.com/repos/oliviabarnett/actuary/subscribers","subscription_url":"https://api.github.com/repos/oliviabarnett/actuary/subscription","commits_url":"https://api.github.com/repos/oliviabarnett/actuary/commits{/sha}","git_commits_url":"https://api.github.com/repos/oliviabarnett/actuary/git/commits{/sha}","comments_url":"https://api.github.com/repos/oliviabarnett/actuary/comments{/number}","issue_comment_url":"https://api.github.com/repos/oliviabarnett/actuary/issues/comments{/number}","contents_url":"https://api.github.com/repos/oliviabarnett/actuary/contents/{+path}","compare_url":"https://api.github.com/repos/oliviabarnett/actuary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/oliviabarnett/actuary/merges","archive_url":"https://api.github.com/repos/oliviabarnett/actuary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/oliviabarnett/actuary/downloads","issues_url":"https://api.github.com/repos/oliviabarnett/actuary/issues{/number}","pulls_url":"https://api.github.com/repos/oliviabarnett/actuary/pulls{/number}","milestones_url":"https://api.github.com/repos/oliviabarnett/actuary/milestones{/number}","notifications_url":"https://api.github.com/repos/oliviabarnett/actuary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/oliviabarnett/actuary/labels{/name}","releases_url":"https://api.github.com/repos/oliviabarnett/actuary/releases{/id}","deployments_url":"https://api.github.com/repos/oliviabarnett/actuary/deployments","created_at":"2017-06-22T05:03:48Z","updated_at":"2017-06-22T05:03:49Z","pushed_at":"2017-07-03T23:03:49Z","git_url":"git://github.com/oliviabarnett/actuary.git","ssh_url":"git@github.com:oliviabarnett/actuary.git","clone_url":"https://github.com/oliviabarnett/actuary.git","svn_url":"https://github.com/oliviabarnett/actuary","homepage":"","size":11117,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"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":"diogomonica:master","ref":"master","sha":"6006d068560dc5b7288d07d0c42e7a2d6b4d97ee","user":{"login":"diogomonica","id":55332,"avatar_url":"https://avatars1.githubusercontent.com/u/55332?v=3","gravatar_id":"","url":"https://api.github.com/users/diogomonica","html_url":"https://github.com/diogomonica","followers_url":"https://api.github.com/users/diogomonica/followers","following_url":"https://api.github.com/users/diogomonica/following{/other_user}","gists_url":"https://api.github.com/users/diogomonica/gists{/gist_id}","starred_url":"https://api.github.com/users/diogomonica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diogomonica/subscriptions","organizations_url":"https://api.github.com/users/diogomonica/orgs","repos_url":"https://api.github.com/users/diogomonica/repos","events_url":"https://api.github.com/users/diogomonica/events{/privacy}","received_events_url":"https://api.github.com/users/diogomonica/received_events","type":"User","site_admin":false},"repo":{"id":51559459,"name":"actuary","full_name":"diogomonica/actuary","owner":{"login":"diogomonica","id":55332,"avatar_url":"https://avatars1.githubusercontent.com/u/55332?v=3","gravatar_id":"","url":"https://api.github.com/users/diogomonica","html_url":"https://github.com/diogomonica","followers_url":"https://api.github.com/users/diogomonica/followers","following_url":"https://api.github.com/users/diogomonica/following{/other_user}","gists_url":"https://api.github.com/users/diogomonica/gists{/gist_id}","starred_url":"https://api.github.com/users/diogomonica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diogomonica/subscriptions","organizations_url":"https://api.github.com/users/diogomonica/orgs","repos_url":"https://api.github.com/users/diogomonica/repos","events_url":"https://api.github.com/users/diogomonica/events{/privacy}","received_events_url":"https://api.github.com/users/diogomonica/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/diogomonica/actuary","description":"An actuary is a business professional who analyzes the financial consequences of risk. ","fork":false,"url":"https://api.github.com/repos/diogomonica/actuary","forks_url":"https://api.github.com/repos/diogomonica/actuary/forks","keys_url":"https://api.github.com/repos/diogomonica/actuary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diogomonica/actuary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diogomonica/actuary/teams","hooks_url":"https://api.github.com/repos/diogomonica/actuary/hooks","issue_events_url":"https://api.github.com/repos/diogomonica/actuary/issues/events{/number}","events_url":"https://api.github.com/repos/diogomonica/actuary/events","assignees_url":"https://api.github.com/repos/diogomonica/actuary/assignees{/user}","branches_url":"https://api.github.com/repos/diogomonica/actuary/branches{/branch}","tags_url":"https://api.github.com/repos/diogomonica/actuary/tags","blobs_url":"https://api.github.com/repos/diogomonica/actuary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diogomonica/actuary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diogomonica/actuary/git/refs{/sha}","trees_url":"https://api.github.com/repos/diogomonica/actuary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diogomonica/actuary/statuses/{sha}","languages_url":"https://api.github.com/repos/diogomonica/actuary/languages","stargazers_url":"https://api.github.com/repos/diogomonica/actuary/stargazers","contributors_url":"https://api.github.com/repos/diogomonica/actuary/contributors","subscribers_url":"https://api.github.com/repos/diogomonica/actuary/subscribers","subscription_url":"https://api.github.com/repos/diogomonica/actuary/subscription","commits_url":"https://api.github.com/repos/diogomonica/actuary/commits{/sha}","git_commits_url":"https://api.github.com/repos/diogomonica/actuary/git/commits{/sha}","comments_url":"https://api.github.com/repos/diogomonica/actuary/comments{/number}","issue_comment_url":"https://api.github.com/repos/diogomonica/actuary/issues/comments{/number}","contents_url":"https://api.github.com/repos/diogomonica/actuary/contents/{+path}","compare_url":"https://api.github.com/repos/diogomonica/actuary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diogomonica/actuary/merges","archive_url":"https://api.github.com/repos/diogomonica/actuary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diogomonica/actuary/downloads","issues_url":"https://api.github.com/repos/diogomonica/actuary/issues{/number}","pulls_url":"https://api.github.com/repos/diogomonica/actuary/pulls{/number}","milestones_url":"https://api.github.com/repos/diogomonica/actuary/milestones{/number}","notifications_url":"https://api.github.com/repos/diogomonica/actuary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diogomonica/actuary/labels{/name}","releases_url":"https://api.github.com/repos/diogomonica/actuary/releases{/id}","deployments_url":"https://api.github.com/repos/diogomonica/actuary/deployments","created_at":"2016-02-12T01:00:36Z","updated_at":"2017-06-27T13:41:51Z","pushed_at":"2017-07-03T23:41:03Z","git_url":"git://github.com/diogomonica/actuary.git","ssh_url":"git@github.com:diogomonica/actuary.git","clone_url":"https://github.com/diogomonica/actuary.git","svn_url":"https://github.com/diogomonica/actuary","homepage":"","size":7580,"stargazers_count":25,"watchers_count":25,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":6,"forks":3,"open_issues":6,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/diogomonica/actuary/pulls/31"},"html":{"href":"https://github.com/diogomonica/actuary/pull/31"},"issue":{"href":"https://api.github.com/repos/diogomonica/actuary/issues/31"},"comments":{"href":"https://api.github.com/repos/diogomonica/actuary/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/diogomonica/actuary/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/diogomonica/actuary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/diogomonica/actuary/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/diogomonica/actuary/statuses/95212576a08c650ed999dae273397a1a8bfc913b"}}}}
{"actor":{"display_login":"diogomonica"}}