{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/84382076","pull_request_review_id":5159438,"id":84382076,"diff_hunk":"@@ -83,3 +84,87 @@ func newSecretsWithToken(token string) *kubeadmapi.Secrets {\n \ts.GivenToken = token\n \treturn s\n }\n+\n+func TestGenerateToken(t *testing.T) {\n+\tvar genTest = []struct {\n+\t\ts kubeadmapi.Secrets\n+\t\tl int\n+\t\tn int\n+\t}{\n+\t\t{kubeadmapi.Secrets{}, 2, 6},\n+\t}\n+\n+\tfor _, rt := range genTest {\n+\t\tGenerateToken(&rt.s)\n+\t\tgivenToken := strings.Split(strings.ToLower(rt.s.GivenToken), \".\")\n+\t\tif len(givenToken) != rt.l {\n+\t\t\tt.Errorf(\n+\t\t\t\t\"failed GenerateToken:\\n\\texpected: %d\\n\\t  actual: %d\",\n+\t\t\t\trt.l,\n+\t\t\t\tlen(givenToken),\n+\t\t\t)\n+\t\t}\n+\t\tif len(givenToken[0]) != rt.n {\n+\t\t\tt.Errorf(\n+\t\t\t\t\"failed GenerateToken:\\n\\texpected: %d\\n\\t  actual: %d\",\n+\t\t\t\trt.l,\n+\t\t\t\tlen(givenToken),\n+\t\t\t)\n+\t\t}\n+\t}\n+}\n+\n+func TestUseGivenTokenIfValid(t *testing.T) {\n+\tvar tokenTest = []struct {\n+\t\ts        kubeadmapi.Secrets\n+\t\texpected bool\n+\t}{\n+\t\t{kubeadmapi.Secrets{GivenToken: \"\"}, false},         // GivenToken == \"\"\n+\t\t{kubeadmapi.Secrets{GivenToken: \"noperiod\"}, false}, // not 2-part '.' format\n+\t\t{kubeadmapi.Secrets{GivenToken: \"abcd.a\"}, false},   // len(tokenID) != 6\n+\t\t{kubeadmapi.Secrets{GivenToken: \"abcdef.a\"}, true},\n+\t}\n+\n+\tfor _, rt := range tokenTest {","path":"cmd/kubeadm/app/util/tokens_test.go","position":53,"original_position":53,"commit_id":"73361a15cea9cb458b537b48c3bb2f4e0fe23e0a","original_commit_id":"9c6ff8e78cc3100f88063f1dcad3308ef98b70b5","user":{"login":"jbeda","id":37310,"avatar_url":"https://avatars.githubusercontent.com/u/37310?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeda","html_url":"https://github.com/jbeda","followers_url":"https://api.github.com/users/jbeda/followers","following_url":"https://api.github.com/users/jbeda/following{/other_user}","gists_url":"https://api.github.com/users/jbeda/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeda/subscriptions","organizations_url":"https://api.github.com/users/jbeda/orgs","repos_url":"https://api.github.com/users/jbeda/repos","events_url":"https://api.github.com/users/jbeda/events{/privacy}","received_events_url":"https://api.github.com/users/jbeda/received_events","type":"User","site_admin":false},"body":"You should check the error here too.","created_at":"2016-10-20T21:42:43Z","updated_at":"2016-10-20T21:44:52Z","html_url":"https://github.com/kubernetes/kubernetes/pull/35231#discussion_r84382076","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/84382076"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/35231#discussion_r84382076"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231","id":90272932,"html_url":"https://github.com/kubernetes/kubernetes/pull/35231","diff_url":"https://github.com/kubernetes/kubernetes/pull/35231.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/35231.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/35231","number":35231,"state":"open","locked":false,"title":"Kubeadm added unit tests for pkg app/util","user":{"login":"dmmcquay","id":1700422,"avatar_url":"https://avatars.githubusercontent.com/u/1700422?v=3","gravatar_id":"","url":"https://api.github.com/users/dmmcquay","html_url":"https://github.com/dmmcquay","followers_url":"https://api.github.com/users/dmmcquay/followers","following_url":"https://api.github.com/users/dmmcquay/following{/other_user}","gists_url":"https://api.github.com/users/dmmcquay/gists{/gist_id}","starred_url":"https://api.github.com/users/dmmcquay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmmcquay/subscriptions","organizations_url":"https://api.github.com/users/dmmcquay/orgs","repos_url":"https://api.github.com/users/dmmcquay/repos","events_url":"https://api.github.com/users/dmmcquay/events{/privacy}","received_events_url":"https://api.github.com/users/dmmcquay/received_events","type":"User","site_admin":false},"body":"Added unit tests for kubeadm/app/util package testing functionality of tokens.go, error.go, and kubeconfig.go.\r\n\r\nThis PR is part of the ongoing effort to add tests (#35025)\r\n\r\n/cc @pires @jbeda \r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.kubernetes.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/35231)\r\n<!-- Reviewable:end -->","created_at":"2016-10-20T20:15:50Z","updated_at":"2016-10-20T21:44:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8ad60e113a624fa271ec16e168ade684abf72728","assignee":{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars.githubusercontent.com/u/1787169?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false},"assignees":[{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars.githubusercontent.com/u/1787169?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/35231/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/73361a15cea9cb458b537b48c3bb2f4e0fe23e0a","head":{"label":"apprenda:kubeadm-unit-tests-pkg-util","ref":"kubeadm-unit-tests-pkg-util","sha":"73361a15cea9cb458b537b48c3bb2f4e0fe23e0a","user":{"login":"apprenda","id":6901411,"avatar_url":"https://avatars.githubusercontent.com/u/6901411?v=3","gravatar_id":"","url":"https://api.github.com/users/apprenda","html_url":"https://github.com/apprenda","followers_url":"https://api.github.com/users/apprenda/followers","following_url":"https://api.github.com/users/apprenda/following{/other_user}","gists_url":"https://api.github.com/users/apprenda/gists{/gist_id}","starred_url":"https://api.github.com/users/apprenda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apprenda/subscriptions","organizations_url":"https://api.github.com/users/apprenda/orgs","repos_url":"https://api.github.com/users/apprenda/repos","events_url":"https://api.github.com/users/apprenda/events{/privacy}","received_events_url":"https://api.github.com/users/apprenda/received_events","type":"Organization","site_admin":false},"repo":{"id":57914139,"name":"kubernetes","full_name":"apprenda/kubernetes","owner":{"login":"apprenda","id":6901411,"avatar_url":"https://avatars.githubusercontent.com/u/6901411?v=3","gravatar_id":"","url":"https://api.github.com/users/apprenda","html_url":"https://github.com/apprenda","followers_url":"https://api.github.com/users/apprenda/followers","following_url":"https://api.github.com/users/apprenda/following{/other_user}","gists_url":"https://api.github.com/users/apprenda/gists{/gist_id}","starred_url":"https://api.github.com/users/apprenda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apprenda/subscriptions","organizations_url":"https://api.github.com/users/apprenda/orgs","repos_url":"https://api.github.com/users/apprenda/repos","events_url":"https://api.github.com/users/apprenda/events{/privacy}","received_events_url":"https://api.github.com/users/apprenda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apprenda/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/apprenda/kubernetes","forks_url":"https://api.github.com/repos/apprenda/kubernetes/forks","keys_url":"https://api.github.com/repos/apprenda/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apprenda/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apprenda/kubernetes/teams","hooks_url":"https://api.github.com/repos/apprenda/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/apprenda/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/apprenda/kubernetes/events","assignees_url":"https://api.github.com/repos/apprenda/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/apprenda/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/apprenda/kubernetes/tags","blobs_url":"https://api.github.com/repos/apprenda/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apprenda/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apprenda/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/apprenda/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apprenda/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/apprenda/kubernetes/languages","stargazers_url":"https://api.github.com/repos/apprenda/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/apprenda/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/apprenda/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/apprenda/kubernetes/subscription","commits_url":"https://api.github.com/repos/apprenda/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/apprenda/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/apprenda/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/apprenda/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/apprenda/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/apprenda/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apprenda/kubernetes/merges","archive_url":"https://api.github.com/repos/apprenda/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apprenda/kubernetes/downloads","issues_url":"https://api.github.com/repos/apprenda/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/apprenda/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/apprenda/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/apprenda/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apprenda/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/apprenda/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/apprenda/kubernetes/deployments","created_at":"2016-05-02T19:07:17Z","updated_at":"2016-05-02T19:07:32Z","pushed_at":"2016-10-20T21:24:48Z","git_url":"git://github.com/apprenda/kubernetes.git","ssh_url":"git@github.com:apprenda/kubernetes.git","clone_url":"https://github.com/apprenda/kubernetes.git","svn_url":"https://github.com/apprenda/kubernetes","homepage":"http://kubernetes.io","size":350015,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"a9e53ded1cbe6ce000500b7bfd1dd5aec023ece1","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Production-Grade Container Scheduling and Management","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2016-10-20T21:40:35Z","pushed_at":"2016-10-20T21:37:55Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":599110,"stargazers_count":17775,"watchers_count":17775,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5779,"mirror_url":null,"open_issues_count":4979,"forks":5779,"open_issues":4979,"watchers":17775,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/35231"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/35231"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/35231/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35231/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/73361a15cea9cb458b537b48c3bb2f4e0fe23e0a"}}}}
{"actor":{"display_login":"jbeda"}}