{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/31846206","id":31846206,"diff_hunk":"@@ -179,6 +220,163 @@ func TestValidateExtraHosts(t *testing.T) {\n \t}\n }\n \n+func TestValidateAttach(t *testing.T) {\n+\tvalid := []string{\n+\t\t\"stdin\",\n+\t\t\"stdout\",\n+\t\t\"stderr\",\n+\t}\n+\tif _, err := ValidateAttach(\"invalid\"); err == nil {\n+\t\tt.Fatalf(\"Expected error with [valid streams are STDIN, STDOUT and STDERR], got nothing\")\n+\t}\n+\n+\tfor _, attach := range valid {\n+\t\tvalue, err := ValidateAttach(attach)\n+\t\tif err != nil {\n+\t\t\tt.Fatal(err)\n+\t\t}\n+\t\tif value != attach {\n+\t\t\tt.Fatalf(\"Expected [%v], got [%v]\", attach, value)\n+\t\t}\n+\t}\n+}\n+\n+func TestValidateLink(t *testing.T) {\n+\tvalid := []string{\n+\t\t\"name\",\n+\t\t\"dcdfbe62ecd0:alias\",\n+\t\t\"7a67485460b7642516a4ad82ecefe7f57d0c4916f530561b71a50a3f9c4e33da\",\n+\t\t\"angry_torvalds:linus\",\n+\t}\n+\tinvalid := map[string]string{\n+\t\t\"\":               \"empty string specified for links\",\n+\t\t\"too:much:of:it\": \"bad format for links: too:much:of:it\",\n+\t}\n+\n+\tfor _, link := range valid {\n+\t\tif _, err := ValidateLink(link); err != nil {\n+\t\t\tt.Fatalf(\"ValidateLink(`%q`) should succeed: erro %v\", link, err)\n+\t\t}\n+\t}\n+\n+\tfor link, expectedError := range invalid {\n+\t\tif _, err := ValidateLink(link); err == nil {\n+\t\t\tt.Fatalf(\"ValidateLink(`%q`) should have failed validation\", link)\n+\t\t} else {\n+\t\t\tif !strings.Contains(err.Error(), expectedError) {\n+\t\t\t\tt.Fatalf(\"ValidateLink(`%q`) error should contain %q\", link, expectedError)\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n+func TestValidatePath(t *testing.T) {\n+\tvalid := []string{\n+\t\t\"/home\",\n+\t\t\"/home:/home\",\n+\t\t\"/home:/something/else\",\n+\t\t\"/with space\",\n+\t\t\"/home:/with space\",\n+\t\t\":/test\", // FIXME should probably fail\n+\t}\n+\tinvalid := map[string]string{\n+\t\t\"\":        \" is not an absolute path\",\n+\t\t\"./\":      \"./ is not an absolute path\",\n+\t\t\"../\":     \"../ is not an absolute path\",\n+\t\t\"/:../\":   \"../ is not an absolute path\",\n+\t\t\"/:path\":  \"path is not an absolute path\",\n+\t\t\":\":       \" is not an absolute path\",\n+\t\t\"/tmp:\":   \" is not an absolute path\",\n+\t\t\":test\":   \"test is not an absolute path\",\n+\t\t\"tmp:\":    \" is not an absolute path\",\n+\t\t\":test:\":  \"test: is not an absolute path\",","path":"opts/opts_test.go","position":148,"original_position":148,"commit_id":"3ee81b8cbd1341f7b9de66a9edc4376c23f6bc23","original_commit_id":"3ee81b8cbd1341f7b9de66a9edc4376c23f6bc23","user":{"login":"duglin","id":1944671,"avatar_url":"https://avatars.githubusercontent.com/u/1944671?v=3","gravatar_id":"","url":"https://api.github.com/users/duglin","html_url":"https://github.com/duglin","followers_url":"https://api.github.com/users/duglin/followers","following_url":"https://api.github.com/users/duglin/following{/other_user}","gists_url":"https://api.github.com/users/duglin/gists{/gist_id}","starred_url":"https://api.github.com/users/duglin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duglin/subscriptions","organizations_url":"https://api.github.com/users/duglin/orgs","repos_url":"https://api.github.com/users/duglin/repos","events_url":"https://api.github.com/users/duglin/events{/privacy}","received_events_url":"https://api.github.com/users/duglin/received_events","type":"User","site_admin":false},"body":"just to be anal, since there are other edits you need to make, let's add `::` to the list.","created_at":"2015-06-05T19:58:00Z","updated_at":"2015-06-05T19:58:00Z","html_url":"https://github.com/docker/docker/pull/13694#discussion_r31846206","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/13694","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/31846206"},"html":{"href":"https://github.com/docker/docker/pull/13694#discussion_r31846206"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/13694"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/13694","id":36805388,"html_url":"https://github.com/docker/docker/pull/13694","diff_url":"https://github.com/docker/docker/pull/13694.diff","patch_url":"https://github.com/docker/docker/pull/13694.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/13694","number":13694,"state":"open","locked":false,"title":"Add test coverage to opts","user":{"login":"vdemeester","id":6508,"avatar_url":"https://avatars.githubusercontent.com/u/6508?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemeester","html_url":"https://github.com/vdemeester","followers_url":"https://api.github.com/users/vdemeester/followers","following_url":"https://api.github.com/users/vdemeester/following{/other_user}","gists_url":"https://api.github.com/users/vdemeester/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemeester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemeester/subscriptions","organizations_url":"https://api.github.com/users/vdemeester/orgs","repos_url":"https://api.github.com/users/vdemeester/repos","events_url":"https://api.github.com/users/vdemeester/events{/privacy}","received_events_url":"https://api.github.com/users/vdemeester/received_events","type":"User","site_admin":false},"body":"This is the time for ``opts`` to get covered 🐸.\r\n\r\nThere is a few ``FIXME`` in this one :\r\n- ``ValidatePath(\":/test\")`` is valid, although it will fail after I think\r\n- `` func ValidateEnv(val string) (string, error)`` always returns ``nil`` for error. I guess it's for *coherence of returns* with the other validate method, so I think I can remove my ``FIXME`` comment.\r\n- There is ``FIXMEs`` for ``ListOpts.GetAll()`` and ``ListOpts.GetMap`` asking if we can remove it. They are used in ``runconfig/parse.go`` ; ``GetMap`` could/should probably have another name but..\r\n\r\n```bash\r\n# before\r\n+ go test -test.timeout=30m github.com/docker/docker/opts\r\nPASS\r\ncoverage: 33.8% of statements\r\n#after\r\n+ go test -test.timeout=30m github.com/docker/docker/opts\r\nPASS\r\ncoverage: 93.2% of statements\r\n```\r\n\r\nSigned-off-by: Vincent Demeester <vincent@sbr.pm>","created_at":"2015-06-03T07:34:43Z","updated_at":"2015-06-05T19:58:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6bb928ef258434e988ecb0671a45bf5d085ffa8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/docker/pulls/13694/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/13694/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/13694/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/3ee81b8cbd1341f7b9de66a9edc4376c23f6bc23","head":{"label":"vdemeester:opts-test-coverage","ref":"opts-test-coverage","sha":"3ee81b8cbd1341f7b9de66a9edc4376c23f6bc23","user":{"login":"vdemeester","id":6508,"avatar_url":"https://avatars.githubusercontent.com/u/6508?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemeester","html_url":"https://github.com/vdemeester","followers_url":"https://api.github.com/users/vdemeester/followers","following_url":"https://api.github.com/users/vdemeester/following{/other_user}","gists_url":"https://api.github.com/users/vdemeester/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemeester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemeester/subscriptions","organizations_url":"https://api.github.com/users/vdemeester/orgs","repos_url":"https://api.github.com/users/vdemeester/repos","events_url":"https://api.github.com/users/vdemeester/events{/privacy}","received_events_url":"https://api.github.com/users/vdemeester/received_events","type":"User","site_admin":false},"repo":{"id":32953007,"name":"docker","full_name":"vdemeester/docker","owner":{"login":"vdemeester","id":6508,"avatar_url":"https://avatars.githubusercontent.com/u/6508?v=3","gravatar_id":"","url":"https://api.github.com/users/vdemeester","html_url":"https://github.com/vdemeester","followers_url":"https://api.github.com/users/vdemeester/followers","following_url":"https://api.github.com/users/vdemeester/following{/other_user}","gists_url":"https://api.github.com/users/vdemeester/gists{/gist_id}","starred_url":"https://api.github.com/users/vdemeester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdemeester/subscriptions","organizations_url":"https://api.github.com/users/vdemeester/orgs","repos_url":"https://api.github.com/users/vdemeester/repos","events_url":"https://api.github.com/users/vdemeester/events{/privacy}","received_events_url":"https://api.github.com/users/vdemeester/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vdemeester/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/vdemeester/docker","forks_url":"https://api.github.com/repos/vdemeester/docker/forks","keys_url":"https://api.github.com/repos/vdemeester/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vdemeester/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vdemeester/docker/teams","hooks_url":"https://api.github.com/repos/vdemeester/docker/hooks","issue_events_url":"https://api.github.com/repos/vdemeester/docker/issues/events{/number}","events_url":"https://api.github.com/repos/vdemeester/docker/events","assignees_url":"https://api.github.com/repos/vdemeester/docker/assignees{/user}","branches_url":"https://api.github.com/repos/vdemeester/docker/branches{/branch}","tags_url":"https://api.github.com/repos/vdemeester/docker/tags","blobs_url":"https://api.github.com/repos/vdemeester/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vdemeester/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vdemeester/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/vdemeester/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vdemeester/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/vdemeester/docker/languages","stargazers_url":"https://api.github.com/repos/vdemeester/docker/stargazers","contributors_url":"https://api.github.com/repos/vdemeester/docker/contributors","subscribers_url":"https://api.github.com/repos/vdemeester/docker/subscribers","subscription_url":"https://api.github.com/repos/vdemeester/docker/subscription","commits_url":"https://api.github.com/repos/vdemeester/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/vdemeester/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/vdemeester/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/vdemeester/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/vdemeester/docker/contents/{+path}","compare_url":"https://api.github.com/repos/vdemeester/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vdemeester/docker/merges","archive_url":"https://api.github.com/repos/vdemeester/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vdemeester/docker/downloads","issues_url":"https://api.github.com/repos/vdemeester/docker/issues{/number}","pulls_url":"https://api.github.com/repos/vdemeester/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/vdemeester/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/vdemeester/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vdemeester/docker/labels{/name}","releases_url":"https://api.github.com/repos/vdemeester/docker/releases{/id}","created_at":"2015-03-26T21:32:15Z","updated_at":"2015-05-08T12:20:26Z","pushed_at":"2015-06-05T19:25:21Z","git_url":"git://github.com/vdemeester/docker.git","ssh_url":"git@github.com:vdemeester/docker.git","clone_url":"https://github.com/vdemeester/docker.git","svn_url":"https://github.com/vdemeester/docker","homepage":"http://www.docker.com","size":56834,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"docker:master","ref":"master","sha":"cd1a1ee9729f76789194a5b5f6dcbc7fa7282420","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","created_at":"2013-01-18T18:10:57Z","updated_at":"2015-06-05T19:17:33Z","pushed_at":"2015-06-05T19:53:11Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":209330,"stargazers_count":22183,"watchers_count":22183,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5297,"mirror_url":null,"open_issues_count":1032,"forks":5297,"open_issues":1032,"watchers":22183,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/13694"},"html":{"href":"https://github.com/docker/docker/pull/13694"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/13694"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/13694/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/13694/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/13694/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/3ee81b8cbd1341f7b9de66a9edc4376c23f6bc23"}}}}