Skip to content

Commit

Permalink
Merge pull request #1592 from alphagov/update-slack-team
Browse files Browse the repository at this point in the history
Allow alerts to be posted to a different Slack channel
  • Loading branch information
brucebolt authored Oct 22, 2024
2 parents 07aa93c + a444760 commit e056a93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ def live_environment
end

def team_name
Repo.find_by(app_name: name)&.dig("team") || "#govuk-developers"
Repo.find_by(app_name: name)&.dig("alerts_team") || "#govuk-developers"
end
end
4 changes: 2 additions & 2 deletions test/unit/application_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class ApplicationTest < ActiveSupport::TestCase
should "return the name of the team that owns the app" do
response_body = [{
"app_name" => "account-api",
"team" => "#tech-content-interactions-on-platform-govuk",
"alerts_team" => "#tech-content-interactions-on-platform-govuk",
}].to_json
stub_request(:get, Repo::REPO_JSON_URL).to_return(status: 200, body: response_body)

Expand All @@ -287,7 +287,7 @@ class ApplicationTest < ActiveSupport::TestCase
should "return general dev slack channel when it can't find team (because app names don't match)" do
response_body = [{
"app_name" => "content-data-admin",
"team" => "#govuk-platform-security-reliability-team",
"alerts_team" => "#govuk-platform-security-reliability-team",
}].to_json
stub_request(:get, Repo::REPO_JSON_URL).to_return(status: 200, body: response_body)

Expand Down
6 changes: 3 additions & 3 deletions test/unit/jobs/post_out_of_sync_deploys_job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class PostOutOfSyncDeploysJobTest < ActiveJob::TestCase

should "enqueue a SlackPosterJob for each team with out-of-sync apps" do
response_body = [
{ "app_name" => "account-api", "team" => "#tech-content-interactions-on-platform-govuk" },
{ "app_name" => "asset-manager", "team" => "#govuk-publishing-platform" },
{ "app_name" => "account-api", "alerts_team" => "#tech-content-interactions-on-platform-govuk" },
{ "app_name" => "asset-manager", "alerts_team" => "#govuk-publishing-platform" },
].to_json

stub_request(:get, Repo::REPO_JSON_URL).to_return(status: 200, body: response_body)
Expand Down Expand Up @@ -48,7 +48,7 @@ class PostOutOfSyncDeploysJobTest < ActiveJob::TestCase
should "not enqueue a SlackPosterJob if no teams have out-of-sync apps" do
response_body = [{
"app_name" => "account-api",
"team" => "#tech-content-interactions-on-platform-govuk",
"alerts_team" => "#tech-content-interactions-on-platform-govuk",
}].to_json
stub_request(:get, Repo::REPO_JSON_URL).to_return(status: 200, body: response_body)

Expand Down

0 comments on commit e056a93

Please sign in to comment.