{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/29804448","id":29804448,"diff_hunk":"@@ -103,50 +113,171 @@ func podScheduled(c *client.Client, podNamespace, podName string) wait.Condition\n \t}\n }\n \n-func DoTestUnschedulableNodes(t *testing.T, client *client.Client) {\n-\tnode := &api.Node{\n-\t\tObjectMeta: api.ObjectMeta{Name: \"node\"},\n-\t\tSpec:       api.NodeSpec{Unschedulable: true},\n+// Wait till the passFunc confirms that the object it expects to see is in the store.\n+// Used to observe reflected events.\n+func waitForReflection(s cache.Store, key string, passFunc func(n interface{}) bool) error {\n+\treturn wait.Poll(time.Second, time.Second*20, func() (bool, error) {\n+\t\tif n, _, err := s.GetByKey(key); err == nil && passFunc(n) {\n+\t\t\treturn true, nil\n+\t\t}\n+\t\treturn false, nil\n+\t})\n+}\n+\n+func DoTestUnschedulableNodes(t *testing.T, restClient *client.Client, nodeStore cache.Store) {\n+\tgoodCondition := api.NodeCondition{\n+\t\tType:              api.NodeReady,\n+\t\tStatus:            api.ConditionTrue,\n+\t\tReason:            fmt.Sprintf(\"schedulable condition\"),\n+\t\tLastHeartbeatTime: util.Time{time.Now()},\n \t}\n-\tif _, err := client.Nodes().Create(node); err != nil {\n-\t\tt.Fatalf(\"Failed to create node: %v\", err)\n+\tbadCondition := api.NodeCondition{\n+\t\tType:              api.NodeReady,\n+\t\tStatus:            api.ConditionUnknown,\n+\t\tReason:            fmt.Sprintf(\"unschedulable condition\"),\n+\t\tLastHeartbeatTime: util.Time{time.Now()},\n \t}\n-\n-\tpod := &api.Pod{\n-\t\tObjectMeta: api.ObjectMeta{Name: \"my-pod\"},\n-\t\tSpec: api.PodSpec{\n-\t\t\tContainers: []api.Container{{Name: \"container\", Image: \"kubernetes/pause:go\"}},\n+\t// Create a new schedulable node, since we're first going to apply\n+\t// the unschedulable condition and verify that pods aren't scheduled.\n+\tnode := &api.Node{\n+\t\tObjectMeta: api.ObjectMeta{Name: \"node\"},\n+\t\tSpec:       api.NodeSpec{Unschedulable: false},\n+\t\tStatus: api.NodeStatus{\n+\t\t\tConditions: []api.NodeCondition{goodCondition},\n \t\t},\n \t}\n-\tmyPod, err := client.Pods(api.NamespaceDefault).Create(pod)\n+\tnodeKey, err := cache.MetaNamespaceKeyFunc(node)\n \tif err != nil {\n-\t\tt.Fatalf(\"Failed to create pod: %v\", err)\n-\t}\n-\t// There are no schedulable nodes - the pod shouldn't be scheduled.\n-\terr = wait.Poll(time.Second, time.Second*10, podScheduled(client, myPod.Namespace, myPod.Name))\n-\tif err == nil {\n-\t\tt.Errorf(\"Pod scheduled successfully on unschedulable nodes\")\n-\t}\n-\tif err != wait.ErrWaitTimeout {\n-\t\tt.Errorf(\"Failed while waiting for scheduled pod: %v\", err)\n+\t\tt.Fatalf(\"Couldn't retrieve key for node %v\", node.Name)\n \t}\n \n-\t// Make the node schedulable and wait until the pod is scheduled.\n-\tnewNode, err := client.Nodes().Get(node.Name)\n-\tif err != nil {\n-\t\tt.Fatalf(\"Failed to get node: %v\", err)\n-\t}\n-\tnewNode.Spec.Unschedulable = false\n-\tif _, err = client.Nodes().Update(newNode); err != nil {\n-\t\tt.Fatalf(\"Failed to update node: %v\", err)\n-\t}\n-\terr = wait.Poll(time.Second, time.Second*10, podScheduled(client, myPod.Namespace, myPod.Name))\n-\tif err != nil {\n-\t\tt.Errorf(\"Failed to schedule a pod: %v\", err)\n+\t// The test does the following for each nodeStateManager in this list:\n+\t//\t1. Create a new node\n+\t//\t2. Apply the unschedulable function\n+\t//\t3. Create a new pod\n+\t//  4. Check that the pod doesn't get assigned to the node\n+\t//  5. Apply the schedulable function\n+\t//  6. Check that the pod *does* get assigned to the node\n+\t//  7. Delete the pod and node.\n+\n+\tnodeModifications := []nodeStateManager{\n+\t\t// Test node.Spec.Unschedulable=true/false\n+\t\t{\n+\t\t\tunschedulable: func(t *testing.T, n *api.Node, s cache.Store, c *client.Client) {","path":"test/integration/scheduler_test.go","position":null,"original_position":147,"commit_id":"d93f74d26c89560f64930ced220d9ac07edb5b46","original_commit_id":"9c224e6f79ef35652ebf335ec33c36933ad8a7ba","user":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"body":"Changed names","created_at":"2015-05-06T21:31:55Z","updated_at":"2015-05-06T21:31:55Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/7668#discussion_r29804448","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/29804448"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/7668#discussion_r29804448"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668","id":34577562,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/7668","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/7668.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/7668.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/7668","number":7668,"state":"open","locked":false,"title":"Scheduler ignores nodes that are in a bad state","user":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"body":"The scheduler should ignore unhealthy nodes.\r\n\r\nref https://github.com/GoogleCloudPlatform/kubernetes/issues/7222, https://github.com/GoogleCloudPlatform/kubernetes/issues/7561","created_at":"2015-05-02T00:33:45Z","updated_at":"2015-05-06T21:31:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4ba5482e6406451adaf6f4da7852d36aef0f12d","assignee":{"login":"lavalamp","id":647318,"avatar_url":"https://avatars.githubusercontent.com/u/647318?v=3","gravatar_id":"","url":"https://api.github.com/users/lavalamp","html_url":"https://github.com/lavalamp","followers_url":"https://api.github.com/users/lavalamp/followers","following_url":"https://api.github.com/users/lavalamp/following{/other_user}","gists_url":"https://api.github.com/users/lavalamp/gists{/gist_id}","starred_url":"https://api.github.com/users/lavalamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lavalamp/subscriptions","organizations_url":"https://api.github.com/users/lavalamp/orgs","repos_url":"https://api.github.com/users/lavalamp/repos","events_url":"https://api.github.com/users/lavalamp/events{/privacy}","received_events_url":"https://api.github.com/users/lavalamp/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/7668/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/d93f74d26c89560f64930ced220d9ac07edb5b46","head":{"label":"bprashanth:scheduling_minions","ref":"scheduling_minions","sha":"d93f74d26c89560f64930ced220d9ac07edb5b46","user":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"repo":{"id":30552514,"name":"kubernetes","full_name":"bprashanth/kubernetes","owner":{"login":"bprashanth","id":10927820,"avatar_url":"https://avatars.githubusercontent.com/u/10927820?v=3","gravatar_id":"","url":"https://api.github.com/users/bprashanth","html_url":"https://github.com/bprashanth","followers_url":"https://api.github.com/users/bprashanth/followers","following_url":"https://api.github.com/users/bprashanth/following{/other_user}","gists_url":"https://api.github.com/users/bprashanth/gists{/gist_id}","starred_url":"https://api.github.com/users/bprashanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bprashanth/subscriptions","organizations_url":"https://api.github.com/users/bprashanth/orgs","repos_url":"https://api.github.com/users/bprashanth/repos","events_url":"https://api.github.com/users/bprashanth/events{/privacy}","received_events_url":"https://api.github.com/users/bprashanth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bprashanth/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/bprashanth/kubernetes","forks_url":"https://api.github.com/repos/bprashanth/kubernetes/forks","keys_url":"https://api.github.com/repos/bprashanth/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bprashanth/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bprashanth/kubernetes/teams","hooks_url":"https://api.github.com/repos/bprashanth/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/bprashanth/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/bprashanth/kubernetes/events","assignees_url":"https://api.github.com/repos/bprashanth/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/bprashanth/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/bprashanth/kubernetes/tags","blobs_url":"https://api.github.com/repos/bprashanth/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bprashanth/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bprashanth/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/bprashanth/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bprashanth/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/bprashanth/kubernetes/languages","stargazers_url":"https://api.github.com/repos/bprashanth/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/bprashanth/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/bprashanth/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/bprashanth/kubernetes/subscription","commits_url":"https://api.github.com/repos/bprashanth/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/bprashanth/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/bprashanth/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/bprashanth/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/bprashanth/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/bprashanth/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bprashanth/kubernetes/merges","archive_url":"https://api.github.com/repos/bprashanth/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bprashanth/kubernetes/downloads","issues_url":"https://api.github.com/repos/bprashanth/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/bprashanth/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/bprashanth/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/bprashanth/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bprashanth/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/bprashanth/kubernetes/releases{/id}","created_at":"2015-02-09T18:58:38Z","updated_at":"2015-02-09T18:58:42Z","pushed_at":"2015-05-06T21:28:05Z","git_url":"git://github.com/bprashanth/kubernetes.git","ssh_url":"git@github.com:bprashanth/kubernetes.git","clone_url":"https://github.com/bprashanth/kubernetes.git","svn_url":"https://github.com/bprashanth/kubernetes","homepage":"http://kubernetes.io","size":52641,"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":"7ce75689a02aa610bffd1f7a0ee9eba4226f997f","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-05-06T21:29:35Z","pushed_at":"2015-05-06T21:30:31Z","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":221947,"stargazers_count":7515,"watchers_count":7515,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1521,"mirror_url":null,"open_issues_count":1006,"forks":1521,"open_issues":1006,"watchers":7515,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/7668"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/7668"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/7668/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/7668/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/d93f74d26c89560f64930ced220d9ac07edb5b46"}}}}