{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin/pulls/comments/38866013","id":38866013,"diff_hunk":"@@ -0,0 +1,266 @@\n+package images\n+\n+import (\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"os\"\n+\t\"strings\"\n+\t\"time\"\n+\n+\tg \"github.com/onsi/ginkgo\"\n+\to \"github.com/onsi/gomega\"\n+\n+\texutil \"github.com/openshift/origin/test/extended/util\"\n+\tkapi \"k8s.io/kubernetes/pkg/api\"\n+\t\"k8s.io/kubernetes/pkg/labels\"\n+\t\"k8s.io/kubernetes/pkg/util/wait\"\n+)\n+\n+func selector(selector string) labels.Selector {\n+\tret, err := labels.Parse(selector)\n+\tif err != nil {\n+\t\tg.Fail(fmt.Sprintf(\"Couldn't parse selector %v: %v\", selector, err))\n+\t}\n+\treturn ret\n+}\n+\n+// getPods looks up pods with \"oc get\" applying a label selector and returns\n+// names of matching pods\n+func getPods(oc *exutil.CLI, label labels.Selector) (pods []string, err error) {\n+\tpodList, err := oc.KubeREST().Pods(oc.Namespace()).List(label, nil)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tfor _, pod := range podList.Items {\n+\t\tif pod.Status.Phase == kapi.PodRunning {\n+\t\t\tpods = append(pods, pod.Name)\n+\t\t}\n+\t}\n+\treturn pods, nil\n+}\n+\n+// pollForPods will call getPods in a loop until the required number of pods\n+// is returned\n+func pollForPods(oc *exutil.CLI, label labels.Selector, count int, timeout time.Duration) ([]string, error) {\n+\tvar pods []string\n+\terr := wait.Poll(1*time.Second, timeout, func() (bool, error) {\n+\t\tp, e := getPods(oc, label)\n+\t\tif e != nil {\n+\t\t\treturn true, e\n+\t\t}\n+\t\tif len(p) < count {\n+\t\t\treturn false, nil\n+\t\t}\n+\t\tpods = p\n+\t\treturn true, nil\n+\t})\n+\treturn pods, err\n+}\n+\n+type mysql struct {\n+\toc      *exutil.CLI\n+\tPodName string\n+\tEnv     map[string]string\n+}\n+\n+func NewMysql(oc *exutil.CLI, podName, service string) (*mysql, error) {\n+\tmysql := &mysql{\n+\t\toc:      oc,\n+\t\tPodName: podName,\n+\t}\n+\n+\tpod, err := oc.KubeREST().Pods(oc.Namespace()).Get(podName)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\tmysql.Env = make(map[string]string, len(pod.Spec.Containers[0].Env))\n+\tfor _, env := range pod.Spec.Containers[0].Env {\n+\t\tmysql.Env[env.Name] = env.Value\n+\t}\n+\treturn mysql, nil\n+}\n+\n+// WaitForMySQL pings the MySQL server\n+func (m *mysql) WaitForMySQL() (bool, error) {\n+\tout, err := m.oc.ExecWithoutExit(m.PodName, \"mysqladmin -h \"+\"127.0.0.1\"+\" -u\"+\"root\"+\" ping\").Output()","path":"test/extended/images/mysql_replica.go","position":85,"original_position":85,"commit_id":"9d5c1976f3be8e3b7725d37e6a1cc0d17f73da83","original_commit_id":"9d5c1976f3be8e3b7725d37e6a1cc0d17f73da83","user":{"login":"mfojtik","id":44136,"avatar_url":"https://avatars.githubusercontent.com/u/44136?v=3","gravatar_id":"","url":"https://api.github.com/users/mfojtik","html_url":"https://github.com/mfojtik","followers_url":"https://api.github.com/users/mfojtik/followers","following_url":"https://api.github.com/users/mfojtik/following{/other_user}","gists_url":"https://api.github.com/users/mfojtik/gists{/gist_id}","starred_url":"https://api.github.com/users/mfojtik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfojtik/subscriptions","organizations_url":"https://api.github.com/users/mfojtik/orgs","repos_url":"https://api.github.com/users/mfojtik/repos","events_url":"https://api.github.com/users/mfojtik/events{/privacy}","received_events_url":"https://api.github.com/users/mfojtik/received_events","type":"User","site_admin":false},"body":"yeah","created_at":"2015-09-07T14:30:32Z","updated_at":"2015-09-07T14:30:32Z","html_url":"https://github.com/openshift/origin/pull/4377#discussion_r38866013","pull_request_url":"https://api.github.com/repos/openshift/origin/pulls/4377","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments/38866013"},"html":{"href":"https://github.com/openshift/origin/pull/4377#discussion_r38866013"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin/pulls/4377"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin/pulls/4377","id":43403518,"html_url":"https://github.com/openshift/origin/pull/4377","diff_url":"https://github.com/openshift/origin/pull/4377.diff","patch_url":"https://github.com/openshift/origin/pull/4377.patch","issue_url":"https://api.github.com/repos/openshift/origin/issues/4377","number":4377,"state":"open","locked":false,"title":"WIP: Mysql replication extended tests","user":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"body":"Adding extended tests for MySQL replication extended tests. Heavy WIP. Will need to move some functionality from the test to a separate helper file. @mfojtik PTAL.\r\n\r\n@rhcarvalho happy :christmas_tree:","created_at":"2015-08-26T13:47:57Z","updated_at":"2015-09-07T14:30:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba5632153b4d1c648d6d7e9489589ec2e3b7cc83","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin/pulls/4377/commits","review_comments_url":"https://api.github.com/repos/openshift/origin/pulls/4377/comments","review_comment_url":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin/issues/4377/comments","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/9d5c1976f3be8e3b7725d37e6a1cc0d17f73da83","head":{"label":"mnagy:mysql_extended_tests","ref":"mysql_extended_tests","sha":"9d5c1976f3be8e3b7725d37e6a1cc0d17f73da83","user":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"repo":{"id":29465939,"name":"origin","full_name":"mnagy/origin","owner":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mnagy/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":true,"url":"https://api.github.com/repos/mnagy/origin","forks_url":"https://api.github.com/repos/mnagy/origin/forks","keys_url":"https://api.github.com/repos/mnagy/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mnagy/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mnagy/origin/teams","hooks_url":"https://api.github.com/repos/mnagy/origin/hooks","issue_events_url":"https://api.github.com/repos/mnagy/origin/issues/events{/number}","events_url":"https://api.github.com/repos/mnagy/origin/events","assignees_url":"https://api.github.com/repos/mnagy/origin/assignees{/user}","branches_url":"https://api.github.com/repos/mnagy/origin/branches{/branch}","tags_url":"https://api.github.com/repos/mnagy/origin/tags","blobs_url":"https://api.github.com/repos/mnagy/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mnagy/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mnagy/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/mnagy/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mnagy/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/mnagy/origin/languages","stargazers_url":"https://api.github.com/repos/mnagy/origin/stargazers","contributors_url":"https://api.github.com/repos/mnagy/origin/contributors","subscribers_url":"https://api.github.com/repos/mnagy/origin/subscribers","subscription_url":"https://api.github.com/repos/mnagy/origin/subscription","commits_url":"https://api.github.com/repos/mnagy/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/mnagy/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/mnagy/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/mnagy/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/mnagy/origin/contents/{+path}","compare_url":"https://api.github.com/repos/mnagy/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mnagy/origin/merges","archive_url":"https://api.github.com/repos/mnagy/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mnagy/origin/downloads","issues_url":"https://api.github.com/repos/mnagy/origin/issues{/number}","pulls_url":"https://api.github.com/repos/mnagy/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/mnagy/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/mnagy/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mnagy/origin/labels{/name}","releases_url":"https://api.github.com/repos/mnagy/origin/releases{/id}","created_at":"2015-01-19T10:37:11Z","updated_at":"2015-03-16T12:28:35Z","pushed_at":"2015-09-07T11:38:31Z","git_url":"git://github.com/mnagy/origin.git","ssh_url":"git@github.com:mnagy/origin.git","clone_url":"https://github.com/mnagy/origin.git","svn_url":"https://github.com/mnagy/origin","homepage":"https://openshift.github.io","size":134963,"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":"openshift:master","ref":"master","sha":"11321c4c08d4b97553b1855c5c9f2f95e64e689b","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":22442668,"name":"origin","full_name":"openshift/origin","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin","description":"OpenShift 3 - build, deploy, and manage your applications with Docker and Kubernetes","fork":false,"url":"https://api.github.com/repos/openshift/origin","forks_url":"https://api.github.com/repos/openshift/origin/forks","keys_url":"https://api.github.com/repos/openshift/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin/teams","hooks_url":"https://api.github.com/repos/openshift/origin/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin/events","assignees_url":"https://api.github.com/repos/openshift/origin/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin/tags","blobs_url":"https://api.github.com/repos/openshift/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin/languages","stargazers_url":"https://api.github.com/repos/openshift/origin/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin/subscription","commits_url":"https://api.github.com/repos/openshift/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin/merges","archive_url":"https://api.github.com/repos/openshift/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin/downloads","issues_url":"https://api.github.com/repos/openshift/origin/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin/releases{/id}","created_at":"2014-07-30T20:04:05Z","updated_at":"2015-09-06T23:16:44Z","pushed_at":"2015-09-07T12:31:58Z","git_url":"git://github.com/openshift/origin.git","ssh_url":"git@github.com:openshift/origin.git","clone_url":"https://github.com/openshift/origin.git","svn_url":"https://github.com/openshift/origin","homepage":"http://www.openshift.org","size":216688,"stargazers_count":667,"watchers_count":667,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":388,"mirror_url":null,"open_issues_count":568,"forks":388,"open_issues":568,"watchers":667,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin/pulls/4377"},"html":{"href":"https://github.com/openshift/origin/pull/4377"},"issue":{"href":"https://api.github.com/repos/openshift/origin/issues/4377"},"comments":{"href":"https://api.github.com/repos/openshift/origin/issues/4377/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin/pulls/4377/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin/pulls/4377/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin/statuses/9d5c1976f3be8e3b7725d37e6a1cc0d17f73da83"}}}}