{"action":"created","comment":{"url":"https://api.github.com/repos/weaveworks/scope/pulls/comments/30690758","id":30690758,"diff_hunk":"@@ -0,0 +1,81 @@\n+package main\n+\n+import (\n+\t\"fmt\"\n+\t\"testing\"\n+\t\"time\"\n+\n+\tdocker \"github.com/fsouza/go-dockerclient\"\n+)\n+\n+type mockDockerClient struct {\n+\tcontainers    []docker.APIContainers\n+\tcontainerInfo map[string]*docker.Container\n+}\n+\n+func (m mockDockerClient) ListContainers(options docker.ListContainersOptions) ([]docker.APIContainers, error) {\n+\treturn m.containers, nil\n+}\n+\n+func (m mockDockerClient) InspectContainer(id string) (*docker.Container, error) {\n+\treturn m.containerInfo[id], nil\n+}\n+\n+func TestDockerProcessMapper(t *testing.T) {\n+\toldPidTreeStub, oldDockerClientStub := newPidTreeStub, newDockerClient\n+\tdefer func() {\n+\t\tnewPidTreeStub = oldPidTreeStub\n+\t\tnewDockerClient = oldDockerClientStub\n+\t}()\n+\n+\tnewPidTreeStub = func(procRoot string) (*pidTree, error) {\n+\t\tpid1 := &process{pid: 1}\n+\t\tpid2 := &process{pid: 2, ppid: 1, parent: pid1}\n+\t\tpid1.children = []*process{pid2}\n+\n+\t\treturn &pidTree{\n+\t\t\tprocesses: map[int]*process{\n+\t\t\t\t1: pid1, 2: pid2,\n+\t\t\t},\n+\t\t}, nil\n+\t}\n+\n+\tnewDockerClient = func(endpoint string) (dockerClient, error) {\n+\t\treturn mockDockerClient{\n+\t\t\tcontainers: []docker.APIContainers{{ID: \"foo\"}},\n+\t\t\tcontainerInfo: map[string]*docker.Container{\n+\t\t\t\t\"foo\": {\n+\t\t\t\t\tID:    \"foo\",\n+\t\t\t\t\tName:  \"bar\",\n+\t\t\t\t\tState: docker.State{Pid: 1, Running: true},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t}, nil\n+\t}\n+\n+\tdockerMapper := newDockerMapper(\"/proc\", 10*time.Second)\n+\tdockerIDMapper := dockerIDMapper{dockerMapper}\n+\tdockerNameMapper := dockerNameMapper{dockerMapper}\n+\n+\tfmt.Printf(\"%+v\", dockerMapper)","path":"probe/docker_process_mapper_test.go","position":60,"original_position":60,"commit_id":"21b749cfbc45cecced64634c98abe9cf28a0224b","original_commit_id":"21b749cfbc45cecced64634c98abe9cf28a0224b","user":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"body":"Whoops, that was old code that shouldn't have been committed.","created_at":"2015-05-20T11:10:02Z","updated_at":"2015-05-20T11:10:02Z","html_url":"https://github.com/weaveworks/scope/pull/62#discussion_r30690758","pull_request_url":"https://api.github.com/repos/weaveworks/scope/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/comments/30690758"},"html":{"href":"https://github.com/weaveworks/scope/pull/62#discussion_r30690758"},"pull_request":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/weaveworks/scope/pulls/62","id":35746354,"html_url":"https://github.com/weaveworks/scope/pull/62","diff_url":"https://github.com/weaveworks/scope/pull/62.diff","patch_url":"https://github.com/weaveworks/scope/pull/62.patch","issue_url":"https://api.github.com/repos/weaveworks/scope/issues/62","number":62,"state":"open","locked":false,"title":"A docker process mapper","user":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"body":"Fixes #25 ","created_at":"2015-05-19T16:01:26Z","updated_at":"2015-05-20T11:10:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a3faf03a48e6ad358c48f5e22341e5fb496e74c","assignee":{"login":"peterbourgon","id":114509,"avatar_url":"https://avatars.githubusercontent.com/u/114509?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbourgon","html_url":"https://github.com/peterbourgon","followers_url":"https://api.github.com/users/peterbourgon/followers","following_url":"https://api.github.com/users/peterbourgon/following{/other_user}","gists_url":"https://api.github.com/users/peterbourgon/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbourgon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbourgon/subscriptions","organizations_url":"https://api.github.com/users/peterbourgon/orgs","repos_url":"https://api.github.com/users/peterbourgon/repos","events_url":"https://api.github.com/users/peterbourgon/events{/privacy}","received_events_url":"https://api.github.com/users/peterbourgon/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/weaveworks/scope/pulls/62/commits","review_comments_url":"https://api.github.com/repos/weaveworks/scope/pulls/62/comments","review_comment_url":"https://api.github.com/repos/weaveworks/scope/pulls/comments{/number}","comments_url":"https://api.github.com/repos/weaveworks/scope/issues/62/comments","statuses_url":"https://api.github.com/repos/weaveworks/scope/statuses/21b749cfbc45cecced64634c98abe9cf28a0224b","head":{"label":"tomwilkie:docker-process-mapper","ref":"docker-process-mapper","sha":"21b749cfbc45cecced64634c98abe9cf28a0224b","user":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"repo":{"id":35833485,"name":"scope","full_name":"tomwilkie/scope","owner":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomwilkie/scope","description":"Container visibility","fork":true,"url":"https://api.github.com/repos/tomwilkie/scope","forks_url":"https://api.github.com/repos/tomwilkie/scope/forks","keys_url":"https://api.github.com/repos/tomwilkie/scope/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomwilkie/scope/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomwilkie/scope/teams","hooks_url":"https://api.github.com/repos/tomwilkie/scope/hooks","issue_events_url":"https://api.github.com/repos/tomwilkie/scope/issues/events{/number}","events_url":"https://api.github.com/repos/tomwilkie/scope/events","assignees_url":"https://api.github.com/repos/tomwilkie/scope/assignees{/user}","branches_url":"https://api.github.com/repos/tomwilkie/scope/branches{/branch}","tags_url":"https://api.github.com/repos/tomwilkie/scope/tags","blobs_url":"https://api.github.com/repos/tomwilkie/scope/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomwilkie/scope/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomwilkie/scope/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomwilkie/scope/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomwilkie/scope/statuses/{sha}","languages_url":"https://api.github.com/repos/tomwilkie/scope/languages","stargazers_url":"https://api.github.com/repos/tomwilkie/scope/stargazers","contributors_url":"https://api.github.com/repos/tomwilkie/scope/contributors","subscribers_url":"https://api.github.com/repos/tomwilkie/scope/subscribers","subscription_url":"https://api.github.com/repos/tomwilkie/scope/subscription","commits_url":"https://api.github.com/repos/tomwilkie/scope/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomwilkie/scope/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomwilkie/scope/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomwilkie/scope/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomwilkie/scope/contents/{+path}","compare_url":"https://api.github.com/repos/tomwilkie/scope/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomwilkie/scope/merges","archive_url":"https://api.github.com/repos/tomwilkie/scope/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomwilkie/scope/downloads","issues_url":"https://api.github.com/repos/tomwilkie/scope/issues{/number}","pulls_url":"https://api.github.com/repos/tomwilkie/scope/pulls{/number}","milestones_url":"https://api.github.com/repos/tomwilkie/scope/milestones{/number}","notifications_url":"https://api.github.com/repos/tomwilkie/scope/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomwilkie/scope/labels{/name}","releases_url":"https://api.github.com/repos/tomwilkie/scope/releases{/id}","created_at":"2015-05-18T17:56:13Z","updated_at":"2015-05-18T17:56:14Z","pushed_at":"2015-05-20T10:58:46Z","git_url":"git://github.com/tomwilkie/scope.git","ssh_url":"git@github.com:tomwilkie/scope.git","clone_url":"https://github.com/tomwilkie/scope.git","svn_url":"https://github.com/tomwilkie/scope","homepage":"http://weave.works/scope","size":13872,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"weaveworks:master","ref":"master","sha":"0f53765f1a51720a9feea8ed097575429e956454","user":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"repo":{"id":34659664,"name":"scope","full_name":"weaveworks/scope","owner":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/weaveworks/scope","description":"Container visibility","fork":false,"url":"https://api.github.com/repos/weaveworks/scope","forks_url":"https://api.github.com/repos/weaveworks/scope/forks","keys_url":"https://api.github.com/repos/weaveworks/scope/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weaveworks/scope/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weaveworks/scope/teams","hooks_url":"https://api.github.com/repos/weaveworks/scope/hooks","issue_events_url":"https://api.github.com/repos/weaveworks/scope/issues/events{/number}","events_url":"https://api.github.com/repos/weaveworks/scope/events","assignees_url":"https://api.github.com/repos/weaveworks/scope/assignees{/user}","branches_url":"https://api.github.com/repos/weaveworks/scope/branches{/branch}","tags_url":"https://api.github.com/repos/weaveworks/scope/tags","blobs_url":"https://api.github.com/repos/weaveworks/scope/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weaveworks/scope/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weaveworks/scope/git/refs{/sha}","trees_url":"https://api.github.com/repos/weaveworks/scope/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weaveworks/scope/statuses/{sha}","languages_url":"https://api.github.com/repos/weaveworks/scope/languages","stargazers_url":"https://api.github.com/repos/weaveworks/scope/stargazers","contributors_url":"https://api.github.com/repos/weaveworks/scope/contributors","subscribers_url":"https://api.github.com/repos/weaveworks/scope/subscribers","subscription_url":"https://api.github.com/repos/weaveworks/scope/subscription","commits_url":"https://api.github.com/repos/weaveworks/scope/commits{/sha}","git_commits_url":"https://api.github.com/repos/weaveworks/scope/git/commits{/sha}","comments_url":"https://api.github.com/repos/weaveworks/scope/comments{/number}","issue_comment_url":"https://api.github.com/repos/weaveworks/scope/issues/comments{/number}","contents_url":"https://api.github.com/repos/weaveworks/scope/contents/{+path}","compare_url":"https://api.github.com/repos/weaveworks/scope/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weaveworks/scope/merges","archive_url":"https://api.github.com/repos/weaveworks/scope/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weaveworks/scope/downloads","issues_url":"https://api.github.com/repos/weaveworks/scope/issues{/number}","pulls_url":"https://api.github.com/repos/weaveworks/scope/pulls{/number}","milestones_url":"https://api.github.com/repos/weaveworks/scope/milestones{/number}","notifications_url":"https://api.github.com/repos/weaveworks/scope/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weaveworks/scope/labels{/name}","releases_url":"https://api.github.com/repos/weaveworks/scope/releases{/id}","created_at":"2015-04-27T10:12:35Z","updated_at":"2015-05-20T09:25:59Z","pushed_at":"2015-05-20T10:48:42Z","git_url":"git://github.com/weaveworks/scope.git","ssh_url":"git@github.com:weaveworks/scope.git","clone_url":"https://github.com/weaveworks/scope.git","svn_url":"https://github.com/weaveworks/scope","homepage":"http://weave.works/scope","size":19337,"stargazers_count":262,"watchers_count":262,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":15,"forks":8,"open_issues":15,"watchers":262,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/62"},"html":{"href":"https://github.com/weaveworks/scope/pull/62"},"issue":{"href":"https://api.github.com/repos/weaveworks/scope/issues/62"},"comments":{"href":"https://api.github.com/repos/weaveworks/scope/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/weaveworks/scope/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/weaveworks/scope/statuses/21b749cfbc45cecced64634c98abe9cf28a0224b"}}}}