{"action":"created","comment":{"url":"https://api.github.com/repos/juju/juju/pulls/comments/189158507","pull_request_review_id":121283588,"id":189158507,"diff_hunk":"@@ -92,10 +92,147 @@ func (s *StatusSuite) TestMultipleRelationsInYamlFormat(c *gc.C) {\n }\n \n func (s *StatusSuite) TestMultipleRelationsInTabularFormat(c *gc.C) {\n+\ts.assertMultipleRelationsBetweenApplications(c)\n \tcontext := s.run(c, \"status\", \"--relations\")\n \tc.Assert(cmdtesting.Stdout(context), jc.Contains, `\n Relation provider      Requirer                   Interface  Type         Message\n wordpress:juju-info    logging:info               juju-info  subordinate  joining  \n wordpress:logging-dir  logging:logging-directory  logging    subordinate  joining  \n `[1:])\n }\n+\n+func (s *StatusSuite) assertServeralUnitsOnAMachines(c *gc.C) {\n+\t// Application A will have a unit on the same machine is a unit of an application B.\n+\tapplicationA := s.Factory.MakeApplication(c, &factory.ApplicationParams{\n+\t\tCharm: s.Factory.MakeCharm(c, &factory.CharmParams{\n+\t\t\tName:     \"mysql\",\n+\t\t\tRevision: \"1\",\n+\t\t}),\n+\t})\n+\n+\t// Application B will have a unit on the same machine as a unit of an application A.\n+\tapplicationB := s.Factory.MakeApplication(c, &factory.ApplicationParams{\n+\t\tCharm: s.Factory.MakeCharm(c, &factory.CharmParams{\n+\t\t\tName:     \"wordpress\",\n+\t\t\tRevision: \"3\",\n+\t\t}),\n+\t})\n+\n+\t// Put a unit from each, application A and B, on the same machine.\n+\tmachine1 := s.Factory.MakeMachine(c, &factory.MachineParams{\n+\t\tJobs:       []state.MachineJob{state.JobHostUnits},\n+\t\tInstanceId: instance.Id(\"id0\"),\n+\t})\n+\ts.Factory.MakeUnit(c, &factory.UnitParams{\n+\t\tApplication: applicationA,\n+\t\tMachine:     machine1,\n+\t})\n+\ts.Factory.MakeUnit(c, &factory.UnitParams{\n+\t\tApplication: applicationB,\n+\t\tMachine:     machine1,\n+\t})\n+\n+}\n+\n+func (s *StatusSuite) TestStatusWhenFilteringByMachine(c *gc.C) {\n+\ts.assertServeralUnitsOnAMachines(c)\n+\n+\t// Put a unit from the application C on a different machine.\n+\tmachine := s.Factory.MakeMachine(c, &factory.MachineParams{\n+\t\tJobs:       []state.MachineJob{state.JobHostUnits},\n+\t\tInstanceId: instance.Id(\"id1\"),\n+\t})\n+\tapplication := s.Factory.MakeApplication(c, &factory.ApplicationParams{\n+\t\tName: \"another\",\n+\t\tCharm: s.Factory.MakeCharm(c, &factory.CharmParams{\n+\t\t\tName:     \"mysql\",\n+\t\t\tRevision: \"5\",\n+\t\t}),\n+\t})\n+\ts.Factory.MakeUnit(c, &factory.UnitParams{\n+\t\tApplication: application,\n+\t\tMachine:     machine,\n+\t})\n+\n+\tcontext := s.run(c, \"status\")\n+\tc.Assert(cmdtesting.Stdout(context), jc.Contains, `\n+App        Version  Status   Scale  Charm      Store       Rev  OS      Notes\n+another             waiting    0/1  mysql      jujucharms    5  ubuntu  \n+mysql               waiting    0/1  mysql      jujucharms    1  ubuntu  \n+wordpress           waiting    0/1  wordpress  jujucharms    3  ubuntu  \n+\n+Unit         Workload  Agent       Machine  Public address  Ports  Message\n+another/0    waiting   allocating  1                               waiting for machine\n+mysql/0      waiting   allocating  0                               waiting for machine\n+wordpress/0  waiting   allocating  0                               waiting for machine\n+\n+Machine  State    DNS  Inst id  Series   AZ  Message\n+0        pending       id0      quantal      \n+1        pending       id1      quantal      \n+`)\n+\n+\tcontext = s.run(c, \"status\", \"0\")\n+\tc.Assert(cmdtesting.Stdout(context), jc.Contains, `\n+App        Version  Status   Scale  Charm      Store       Rev  OS      Notes\n+mysql               waiting    0/1  mysql      jujucharms    1  ubuntu  \n+wordpress           waiting    0/1  wordpress  jujucharms    3  ubuntu  \n+\n+Unit         Workload  Agent       Machine  Public address  Ports  Message\n+mysql/0      waiting   allocating  0                               waiting for machine\n+wordpress/0  waiting   allocating  0                               waiting for machine\n+\n+Machine  State    DNS  Inst id  Series   AZ  Message\n+0        pending       id0      quantal      \n+`)\n+}\n+\n+func (s *StatusSuite) TestStatusFilteringByMachineIDMatchesExactly(c *gc.C) {\n+\ts.assertServeralUnitsOnAMachines(c)\n+\n+\tapplication := s.Factory.MakeApplication(c, &factory.ApplicationParams{\n+\t\tName:  \"another\",\n+\t\tCharm: s.Factory.MakeCharm(c, &factory.CharmParams{Name: \"mysql\"}),\n+\t})\n+\n+\t// Put a unit from an application on the 1st machine.\n+\tmachine1 := s.Factory.MakeMachine(c, &factory.MachineParams{\n+\t\tJobs:       []state.MachineJob{state.JobHostUnits},\n+\t\tInstanceId: instance.Id(\"id1\"),\n+\t})\n+\ts.Factory.MakeUnit(c, &factory.UnitParams{\n+\t\tApplication: application,\n+\t\tMachine:     machine1,\n+\t})\n+\n+\t// Burn machine numbers until we reach 10.\n+\n+\t// Since machine 0 and 1 were created beforehand, we just need to\n+\t// create 7 machines here.\n+\tfor i := 0; i < 8; i++ {\n+\t\ts.Factory.MakeMachine(c, &factory.MachineParams{\n+\t\t\tJobs: []state.MachineJob{state.JobHostUnits},\n+\t\t})\n+\t}\n+\n+\t// Put a unit from an application on the 10th machine.\n+\tmachine10 := s.Factory.MakeMachine(c, &factory.MachineParams{\n+\t\tJobs:       []state.MachineJob{state.JobHostUnits},\n+\t\tInstanceId: instance.Id(\"id10\"),\n+\t})\n+\n+\ts.Factory.MakeUnit(c, &factory.UnitParams{\n+\t\tApplication: application,\n+\t\tMachine:     machine10,\n+\t})\n+\tcontext := s.run(c, \"status\", \"1\")","path":"featuretests/cmd_juju_status_test.go","position":163,"original_position":163,"commit_id":"531d4f78180f0d668e475a500d29ff51d1947eeb","original_commit_id":"531d4f78180f0d668e475a500d29ff51d1947eeb","user":{"login":"wallyworld","id":5808968,"avatar_url":"https://avatars3.githubusercontent.com/u/5808968?v=4","gravatar_id":"","url":"https://api.github.com/users/wallyworld","html_url":"https://github.com/wallyworld","followers_url":"https://api.github.com/users/wallyworld/followers","following_url":"https://api.github.com/users/wallyworld/following{/other_user}","gists_url":"https://api.github.com/users/wallyworld/gists{/gist_id}","starred_url":"https://api.github.com/users/wallyworld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wallyworld/subscriptions","organizations_url":"https://api.github.com/users/wallyworld/orgs","repos_url":"https://api.github.com/users/wallyworld/repos","events_url":"https://api.github.com/users/wallyworld/events{/privacy}","received_events_url":"https://api.github.com/users/wallyworld/received_events","type":"User","site_admin":false},"body":"Just to ensure and check there really is a machine 10, can we also run an check that \"status 10\" works as expected. Otherwise the test could pass by mistake.","created_at":"2018-05-18T04:02:12Z","updated_at":"2018-05-18T04:02:36Z","html_url":"https://github.com/juju/juju/pull/8724#discussion_r189158507","pull_request_url":"https://api.github.com/repos/juju/juju/pulls/8724","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/juju/juju/pulls/comments/189158507"},"html":{"href":"https://github.com/juju/juju/pull/8724#discussion_r189158507"},"pull_request":{"href":"https://api.github.com/repos/juju/juju/pulls/8724"}}},"pull_request":{"url":"https://api.github.com/repos/juju/juju/pulls/8724","id":188914298,"html_url":"https://github.com/juju/juju/pull/8724","diff_url":"https://github.com/juju/juju/pull/8724.diff","patch_url":"https://github.com/juju/juju/pull/8724.patch","issue_url":"https://api.github.com/repos/juju/juju/issues/8724","number":8724,"state":"open","locked":false,"title":"Status machine filter tests.","user":{"login":"anastasiamac","id":9034160,"avatar_url":"https://avatars0.githubusercontent.com/u/9034160?v=4","gravatar_id":"","url":"https://api.github.com/users/anastasiamac","html_url":"https://github.com/anastasiamac","followers_url":"https://api.github.com/users/anastasiamac/followers","following_url":"https://api.github.com/users/anastasiamac/following{/other_user}","gists_url":"https://api.github.com/users/anastasiamac/gists{/gist_id}","starred_url":"https://api.github.com/users/anastasiamac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anastasiamac/subscriptions","organizations_url":"https://api.github.com/users/anastasiamac/orgs","repos_url":"https://api.github.com/users/anastasiamac/repos","events_url":"https://api.github.com/users/anastasiamac/events{/privacy}","received_events_url":"https://api.github.com/users/anastasiamac/received_events","type":"User","site_admin":false},"body":"## Description of change\r\n\r\nThere are outdated bugs around status and its ability to filter by machine id.\r\n\r\nThis PR proposes tests to ensure that the functionality was delivered, is functioning as expected and that we do not regress in the future. \r\n\r\nThese tests ensure that:\r\n* we can filter by machine id to see units, and hence, applications that are relevant to this machine;\r\n* we filter on machine id exactly, i.e. searching for machine \"1\" does not also return anything related to machine \"10\".\r\n\r\n## Bug reference\r\n\r\nhttps://bugs.launchpad.net/juju/+bug/1748915\r\nhttps://bugs.launchpad.net/juju/+bug/1584170\r\n","created_at":"2018-05-18T03:39:49Z","updated_at":"2018-05-18T04:02:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df2500103504e517bc16ca65be487ac40f5af3ac","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/juju/juju/pulls/8724/commits","review_comments_url":"https://api.github.com/repos/juju/juju/pulls/8724/comments","review_comment_url":"https://api.github.com/repos/juju/juju/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juju/juju/issues/8724/comments","statuses_url":"https://api.github.com/repos/juju/juju/statuses/531d4f78180f0d668e475a500d29ff51d1947eeb","head":{"label":"anastasiamac:status-machine-filter-tests-23","ref":"status-machine-filter-tests-23","sha":"531d4f78180f0d668e475a500d29ff51d1947eeb","user":{"login":"anastasiamac","id":9034160,"avatar_url":"https://avatars0.githubusercontent.com/u/9034160?v=4","gravatar_id":"","url":"https://api.github.com/users/anastasiamac","html_url":"https://github.com/anastasiamac","followers_url":"https://api.github.com/users/anastasiamac/followers","following_url":"https://api.github.com/users/anastasiamac/following{/other_user}","gists_url":"https://api.github.com/users/anastasiamac/gists{/gist_id}","starred_url":"https://api.github.com/users/anastasiamac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anastasiamac/subscriptions","organizations_url":"https://api.github.com/users/anastasiamac/orgs","repos_url":"https://api.github.com/users/anastasiamac/repos","events_url":"https://api.github.com/users/anastasiamac/events{/privacy}","received_events_url":"https://api.github.com/users/anastasiamac/received_events","type":"User","site_admin":false},"repo":{"id":24841340,"name":"juju","full_name":"anastasiamac/juju","owner":{"login":"anastasiamac","id":9034160,"avatar_url":"https://avatars0.githubusercontent.com/u/9034160?v=4","gravatar_id":"","url":"https://api.github.com/users/anastasiamac","html_url":"https://github.com/anastasiamac","followers_url":"https://api.github.com/users/anastasiamac/followers","following_url":"https://api.github.com/users/anastasiamac/following{/other_user}","gists_url":"https://api.github.com/users/anastasiamac/gists{/gist_id}","starred_url":"https://api.github.com/users/anastasiamac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anastasiamac/subscriptions","organizations_url":"https://api.github.com/users/anastasiamac/orgs","repos_url":"https://api.github.com/users/anastasiamac/repos","events_url":"https://api.github.com/users/anastasiamac/events{/privacy}","received_events_url":"https://api.github.com/users/anastasiamac/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anastasiamac/juju","description":"juju is devops distilled","fork":true,"url":"https://api.github.com/repos/anastasiamac/juju","forks_url":"https://api.github.com/repos/anastasiamac/juju/forks","keys_url":"https://api.github.com/repos/anastasiamac/juju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anastasiamac/juju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anastasiamac/juju/teams","hooks_url":"https://api.github.com/repos/anastasiamac/juju/hooks","issue_events_url":"https://api.github.com/repos/anastasiamac/juju/issues/events{/number}","events_url":"https://api.github.com/repos/anastasiamac/juju/events","assignees_url":"https://api.github.com/repos/anastasiamac/juju/assignees{/user}","branches_url":"https://api.github.com/repos/anastasiamac/juju/branches{/branch}","tags_url":"https://api.github.com/repos/anastasiamac/juju/tags","blobs_url":"https://api.github.com/repos/anastasiamac/juju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anastasiamac/juju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anastasiamac/juju/git/refs{/sha}","trees_url":"https://api.github.com/repos/anastasiamac/juju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anastasiamac/juju/statuses/{sha}","languages_url":"https://api.github.com/repos/anastasiamac/juju/languages","stargazers_url":"https://api.github.com/repos/anastasiamac/juju/stargazers","contributors_url":"https://api.github.com/repos/anastasiamac/juju/contributors","subscribers_url":"https://api.github.com/repos/anastasiamac/juju/subscribers","subscription_url":"https://api.github.com/repos/anastasiamac/juju/subscription","commits_url":"https://api.github.com/repos/anastasiamac/juju/commits{/sha}","git_commits_url":"https://api.github.com/repos/anastasiamac/juju/git/commits{/sha}","comments_url":"https://api.github.com/repos/anastasiamac/juju/comments{/number}","issue_comment_url":"https://api.github.com/repos/anastasiamac/juju/issues/comments{/number}","contents_url":"https://api.github.com/repos/anastasiamac/juju/contents/{+path}","compare_url":"https://api.github.com/repos/anastasiamac/juju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anastasiamac/juju/merges","archive_url":"https://api.github.com/repos/anastasiamac/juju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anastasiamac/juju/downloads","issues_url":"https://api.github.com/repos/anastasiamac/juju/issues{/number}","pulls_url":"https://api.github.com/repos/anastasiamac/juju/pulls{/number}","milestones_url":"https://api.github.com/repos/anastasiamac/juju/milestones{/number}","notifications_url":"https://api.github.com/repos/anastasiamac/juju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anastasiamac/juju/labels{/name}","releases_url":"https://api.github.com/repos/anastasiamac/juju/releases{/id}","deployments_url":"https://api.github.com/repos/anastasiamac/juju/deployments","created_at":"2014-10-06T10:12:53Z","updated_at":"2016-01-13T06:23:49Z","pushed_at":"2018-05-18T03:27:12Z","git_url":"git://github.com/anastasiamac/juju.git","ssh_url":"git@github.com:anastasiamac/juju.git","clone_url":"https://github.com/anastasiamac/juju.git","svn_url":"https://github.com/anastasiamac/juju","homepage":"juju.ubuntu.com","size":200704,"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":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"juju:2.3","ref":"2.3","sha":"0103c7e07aeba1e34d5d54671ad08b3e72a8abc7","user":{"login":"juju","id":4604548,"avatar_url":"https://avatars0.githubusercontent.com/u/4604548?v=4","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"repo":{"id":20445947,"name":"juju","full_name":"juju/juju","owner":{"login":"juju","id":4604548,"avatar_url":"https://avatars0.githubusercontent.com/u/4604548?v=4","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juju/juju","description":"juju is devops distilled","fork":false,"url":"https://api.github.com/repos/juju/juju","forks_url":"https://api.github.com/repos/juju/juju/forks","keys_url":"https://api.github.com/repos/juju/juju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juju/juju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juju/juju/teams","hooks_url":"https://api.github.com/repos/juju/juju/hooks","issue_events_url":"https://api.github.com/repos/juju/juju/issues/events{/number}","events_url":"https://api.github.com/repos/juju/juju/events","assignees_url":"https://api.github.com/repos/juju/juju/assignees{/user}","branches_url":"https://api.github.com/repos/juju/juju/branches{/branch}","tags_url":"https://api.github.com/repos/juju/juju/tags","blobs_url":"https://api.github.com/repos/juju/juju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juju/juju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juju/juju/git/refs{/sha}","trees_url":"https://api.github.com/repos/juju/juju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juju/juju/statuses/{sha}","languages_url":"https://api.github.com/repos/juju/juju/languages","stargazers_url":"https://api.github.com/repos/juju/juju/stargazers","contributors_url":"https://api.github.com/repos/juju/juju/contributors","subscribers_url":"https://api.github.com/repos/juju/juju/subscribers","subscription_url":"https://api.github.com/repos/juju/juju/subscription","commits_url":"https://api.github.com/repos/juju/juju/commits{/sha}","git_commits_url":"https://api.github.com/repos/juju/juju/git/commits{/sha}","comments_url":"https://api.github.com/repos/juju/juju/comments{/number}","issue_comment_url":"https://api.github.com/repos/juju/juju/issues/comments{/number}","contents_url":"https://api.github.com/repos/juju/juju/contents/{+path}","compare_url":"https://api.github.com/repos/juju/juju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juju/juju/merges","archive_url":"https://api.github.com/repos/juju/juju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juju/juju/downloads","issues_url":"https://api.github.com/repos/juju/juju/issues{/number}","pulls_url":"https://api.github.com/repos/juju/juju/pulls{/number}","milestones_url":"https://api.github.com/repos/juju/juju/milestones{/number}","notifications_url":"https://api.github.com/repos/juju/juju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juju/juju/labels{/name}","releases_url":"https://api.github.com/repos/juju/juju/releases{/id}","deployments_url":"https://api.github.com/repos/juju/juju/deployments","created_at":"2014-06-03T14:28:10Z","updated_at":"2018-05-18T02:00:02Z","pushed_at":"2018-05-18T04:00:11Z","git_url":"git://github.com/juju/juju.git","ssh_url":"git@github.com:juju/juju.git","clone_url":"https://github.com/juju/juju.git","svn_url":"https://github.com/juju/juju","homepage":"juju.ubuntu.com","size":210691,"stargazers_count":1158,"watchers_count":1158,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":270,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":270,"open_issues":17,"watchers":1158,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/juju/juju/pulls/8724"},"html":{"href":"https://github.com/juju/juju/pull/8724"},"issue":{"href":"https://api.github.com/repos/juju/juju/issues/8724"},"comments":{"href":"https://api.github.com/repos/juju/juju/issues/8724/comments"},"review_comments":{"href":"https://api.github.com/repos/juju/juju/pulls/8724/comments"},"review_comment":{"href":"https://api.github.com/repos/juju/juju/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juju/juju/pulls/8724/commits"},"statuses":{"href":"https://api.github.com/repos/juju/juju/statuses/531d4f78180f0d668e475a500d29ff51d1947eeb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"wallyworld"}}