{"action":"created","comment":{"url":"https://api.github.com/repos/zendesk/samson/pulls/comments/25689253","id":25689253,"diff_hunk":"@@ -0,0 +1,94 @@\n+require_relative '../../test_helper'\n+\n+describe Admin::DeployGroupsController do\n+  as_a_deployer do\n+    unauthorized :get, :index\n+    unauthorized :post, :create\n+    unauthorized :delete, :destroy, id: 1\n+    unauthorized :post, :update, id: 1\n+    unauthorized :get, :new\n+  end\n+\n+  as_a_admin do\n+    it 'get index succeeds' do\n+      get :index\n+      assert_response :success\n+      assigns(:deploy_groups).count.must_equal 3\n+    end\n+\n+    unauthorized :post, :create\n+    unauthorized :delete, :destroy, id: 1\n+    unauthorized :post, :update, id: 1\n+    unauthorized :get, :new\n+  end\n+\n+  as_a_super_admin do\n+    it 'get :index succeeds' do\n+      get :index\n+      assert_response :success\n+      assigns(:deploy_groups).count.must_equal 3\n+      deploy_groups = assigns(:deploy_groups)\n+      deploy_groups.include?(deploy_groups(:deploy_group_pod1)).must_equal true\n+      deploy_groups.include?(deploy_groups(:deploy_group_pod2)).must_equal true\n+      deploy_groups.include?(deploy_groups(:deploy_group_pod100)).must_equal true\n+    end\n+\n+    it 'get :new succeeds' do\n+      get :new\n+      assert_response :success\n+      assigns(:deploy_group).wont_be_nil\n+    end\n+\n+    describe '#create' do\n+      it 'valid deploy_group' do\n+        post :create, deploy_group: {name: 'pod666', environment_id: environments(:staging_env).id}\n+        assert_redirected_to admin_deploy_groups_path\n+        deploy_groups = DeployGroup.where(name: 'pod666')\n+        deploy_groups.count.must_equal 1\n+        deploy_groups.first.environment.name.must_equal 'Staging'\n+      end\n+\n+      it 'should not create an deploy_group with blank name' do\n+        deploy_group_count = DeployGroup.count\n+        post :create, deploy_group: {name: nil}\n+        assert_redirected_to new_admin_deploy_group_path\n+        flash[:error].must_equal 'Failed to create deploy group: [\"Name can\\'t be blank\", \"Environment can\\'t be blank\"]'\n+        DeployGroup.count.must_equal deploy_group_count\n+      end\n+    end\n+\n+    describe '#delete' do\n+      it 'success' do\n+        id = deploy_groups(:deploy_group_pod100).id\n+        delete :destroy, id: id\n+        assert_redirected_to admin_deploy_groups_path\n+        DeployGroup.where(id: id).must_equal []\n+      end\n+\n+      it 'fail for non-existent deploy_group' do\n+        delete :destroy, id: -1\n+        assert_redirected_to admin_deploy_groups_path\n+        flash[:error].must_equal 'Failed to find the deploy group: -1'\n+      end\n+    end\n+\n+    describe '#edit' do","path":"test/controllers/admin/deploy_groups_controller_test.rb","position":75,"original_position":75,"commit_id":"897c1aeac205e3c23107cc9f2757f62f209f9532","original_commit_id":"897c1aeac205e3c23107cc9f2757f62f209f9532","user":{"login":"zendesk-shender","id":8860832,"avatar_url":"https://avatars.githubusercontent.com/u/8860832?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk-shender","html_url":"https://github.com/zendesk-shender","followers_url":"https://api.github.com/users/zendesk-shender/followers","following_url":"https://api.github.com/users/zendesk-shender/following{/other_user}","gists_url":"https://api.github.com/users/zendesk-shender/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk-shender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk-shender/subscriptions","organizations_url":"https://api.github.com/users/zendesk-shender/orgs","repos_url":"https://api.github.com/users/zendesk-shender/repos","events_url":"https://api.github.com/users/zendesk-shender/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk-shender/received_events","type":"User","site_admin":false},"body":"yup!","created_at":"2015-03-03T14:09:46Z","updated_at":"2015-03-03T14:09:46Z","html_url":"https://github.com/zendesk/samson/pull/251#discussion_r25689253","pull_request_url":"https://api.github.com/repos/zendesk/samson/pulls/251","_links":{"self":{"href":"https://api.github.com/repos/zendesk/samson/pulls/comments/25689253"},"html":{"href":"https://github.com/zendesk/samson/pull/251#discussion_r25689253"},"pull_request":{"href":"https://api.github.com/repos/zendesk/samson/pulls/251"}}},"pull_request":{"url":"https://api.github.com/repos/zendesk/samson/pulls/251","id":30065622,"html_url":"https://github.com/zendesk/samson/pull/251","diff_url":"https://github.com/zendesk/samson/pull/251.diff","patch_url":"https://github.com/zendesk/samson/pull/251.patch","issue_url":"https://api.github.com/repos/zendesk/samson/issues/251","number":251,"state":"open","locked":false,"title":"Shender/environment stage grouping","user":{"login":"zendesk-shender","id":8860832,"avatar_url":"https://avatars.githubusercontent.com/u/8860832?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk-shender","html_url":"https://github.com/zendesk-shender","followers_url":"https://api.github.com/users/zendesk-shender/followers","following_url":"https://api.github.com/users/zendesk-shender/following{/other_user}","gists_url":"https://api.github.com/users/zendesk-shender/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk-shender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk-shender/subscriptions","organizations_url":"https://api.github.com/users/zendesk-shender/orgs","repos_url":"https://api.github.com/users/zendesk-shender/repos","events_url":"https://api.github.com/users/zendesk-shender/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk-shender/received_events","type":"User","site_admin":false},"body":"This PR is for the Runway Project that aims to have Samson become a bit more host-aware, so any stages that target the same hosts can be identified and dashboards can be created to show what's installed on each target system.\r\nWe have chosen to use 'Deploy Group' to denote the target deployment hosts, as we in Zendesk use whole datacenters as our target rather than deploying to individual machines.\r\n\r\nEnvironments - equivalent to 'production', 'staging', 'testing' labels for deployment flows\r\nDeployGroups - assigned an environment and correspond to a group of hosts that a deploy will target.\r\nStage - A custom deploy config for a project that can target multiple DeployGroups.\r\n\r\nThis PR lays the groundwork for for the dashboard views, a later PR will implement them.\r\n\r\nTo enable the below UIs you have to set the 'DEPLOY_GROUP_FEATURE' flag in the .env file.\r\n\r\n![envs](https://cloud.githubusercontent.com/assets/8860832/6390053/1b68dfb6-bda1-11e4-8011-2a7d07a1895c.png)\r\n![deploygroups](https://cloud.githubusercontent.com/assets/8860832/6390059/1f4cf0a4-bda1-11e4-832d-de0f6f2e7f5a.png)\r\n![dgedit](https://cloud.githubusercontent.com/assets/8860832/6390060/214aecbc-bda1-11e4-82d5-44d178ec7311.png)\r\n![envedit](https://cloud.githubusercontent.com/assets/8860832/6390061/22d3be42-bda1-11e4-9528-6256a80b9640.png)\r\n![stageedit](https://cloud.githubusercontent.com/assets/8860832/6390062/24a2312c-bda1-11e4-98c8-c047633c454a.png)\r\n![stageeditmulti](https://cloud.githubusercontent.com/assets/8860832/6390064/26eaf2e8-bda1-11e4-98e5-54651f76d8ff.png)\r\n\r\n\r\n/cc @samson @pswadi-zendesk @sandlerr @grosser @gabetax @jonmoter\r\n\r\n### References\r\n - Jira link: https://zendesk.atlassian.net/browse/RUN-5 https://zendesk.atlassian.net/browse/RUN-26\r\n\r\n### Risks\r\n - None","created_at":"2015-02-26T10:25:34Z","updated_at":"2015-03-03T14:09:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zendesk/samson/pulls/251/commits","review_comments_url":"https://api.github.com/repos/zendesk/samson/pulls/251/comments","review_comment_url":"https://api.github.com/repos/zendesk/samson/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendesk/samson/issues/251/comments","statuses_url":"https://api.github.com/repos/zendesk/samson/statuses/897c1aeac205e3c23107cc9f2757f62f209f9532","head":{"label":"zendesk:shender/environment_stage_grouping","ref":"shender/environment_stage_grouping","sha":"897c1aeac205e3c23107cc9f2757f62f209f9532","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":20208662,"name":"samson","full_name":"zendesk/samson","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/samson","description":"Web interface for deployments","fork":false,"url":"https://api.github.com/repos/zendesk/samson","forks_url":"https://api.github.com/repos/zendesk/samson/forks","keys_url":"https://api.github.com/repos/zendesk/samson/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/samson/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/samson/teams","hooks_url":"https://api.github.com/repos/zendesk/samson/hooks","issue_events_url":"https://api.github.com/repos/zendesk/samson/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/samson/events","assignees_url":"https://api.github.com/repos/zendesk/samson/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/samson/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/samson/tags","blobs_url":"https://api.github.com/repos/zendesk/samson/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/samson/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/samson/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/samson/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/samson/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/samson/languages","stargazers_url":"https://api.github.com/repos/zendesk/samson/stargazers","contributors_url":"https://api.github.com/repos/zendesk/samson/contributors","subscribers_url":"https://api.github.com/repos/zendesk/samson/subscribers","subscription_url":"https://api.github.com/repos/zendesk/samson/subscription","commits_url":"https://api.github.com/repos/zendesk/samson/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/samson/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/samson/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/samson/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/samson/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/samson/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/samson/merges","archive_url":"https://api.github.com/repos/zendesk/samson/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/samson/downloads","issues_url":"https://api.github.com/repos/zendesk/samson/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/samson/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/samson/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/samson/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/samson/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/samson/releases{/id}","created_at":"2014-05-27T05:55:57Z","updated_at":"2015-03-03T13:55:33Z","pushed_at":"2015-03-02T17:03:49Z","git_url":"git://github.com/zendesk/samson.git","ssh_url":"git@github.com:zendesk/samson.git","clone_url":"https://github.com/zendesk/samson.git","svn_url":"https://github.com/zendesk/samson","homepage":null,"size":101733,"stargazers_count":349,"watchers_count":349,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":35,"forks":42,"open_issues":35,"watchers":349,"default_branch":"master"}},"base":{"label":"zendesk:master","ref":"master","sha":"e88315be052e0f93d814ec68c479ba545a7974d9","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":20208662,"name":"samson","full_name":"zendesk/samson","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/samson","description":"Web interface for deployments","fork":false,"url":"https://api.github.com/repos/zendesk/samson","forks_url":"https://api.github.com/repos/zendesk/samson/forks","keys_url":"https://api.github.com/repos/zendesk/samson/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/samson/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/samson/teams","hooks_url":"https://api.github.com/repos/zendesk/samson/hooks","issue_events_url":"https://api.github.com/repos/zendesk/samson/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/samson/events","assignees_url":"https://api.github.com/repos/zendesk/samson/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/samson/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/samson/tags","blobs_url":"https://api.github.com/repos/zendesk/samson/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/samson/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/samson/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/samson/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/samson/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/samson/languages","stargazers_url":"https://api.github.com/repos/zendesk/samson/stargazers","contributors_url":"https://api.github.com/repos/zendesk/samson/contributors","subscribers_url":"https://api.github.com/repos/zendesk/samson/subscribers","subscription_url":"https://api.github.com/repos/zendesk/samson/subscription","commits_url":"https://api.github.com/repos/zendesk/samson/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/samson/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/samson/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/samson/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/samson/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/samson/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/samson/merges","archive_url":"https://api.github.com/repos/zendesk/samson/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/samson/downloads","issues_url":"https://api.github.com/repos/zendesk/samson/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/samson/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/samson/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/samson/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/samson/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/samson/releases{/id}","created_at":"2014-05-27T05:55:57Z","updated_at":"2015-03-03T13:55:33Z","pushed_at":"2015-03-02T17:03:49Z","git_url":"git://github.com/zendesk/samson.git","ssh_url":"git@github.com:zendesk/samson.git","clone_url":"https://github.com/zendesk/samson.git","svn_url":"https://github.com/zendesk/samson","homepage":null,"size":101733,"stargazers_count":349,"watchers_count":349,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":35,"forks":42,"open_issues":35,"watchers":349,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendesk/samson/pulls/251"},"html":{"href":"https://github.com/zendesk/samson/pull/251"},"issue":{"href":"https://api.github.com/repos/zendesk/samson/issues/251"},"comments":{"href":"https://api.github.com/repos/zendesk/samson/issues/251/comments"},"review_comments":{"href":"https://api.github.com/repos/zendesk/samson/pulls/251/comments"},"review_comment":{"href":"https://api.github.com/repos/zendesk/samson/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendesk/samson/pulls/251/commits"},"statuses":{"href":"https://api.github.com/repos/zendesk/samson/statuses/897c1aeac205e3c23107cc9f2757f62f209f9532"}}}}