{"action":"created","comment":{"url":"https://api.github.com/repos/containerd/cri/pulls/comments/174382439","pull_request_review_id":103725309,"id":174382439,"diff_hunk":"@@ -0,0 +1,150 @@\n+/*\n+Copyright 2018 The Kubernetes Authors.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package server\n+\n+import (\n+\t\"testing\"\n+\t\"time\"\n+\n+\teventtypes \"github.com/containerd/containerd/api/events\"\n+\t\"github.com/stretchr/testify/assert\"\n+)\n+\n+// TestBackOff tests the logic of backOff struct.\n+func TestBackOff(t *testing.T) {\n+\tinputQueues := map[string]backOffQueue{\n+\t\t\"container1\": {\n+\t\t\tevents: []interface{}{\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container1\", ID: \"1\"},\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container1\", ID: \"2\"},\n+\t\t\t},\n+\t\t},\n+\t\t\"container2\": {\n+\t\t\tevents: []interface{}{\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container2\", ID: \"1\"},\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container2\", ID: \"2\"},\n+\t\t\t},\n+\t\t},\n+\t}\n+\texpectedQueues := map[string]backOffQueue{\n+\t\t\"container2\": {\n+\t\t\tevents: []interface{}{\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container2\", ID: \"1\"},\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container2\", ID: \"2\"},\n+\t\t\t},\n+\t\t},\n+\t\t\"container1\": {\n+\t\t\tevents: []interface{}{\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container1\", ID: \"1\"},\n+\t\t\t\t&eventtypes.TaskExit{ContainerID: \"container1\", ID: \"2\"},\n+\t\t\t},\n+\t\t},\n+\t}\n+\n+\tt.Logf(\"Should can backOff a event\")","path":"pkg/server/events_test.go","position":58,"original_position":58,"commit_id":"5e2e5cb5f0d7a83e6a48442a33488b176da1b162","original_commit_id":"5e2e5cb5f0d7a83e6a48442a33488b176da1b162","user":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars3.githubusercontent.com/u/5821883?v=4","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"body":"s/can/be able to\r\n\r\nAnd also for following ones.","created_at":"2018-03-14T08:30:51Z","updated_at":"2018-03-14T08:44:45Z","html_url":"https://github.com/containerd/cri/pull/628#discussion_r174382439","pull_request_url":"https://api.github.com/repos/containerd/cri/pulls/628","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/containerd/cri/pulls/comments/174382439"},"html":{"href":"https://github.com/containerd/cri/pull/628#discussion_r174382439"},"pull_request":{"href":"https://api.github.com/repos/containerd/cri/pulls/628"}}},"pull_request":{"url":"https://api.github.com/repos/containerd/cri/pulls/628","id":171956956,"html_url":"https://github.com/containerd/cri/pull/628","diff_url":"https://github.com/containerd/cri/pull/628.diff","patch_url":"https://github.com/containerd/cri/pull/628.patch","issue_url":"https://api.github.com/repos/containerd/cri/issues/628","number":628,"state":"open","locked":false,"title":"Handle containerd event reliably","user":{"login":"yanxuean","id":25762709,"avatar_url":"https://avatars0.githubusercontent.com/u/25762709?v=4","gravatar_id":"","url":"https://api.github.com/users/yanxuean","html_url":"https://github.com/yanxuean","followers_url":"https://api.github.com/users/yanxuean/followers","following_url":"https://api.github.com/users/yanxuean/following{/other_user}","gists_url":"https://api.github.com/users/yanxuean/gists{/gist_id}","starred_url":"https://api.github.com/users/yanxuean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanxuean/subscriptions","organizations_url":"https://api.github.com/users/yanxuean/orgs","repos_url":"https://api.github.com/users/yanxuean/repos","events_url":"https://api.github.com/users/yanxuean/events{/privacy}","received_events_url":"https://api.github.com/users/yanxuean/received_events","type":"User","site_admin":false},"body":"fix #434 \r\nSigned-off-by: yanxuean <yan.xuean@zte.com.cn>","created_at":"2018-02-28T13:45:02Z","updated_at":"2018-03-14T08:44:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b34ee94da9a93f8b0d0f30e989407ff0845c290","assignee":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars3.githubusercontent.com/u/5821883?v=4","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"assignees":[{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars3.githubusercontent.com/u/5821883?v=4","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":678438430,"url":"https://api.github.com/repos/containerd/cri/labels/size/L","name":"size/L","color":"ededed","default":false}],"milestone":{"url":"https://api.github.com/repos/containerd/cri/milestones/8","html_url":"https://github.com/containerd/cri/milestone/8","labels_url":"https://api.github.com/repos/containerd/cri/milestones/8/labels","id":2975273,"number":8,"title":"v1.0.0-rc.0","description":"","creator":{"login":"Random-Liu","id":5821883,"avatar_url":"https://avatars3.githubusercontent.com/u/5821883?v=4","gravatar_id":"","url":"https://api.github.com/users/Random-Liu","html_url":"https://github.com/Random-Liu","followers_url":"https://api.github.com/users/Random-Liu/followers","following_url":"https://api.github.com/users/Random-Liu/following{/other_user}","gists_url":"https://api.github.com/users/Random-Liu/gists{/gist_id}","starred_url":"https://api.github.com/users/Random-Liu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Random-Liu/subscriptions","organizations_url":"https://api.github.com/users/Random-Liu/orgs","repos_url":"https://api.github.com/users/Random-Liu/repos","events_url":"https://api.github.com/users/Random-Liu/events{/privacy}","received_events_url":"https://api.github.com/users/Random-Liu/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":47,"state":"open","created_at":"2017-12-12T19:44:34Z","updated_at":"2018-03-14T06:00:12Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/containerd/cri/pulls/628/commits","review_comments_url":"https://api.github.com/repos/containerd/cri/pulls/628/comments","review_comment_url":"https://api.github.com/repos/containerd/cri/pulls/comments{/number}","comments_url":"https://api.github.com/repos/containerd/cri/issues/628/comments","statuses_url":"https://api.github.com/repos/containerd/cri/statuses/5e2e5cb5f0d7a83e6a48442a33488b176da1b162","head":{"label":"yanxuean:nits","ref":"nits","sha":"5e2e5cb5f0d7a83e6a48442a33488b176da1b162","user":{"login":"yanxuean","id":25762709,"avatar_url":"https://avatars0.githubusercontent.com/u/25762709?v=4","gravatar_id":"","url":"https://api.github.com/users/yanxuean","html_url":"https://github.com/yanxuean","followers_url":"https://api.github.com/users/yanxuean/followers","following_url":"https://api.github.com/users/yanxuean/following{/other_user}","gists_url":"https://api.github.com/users/yanxuean/gists{/gist_id}","starred_url":"https://api.github.com/users/yanxuean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanxuean/subscriptions","organizations_url":"https://api.github.com/users/yanxuean/orgs","repos_url":"https://api.github.com/users/yanxuean/repos","events_url":"https://api.github.com/users/yanxuean/events{/privacy}","received_events_url":"https://api.github.com/users/yanxuean/received_events","type":"User","site_admin":false},"repo":{"id":98880926,"name":"cri-containerd","full_name":"yanxuean/cri-containerd","owner":{"login":"yanxuean","id":25762709,"avatar_url":"https://avatars0.githubusercontent.com/u/25762709?v=4","gravatar_id":"","url":"https://api.github.com/users/yanxuean","html_url":"https://github.com/yanxuean","followers_url":"https://api.github.com/users/yanxuean/followers","following_url":"https://api.github.com/users/yanxuean/following{/other_user}","gists_url":"https://api.github.com/users/yanxuean/gists{/gist_id}","starred_url":"https://api.github.com/users/yanxuean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanxuean/subscriptions","organizations_url":"https://api.github.com/users/yanxuean/orgs","repos_url":"https://api.github.com/users/yanxuean/repos","events_url":"https://api.github.com/users/yanxuean/events{/privacy}","received_events_url":"https://api.github.com/users/yanxuean/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yanxuean/cri-containerd","description":"Containerd-based implementation of Kubernetes Container Runtime Interface","fork":true,"url":"https://api.github.com/repos/yanxuean/cri-containerd","forks_url":"https://api.github.com/repos/yanxuean/cri-containerd/forks","keys_url":"https://api.github.com/repos/yanxuean/cri-containerd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yanxuean/cri-containerd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yanxuean/cri-containerd/teams","hooks_url":"https://api.github.com/repos/yanxuean/cri-containerd/hooks","issue_events_url":"https://api.github.com/repos/yanxuean/cri-containerd/issues/events{/number}","events_url":"https://api.github.com/repos/yanxuean/cri-containerd/events","assignees_url":"https://api.github.com/repos/yanxuean/cri-containerd/assignees{/user}","branches_url":"https://api.github.com/repos/yanxuean/cri-containerd/branches{/branch}","tags_url":"https://api.github.com/repos/yanxuean/cri-containerd/tags","blobs_url":"https://api.github.com/repos/yanxuean/cri-containerd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yanxuean/cri-containerd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yanxuean/cri-containerd/git/refs{/sha}","trees_url":"https://api.github.com/repos/yanxuean/cri-containerd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yanxuean/cri-containerd/statuses/{sha}","languages_url":"https://api.github.com/repos/yanxuean/cri-containerd/languages","stargazers_url":"https://api.github.com/repos/yanxuean/cri-containerd/stargazers","contributors_url":"https://api.github.com/repos/yanxuean/cri-containerd/contributors","subscribers_url":"https://api.github.com/repos/yanxuean/cri-containerd/subscribers","subscription_url":"https://api.github.com/repos/yanxuean/cri-containerd/subscription","commits_url":"https://api.github.com/repos/yanxuean/cri-containerd/commits{/sha}","git_commits_url":"https://api.github.com/repos/yanxuean/cri-containerd/git/commits{/sha}","comments_url":"https://api.github.com/repos/yanxuean/cri-containerd/comments{/number}","issue_comment_url":"https://api.github.com/repos/yanxuean/cri-containerd/issues/comments{/number}","contents_url":"https://api.github.com/repos/yanxuean/cri-containerd/contents/{+path}","compare_url":"https://api.github.com/repos/yanxuean/cri-containerd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yanxuean/cri-containerd/merges","archive_url":"https://api.github.com/repos/yanxuean/cri-containerd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yanxuean/cri-containerd/downloads","issues_url":"https://api.github.com/repos/yanxuean/cri-containerd/issues{/number}","pulls_url":"https://api.github.com/repos/yanxuean/cri-containerd/pulls{/number}","milestones_url":"https://api.github.com/repos/yanxuean/cri-containerd/milestones{/number}","notifications_url":"https://api.github.com/repos/yanxuean/cri-containerd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yanxuean/cri-containerd/labels{/name}","releases_url":"https://api.github.com/repos/yanxuean/cri-containerd/releases{/id}","deployments_url":"https://api.github.com/repos/yanxuean/cri-containerd/deployments","created_at":"2017-07-31T11:20:19Z","updated_at":"2017-08-04T08:20:51Z","pushed_at":"2018-03-10T06:43:11Z","git_url":"git://github.com/yanxuean/cri-containerd.git","ssh_url":"git@github.com:yanxuean/cri-containerd.git","clone_url":"https://github.com/yanxuean/cri-containerd.git","svn_url":"https://github.com/yanxuean/cri-containerd","homepage":"","size":7818,"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,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"containerd:master","ref":"master","sha":"80b2f751d34b657a94658385757e73addb7fa510","user":{"login":"containerd","id":14037953,"avatar_url":"https://avatars1.githubusercontent.com/u/14037953?v=4","gravatar_id":"","url":"https://api.github.com/users/containerd","html_url":"https://github.com/containerd","followers_url":"https://api.github.com/users/containerd/followers","following_url":"https://api.github.com/users/containerd/following{/other_user}","gists_url":"https://api.github.com/users/containerd/gists{/gist_id}","starred_url":"https://api.github.com/users/containerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containerd/subscriptions","organizations_url":"https://api.github.com/users/containerd/orgs","repos_url":"https://api.github.com/users/containerd/repos","events_url":"https://api.github.com/users/containerd/events{/privacy}","received_events_url":"https://api.github.com/users/containerd/received_events","type":"Organization","site_admin":false},"repo":{"id":88211060,"name":"cri","full_name":"containerd/cri","owner":{"login":"containerd","id":14037953,"avatar_url":"https://avatars1.githubusercontent.com/u/14037953?v=4","gravatar_id":"","url":"https://api.github.com/users/containerd","html_url":"https://github.com/containerd","followers_url":"https://api.github.com/users/containerd/followers","following_url":"https://api.github.com/users/containerd/following{/other_user}","gists_url":"https://api.github.com/users/containerd/gists{/gist_id}","starred_url":"https://api.github.com/users/containerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/containerd/subscriptions","organizations_url":"https://api.github.com/users/containerd/orgs","repos_url":"https://api.github.com/users/containerd/repos","events_url":"https://api.github.com/users/containerd/events{/privacy}","received_events_url":"https://api.github.com/users/containerd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/containerd/cri","description":"Containerd-based implementation of Kubernetes Container Runtime Interface","fork":false,"url":"https://api.github.com/repos/containerd/cri","forks_url":"https://api.github.com/repos/containerd/cri/forks","keys_url":"https://api.github.com/repos/containerd/cri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/containerd/cri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/containerd/cri/teams","hooks_url":"https://api.github.com/repos/containerd/cri/hooks","issue_events_url":"https://api.github.com/repos/containerd/cri/issues/events{/number}","events_url":"https://api.github.com/repos/containerd/cri/events","assignees_url":"https://api.github.com/repos/containerd/cri/assignees{/user}","branches_url":"https://api.github.com/repos/containerd/cri/branches{/branch}","tags_url":"https://api.github.com/repos/containerd/cri/tags","blobs_url":"https://api.github.com/repos/containerd/cri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/containerd/cri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/containerd/cri/git/refs{/sha}","trees_url":"https://api.github.com/repos/containerd/cri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/containerd/cri/statuses/{sha}","languages_url":"https://api.github.com/repos/containerd/cri/languages","stargazers_url":"https://api.github.com/repos/containerd/cri/stargazers","contributors_url":"https://api.github.com/repos/containerd/cri/contributors","subscribers_url":"https://api.github.com/repos/containerd/cri/subscribers","subscription_url":"https://api.github.com/repos/containerd/cri/subscription","commits_url":"https://api.github.com/repos/containerd/cri/commits{/sha}","git_commits_url":"https://api.github.com/repos/containerd/cri/git/commits{/sha}","comments_url":"https://api.github.com/repos/containerd/cri/comments{/number}","issue_comment_url":"https://api.github.com/repos/containerd/cri/issues/comments{/number}","contents_url":"https://api.github.com/repos/containerd/cri/contents/{+path}","compare_url":"https://api.github.com/repos/containerd/cri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/containerd/cri/merges","archive_url":"https://api.github.com/repos/containerd/cri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/containerd/cri/downloads","issues_url":"https://api.github.com/repos/containerd/cri/issues{/number}","pulls_url":"https://api.github.com/repos/containerd/cri/pulls{/number}","milestones_url":"https://api.github.com/repos/containerd/cri/milestones{/number}","notifications_url":"https://api.github.com/repos/containerd/cri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/containerd/cri/labels{/name}","releases_url":"https://api.github.com/repos/containerd/cri/releases{/id}","deployments_url":"https://api.github.com/repos/containerd/cri/deployments","created_at":"2017-04-13T22:20:24Z","updated_at":"2018-03-14T00:51:53Z","pushed_at":"2018-03-14T05:05:21Z","git_url":"git://github.com/containerd/cri.git","ssh_url":"git@github.com:containerd/cri.git","clone_url":"https://github.com/containerd/cri.git","svn_url":"https://github.com/containerd/cri","homepage":"","size":7873,"stargazers_count":234,"watchers_count":234,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":70,"mirror_url":null,"archived":false,"open_issues_count":62,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":70,"open_issues":62,"watchers":234,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/containerd/cri/pulls/628"},"html":{"href":"https://github.com/containerd/cri/pull/628"},"issue":{"href":"https://api.github.com/repos/containerd/cri/issues/628"},"comments":{"href":"https://api.github.com/repos/containerd/cri/issues/628/comments"},"review_comments":{"href":"https://api.github.com/repos/containerd/cri/pulls/628/comments"},"review_comment":{"href":"https://api.github.com/repos/containerd/cri/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/containerd/cri/pulls/628/commits"},"statuses":{"href":"https://api.github.com/repos/containerd/cri/statuses/5e2e5cb5f0d7a83e6a48442a33488b176da1b162"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"Random-Liu"}}