{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/32342974","id":32342974,"diff_hunk":"@@ -1010,66 +1011,63 @@ func testLoadBalancerNotReachable(ingress api.LoadBalancerIngress, port int) {\n }\n \n func testReachable(ip string, port int) {\n-\tvar err error\n-\tvar resp *http.Response\n-\n \turl := fmt.Sprintf(\"http://%s:%d\", ip, port)\n \tif ip == \"\" {\n-\t\tFailf(\"got empty IP for reachability check\", url)\n+\t\tFailf(\"Got empty IP for reachability check\", url)\n \t}\n \tif port == 0 {\n-\t\tFailf(\"got port==0 for reachability check\", url)\n+\t\tFailf(\"Got port==0 for reachability check\", url)\n \t}\n \n \tBy(fmt.Sprintf(\"Checking reachability of %s\", url))\n-\tfor t := time.Now(); time.Since(t) < podStartTimeout; time.Sleep(5 * time.Second) {\n-\t\tresp, err = httpGetNoConnectionPool(url)\n-\t\tif err == nil {\n-\t\t\tbreak\n+\texpectNoError(wait.Poll(poll, podStartTimeout, func() (bool, error) {\n+\t\tresp, err := httpGetNoConnectionPool(url)\n+\t\tif err != nil {\n+\t\t\tLogf(\"Got error waiting for reachability of %s: %v\", url, err)\n+\t\t\treturn false, nil\n \t\t}\n-\t\tBy(fmt.Sprintf(\"Got error waiting for reachability of %s: %v\", url, err))\n-\t}\n-\tExpect(err).NotTo(HaveOccurred())\n-\tdefer resp.Body.Close()\n-\n-\tbody, err := ioutil.ReadAll(resp.Body)\n-\tExpect(err).NotTo(HaveOccurred())\n-\tif resp.StatusCode != 200 {\n-\t\tFailf(\"received non-success return status %q trying to access %s; got body: %s\", resp.Status, url, string(body))\n-\t}\n-\tif !strings.Contains(string(body), \"test-webserver\") {\n-\t\tFailf(\"received response body without expected substring 'test-webserver': %s\", string(body))\n-\t}\n+\t\tdefer resp.Body.Close()\n+\t\tbody, err := ioutil.ReadAll(resp.Body)\n+\t\tif err != nil {\n+\t\t\tLogf(\"Got error reading response from %s: %v\", url, err)\n+\t\t\treturn false, nil\n+\t\t}\n+\t\tif resp.StatusCode != 200 {\n+\t\t\treturn false, fmt.Errorf(\"received non-success return status %q trying to access %s; got body: %s\", resp.Status, url, string(body))\n+\t\t}\n+\t\tif !strings.Contains(string(body), \"test-webserver\") {\n+\t\t\treturn false, fmt.Errorf(\"received response body without expected substring 'test-webserver': %s\", string(body))\n+\t\t}\n+\t\tLogf(\"Successfully reached %v\", url)\n+\t\treturn true, nil\n+\t}))\n }\n \n func testNotReachable(ip string, port int) {\n-\tvar err error\n-\tvar resp *http.Response\n-\tvar body []byte\n-\n \turl := fmt.Sprintf(\"http://%s:%d\", ip, port)\n \tif ip == \"\" {\n-\t\tFailf(\"got empty IP for non-reachability check\", url)\n+\t\tFailf(\"Got empty IP for non-reachability check\", url)\n \t}\n \tif port == 0 {\n-\t\tFailf(\"got port==0 for non-reachability check\", url)\n+\t\tFailf(\"Got port==0 for non-reachability check\", url)\n \t}\n \n-\tfor t := time.Now(); time.Since(t) < podStartTimeout; time.Sleep(5 * time.Second) {\n-\t\tresp, err = httpGetNoConnectionPool(url)\n+\tBy(fmt.Sprintf(\"Checking that %s is not reachable\", url))\n+\texpectNoError(wait.Poll(poll, podStartTimeout, func() (bool, error) {\n+\t\tresp, err := httpGetNoConnectionPool(url)\n \t\tif err != nil {\n-\t\t\tbreak\n+\t\t\tLogf(\"Expecting %s to be unreachable but is still reachable\", url)\n+\t\t\treturn true, nil\n \t\t}\n-\t\tbody, err = ioutil.ReadAll(resp.Body)\n-\t\tExpect(err).NotTo(HaveOccurred())\n-\t\tresp.Body.Close()\n-\t\tBy(fmt.Sprintf(\"Got success waiting for non-reachability of %s: %v\", url, resp.Status))\n-\t}\n-\tif err == nil {\n-\t\tFailf(\"able to reach service %s when should no longer have been reachable: %q body=%s\", url, resp.Status, string(body))\n-\t}\n-\t// TODO: Check type of error\n-\tBy(fmt.Sprintf(\"Found (expected) error during not-reachability test %v\", err))\n+\t\tdefer resp.Body.Close()\n+\t\tbody, err := ioutil.ReadAll(resp.Body)\n+\t\tif err != nil {\n+\t\t\tLogf(\"Got error reading response from %s: %v\", url, err)","path":"test/e2e/service.go","position":null,"original_position":104,"commit_id":"e44f4b756617ca52463c3a2589cfdb86a784f388","original_commit_id":"9f4a277784aaeaf36d03c5718fa5dca0396ac568","user":{"login":"mbforbes","id":1170062,"avatar_url":"https://avatars.githubusercontent.com/u/1170062?v=3","gravatar_id":"","url":"https://api.github.com/users/mbforbes","html_url":"https://github.com/mbforbes","followers_url":"https://api.github.com/users/mbforbes/followers","following_url":"https://api.github.com/users/mbforbes/following{/other_user}","gists_url":"https://api.github.com/users/mbforbes/gists{/gist_id}","starred_url":"https://api.github.com/users/mbforbes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbforbes/subscriptions","organizations_url":"https://api.github.com/users/mbforbes/orgs","repos_url":"https://api.github.com/users/mbforbes/repos","events_url":"https://api.github.com/users/mbforbes/events{/privacy}","received_events_url":"https://api.github.com/users/mbforbes/received_events","type":"User","site_admin":false},"body":"OK this is going to seem super nit-y, but I think it's important to have \"success\" or \"successfully\" in a string when describing an expected failed something. I think if people see \"The url X is unreachable\", it looks like an error message. If it says \"Successfully found X to be unreachable.\" then it's ultra-clear.\r\n\r\nWe've had some code internally that used this affirmatively-negative logging and it's been really nice when we've had to pour through its output when it's failing.","created_at":"2015-06-12T18:41:49Z","updated_at":"2015-06-12T18:41:49Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9648#discussion_r32342974","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/32342974"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9648#discussion_r32342974"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648","id":37422008,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9648","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9648.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9648.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9648","number":9648,"state":"open","locked":false,"title":"cleanup some of the e2e service reachability code","user":{"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},"body":"@mbforbes Here's some of the cleanup you asked for. Uses wait and removes some of the By()'s that were actually just debug logs.","created_at":"2015-06-11T01:40:59Z","updated_at":"2015-06-12T18:41:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8fc9e2dabdaa27974c01b93866ddb9bce8faf919","assignee":{"login":"mbforbes","id":1170062,"avatar_url":"https://avatars.githubusercontent.com/u/1170062?v=3","gravatar_id":"","url":"https://api.github.com/users/mbforbes","html_url":"https://github.com/mbforbes","followers_url":"https://api.github.com/users/mbforbes/followers","following_url":"https://api.github.com/users/mbforbes/following{/other_user}","gists_url":"https://api.github.com/users/mbforbes/gists{/gist_id}","starred_url":"https://api.github.com/users/mbforbes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbforbes/subscriptions","organizations_url":"https://api.github.com/users/mbforbes/orgs","repos_url":"https://api.github.com/users/mbforbes/repos","events_url":"https://api.github.com/users/mbforbes/events{/privacy}","received_events_url":"https://api.github.com/users/mbforbes/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9648/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/e44f4b756617ca52463c3a2589cfdb86a784f388","head":{"label":"mikedanese:cleanup-service-e2e","ref":"cleanup-service-e2e","sha":"e44f4b756617ca52463c3a2589cfdb86a784f388","user":{"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},"repo":{"id":26203986,"name":"kubernetes","full_name":"mikedanese/kubernetes","owner":{"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},"private":false,"html_url":"https://github.com/mikedanese/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/mikedanese/kubernetes","forks_url":"https://api.github.com/repos/mikedanese/kubernetes/forks","keys_url":"https://api.github.com/repos/mikedanese/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikedanese/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikedanese/kubernetes/teams","hooks_url":"https://api.github.com/repos/mikedanese/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/mikedanese/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/mikedanese/kubernetes/events","assignees_url":"https://api.github.com/repos/mikedanese/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/mikedanese/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/mikedanese/kubernetes/tags","blobs_url":"https://api.github.com/repos/mikedanese/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikedanese/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikedanese/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikedanese/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikedanese/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/mikedanese/kubernetes/languages","stargazers_url":"https://api.github.com/repos/mikedanese/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/mikedanese/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/mikedanese/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/mikedanese/kubernetes/subscription","commits_url":"https://api.github.com/repos/mikedanese/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikedanese/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikedanese/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikedanese/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikedanese/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/mikedanese/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikedanese/kubernetes/merges","archive_url":"https://api.github.com/repos/mikedanese/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikedanese/kubernetes/downloads","issues_url":"https://api.github.com/repos/mikedanese/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/mikedanese/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/mikedanese/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/mikedanese/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikedanese/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/mikedanese/kubernetes/releases{/id}","created_at":"2014-11-05T05:02:25Z","updated_at":"2015-04-15T00:20:12Z","pushed_at":"2015-06-12T18:38:02Z","git_url":"git://github.com/mikedanese/kubernetes.git","ssh_url":"git@github.com:mikedanese/kubernetes.git","clone_url":"https://github.com/mikedanese/kubernetes.git","svn_url":"https://github.com/mikedanese/kubernetes","homepage":null,"size":64184,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"0e3633d40453deff7d69c82c5bd3fcf5214c2a53","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-06-12T18:28:00Z","pushed_at":"2015-06-12T18:38:03Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":278104,"stargazers_count":8364,"watchers_count":8364,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1780,"mirror_url":null,"open_issues_count":1374,"forks":1780,"open_issues":1374,"watchers":8364,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9648"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9648"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9648/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9648/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/e44f4b756617ca52463c3a2589cfdb86a784f388"}}}}