{"action":"created","comment":{"url":"https://api.github.com/repos/docker/notary/pulls/comments/34932409","id":34932409,"diff_hunk":"@@ -135,6 +135,52 @@ func TestRemoveCertX509FileStore(t *testing.T) {\n \t}\n }\n \n+func TestRemoveAllX509FileStore(t *testing.T) {\n+\ttempDir, err := ioutil.TempDir(\"\", \"cert-test\")\n+\tif err != nil {\n+\t\tt.Fatal(err)\n+\t}\n+\n+\t// Add three certificates to store\n+\tstore, _ := NewX509FileStore(tempDir)\n+\tcertFiles := [3]string{\"../fixtures/root-ca.crt\",\n+\t\t\"../fixtures/intermediate-ca.crt\",\n+\t\t\"../fixtures/secure.example.com.crt\"}\n+\tfor _, file := range certFiles {\n+\t\tb, err := ioutil.ReadFile(file)\n+\t\tif err != nil {\n+\t\t\tt.Fatalf(\"couldn't load fixture: %v\", err)\n+\t\t}\n+\t\tvar block *pem.Block\n+\t\tblock, _ = pem.Decode(b)\n+\n+\t\tcert, err := x509.ParseCertificate(block.Bytes)\n+\t\tif err != nil {\n+\t\t\tt.Fatalf(\"couldn't parse certificate: %v\", err)\n+\t\t}\n+\t\terr = store.AddCert(cert)\n+\t\tif err != nil {\n+\t\t\tt.Fatalf(\"failed to load certificate: %v\", err)\n+\t\t}\n+\t}\n+\n+\t// Number of certificates should be 1 since we added the cert\n+\tnumCerts := len(store.GetCertificates())\n+\tif numCerts != 3 {\n+\t\tt.Fatalf(\"unexpected number of certificates in store: %d\", numCerts)\n+\t}\n+\n+\t// Remove the cert from the store\n+\terr = store.RemoveAll()\n+\tif err != nil {\n+\t\tt.Fatalf(\"failed to remove all certificates: %v\", err)\n+\t}\n+\t// Number of certificates should be 0 since we added and removed the cert\n+\tnumCerts = len(store.GetCertificates())\n+\tif numCerts != 0 {\n+\t\tt.Fatalf(\"unexpected number of certificates in store: %d\", numCerts)\n+\t}","path":"trustmanager/x509filestore_test.go","position":48,"original_position":48,"commit_id":"0cb3fdc7c3e73d62bbf8dc67a5f4b4dd3ca51b82","original_commit_id":"820734b7a5a286880a66f14dd1026515ecbb54df","user":{"login":"diogomonica","id":55332,"avatar_url":"https://avatars.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":"Let's port that later","created_at":"2015-07-17T21:24:45Z","updated_at":"2015-07-17T21:24:45Z","html_url":"https://github.com/docker/notary/pull/65#discussion_r34932409","pull_request_url":"https://api.github.com/repos/docker/notary/pulls/65","_links":{"self":{"href":"https://api.github.com/repos/docker/notary/pulls/comments/34932409"},"html":{"href":"https://github.com/docker/notary/pull/65#discussion_r34932409"},"pull_request":{"href":"https://api.github.com/repos/docker/notary/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/docker/notary/pulls/65","id":40084846,"html_url":"https://github.com/docker/notary/pull/65","diff_url":"https://github.com/docker/notary/pull/65.diff","patch_url":"https://github.com/docker/notary/pull/65.patch","issue_url":"https://api.github.com/repos/docker/notary/issues/65","number":65,"state":"open","locked":false,"title":"Adding the not yummy kind of tofu","user":{"login":"diogomonica","id":55332,"avatar_url":"https://avatars.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":"WIP - don't merge.","created_at":"2015-07-16T00:45:32Z","updated_at":"2015-07-17T21:24:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad2542ec7976552513ce5905bf58473fbfb20ed2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/notary/pulls/65/commits","review_comments_url":"https://api.github.com/repos/docker/notary/pulls/65/comments","review_comment_url":"https://api.github.com/repos/docker/notary/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/notary/issues/65/comments","statuses_url":"https://api.github.com/repos/docker/notary/statuses/0cb3fdc7c3e73d62bbf8dc67a5f4b4dd3ca51b82","head":{"label":"docker:adding-the-not-yummy-kind-of-tofu","ref":"adding-the-not-yummy-kind-of-tofu","sha":"0cb3fdc7c3e73d62bbf8dc67a5f4b4dd3ca51b82","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":37743436,"name":"notary","full_name":"docker/notary","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/notary","description":"","fork":false,"url":"https://api.github.com/repos/docker/notary","forks_url":"https://api.github.com/repos/docker/notary/forks","keys_url":"https://api.github.com/repos/docker/notary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/notary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/notary/teams","hooks_url":"https://api.github.com/repos/docker/notary/hooks","issue_events_url":"https://api.github.com/repos/docker/notary/issues/events{/number}","events_url":"https://api.github.com/repos/docker/notary/events","assignees_url":"https://api.github.com/repos/docker/notary/assignees{/user}","branches_url":"https://api.github.com/repos/docker/notary/branches{/branch}","tags_url":"https://api.github.com/repos/docker/notary/tags","blobs_url":"https://api.github.com/repos/docker/notary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/notary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/notary/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/notary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/notary/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/notary/languages","stargazers_url":"https://api.github.com/repos/docker/notary/stargazers","contributors_url":"https://api.github.com/repos/docker/notary/contributors","subscribers_url":"https://api.github.com/repos/docker/notary/subscribers","subscription_url":"https://api.github.com/repos/docker/notary/subscription","commits_url":"https://api.github.com/repos/docker/notary/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/notary/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/notary/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/notary/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/notary/contents/{+path}","compare_url":"https://api.github.com/repos/docker/notary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/notary/merges","archive_url":"https://api.github.com/repos/docker/notary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/notary/downloads","issues_url":"https://api.github.com/repos/docker/notary/issues{/number}","pulls_url":"https://api.github.com/repos/docker/notary/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/notary/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/notary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/notary/labels{/name}","releases_url":"https://api.github.com/repos/docker/notary/releases{/id}","created_at":"2015-06-19T20:07:53Z","updated_at":"2015-07-17T11:07:34Z","pushed_at":"2015-07-17T21:23:59Z","git_url":"git://github.com/docker/notary.git","ssh_url":"git@github.com:docker/notary.git","clone_url":"https://github.com/docker/notary.git","svn_url":"https://github.com/docker/notary","homepage":null,"size":20363,"stargazers_count":310,"watchers_count":310,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":20,"forks":22,"open_issues":20,"watchers":310,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"1a5ad474f3bfe55d3c194cbf0e7b634d71dd1451","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":37743436,"name":"notary","full_name":"docker/notary","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/notary","description":"","fork":false,"url":"https://api.github.com/repos/docker/notary","forks_url":"https://api.github.com/repos/docker/notary/forks","keys_url":"https://api.github.com/repos/docker/notary/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/notary/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/notary/teams","hooks_url":"https://api.github.com/repos/docker/notary/hooks","issue_events_url":"https://api.github.com/repos/docker/notary/issues/events{/number}","events_url":"https://api.github.com/repos/docker/notary/events","assignees_url":"https://api.github.com/repos/docker/notary/assignees{/user}","branches_url":"https://api.github.com/repos/docker/notary/branches{/branch}","tags_url":"https://api.github.com/repos/docker/notary/tags","blobs_url":"https://api.github.com/repos/docker/notary/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/notary/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/notary/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/notary/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/notary/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/notary/languages","stargazers_url":"https://api.github.com/repos/docker/notary/stargazers","contributors_url":"https://api.github.com/repos/docker/notary/contributors","subscribers_url":"https://api.github.com/repos/docker/notary/subscribers","subscription_url":"https://api.github.com/repos/docker/notary/subscription","commits_url":"https://api.github.com/repos/docker/notary/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/notary/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/notary/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/notary/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/notary/contents/{+path}","compare_url":"https://api.github.com/repos/docker/notary/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/notary/merges","archive_url":"https://api.github.com/repos/docker/notary/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/notary/downloads","issues_url":"https://api.github.com/repos/docker/notary/issues{/number}","pulls_url":"https://api.github.com/repos/docker/notary/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/notary/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/notary/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/notary/labels{/name}","releases_url":"https://api.github.com/repos/docker/notary/releases{/id}","created_at":"2015-06-19T20:07:53Z","updated_at":"2015-07-17T11:07:34Z","pushed_at":"2015-07-17T21:23:59Z","git_url":"git://github.com/docker/notary.git","ssh_url":"git@github.com:docker/notary.git","clone_url":"https://github.com/docker/notary.git","svn_url":"https://github.com/docker/notary","homepage":null,"size":20363,"stargazers_count":310,"watchers_count":310,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":20,"forks":22,"open_issues":20,"watchers":310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/notary/pulls/65"},"html":{"href":"https://github.com/docker/notary/pull/65"},"issue":{"href":"https://api.github.com/repos/docker/notary/issues/65"},"comments":{"href":"https://api.github.com/repos/docker/notary/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/notary/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/notary/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/notary/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/docker/notary/statuses/0cb3fdc7c3e73d62bbf8dc67a5f4b4dd3ca51b82"}}}}