mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
Use Redis for ActiveJob and ActionCable (#2004)
* Use Redis for ActiveJob and ActionCable * Fix alwaysApply setting * Update queue names and weights * Tweak weights * Update job queues * Update docker setup guide * Remove deprecated upgrade columns from users table * Refactor Redis configuration for Sidekiq and caching in production environment * Add Sidekiq Sentry monitoring * queue naming fix * Clean up schema
This commit is contained in:
parent
a7db914005
commit
19cc63c8f4
75 changed files with 328 additions and 1684 deletions
|
@ -37,17 +37,6 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_nil Session.find_by(id: session_record.id)
|
||||
end
|
||||
|
||||
test "super admins can access the jobs page" do
|
||||
sign_in users(:maybe_support_staff)
|
||||
get good_job_url
|
||||
assert_redirected_to "http://www.example.com/good_job/jobs?locale=en"
|
||||
end
|
||||
|
||||
test "non-super admins cannot access the jobs page" do
|
||||
get good_job_url
|
||||
assert_response :not_found
|
||||
end
|
||||
|
||||
test "redirects to MFA verification when MFA enabled" do
|
||||
@user.setup_mfa!
|
||||
@user.enable_mfa!
|
||||
|
|
|
@ -25,7 +25,7 @@ class Settings::HostingsControllerTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
|
||||
assert_raises(RuntimeError, "Settings not available on non-self-hosted instance") do
|
||||
patch settings_hosting_url, params: { setting: { render_deploy_hook: "https://example.com" } }
|
||||
patch settings_hosting_url, params: { setting: { require_invite_for_signup: true } }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,25 +40,11 @@ class Settings::HostingsControllerTest < ActionDispatch::IntegrationTest
|
|||
|
||||
test "can update settings when self hosting is enabled" do
|
||||
with_self_hosting do
|
||||
NEW_RENDER_DEPLOY_HOOK = "https://api.render.com/deploy/srv-abc123"
|
||||
assert_nil Setting.render_deploy_hook
|
||||
assert_nil Setting.synth_api_key
|
||||
|
||||
patch settings_hosting_url, params: { setting: { render_deploy_hook: NEW_RENDER_DEPLOY_HOOK } }
|
||||
patch settings_hosting_url, params: { setting: { synth_api_key: "1234567890" } }
|
||||
|
||||
assert_equal NEW_RENDER_DEPLOY_HOOK, Setting.render_deploy_hook
|
||||
end
|
||||
end
|
||||
|
||||
test "can choose auto upgrades mode with a deploy hook" do
|
||||
with_self_hosting do
|
||||
NEW_RENDER_DEPLOY_HOOK = "https://api.render.com/deploy/srv-abc123"
|
||||
assert_nil Setting.render_deploy_hook
|
||||
|
||||
patch settings_hosting_url, params: { setting: { render_deploy_hook: NEW_RENDER_DEPLOY_HOOK, upgrades_setting: "release" } }
|
||||
|
||||
assert_equal "auto", Setting.upgrades_mode
|
||||
assert_equal "release", Setting.upgrades_target
|
||||
assert_equal NEW_RENDER_DEPLOY_HOOK, Setting.render_deploy_hook
|
||||
assert_equal "1234567890", Setting.synth_api_key
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
require "test_helper"
|
||||
|
||||
class UpgradesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in @user = users(:family_admin)
|
||||
|
||||
@completed_upgrade = Upgrader::Upgrade.new(
|
||||
"commit",
|
||||
commit_sha: "47bb430954292d2fdcc81082af731a16b9587da3",
|
||||
version: Semver.new("0.0.0"),
|
||||
url: ""
|
||||
)
|
||||
|
||||
@completed_upgrade.stubs(:complete?).returns(true)
|
||||
@completed_upgrade.stubs(:available?).returns(false)
|
||||
|
||||
@available_upgrade = Upgrader::Upgrade.new(
|
||||
"commit",
|
||||
commit_sha: "47bb430954292d2fdcc81082af731a16b9587da4",
|
||||
version: Semver.new("0.1.0"),
|
||||
url: ""
|
||||
)
|
||||
|
||||
@available_upgrade.stubs(:available?).returns(true)
|
||||
@available_upgrade.stubs(:complete?).returns(false)
|
||||
end
|
||||
|
||||
test "controller not available when upgrades are disabled" do
|
||||
MOCK_COMMIT = "47bb430954292d2fdcc81082af731a16b9587da3"
|
||||
|
||||
post acknowledge_upgrade_url(MOCK_COMMIT)
|
||||
assert_response :not_found
|
||||
|
||||
post deploy_upgrade_url(MOCK_COMMIT)
|
||||
assert_response :not_found
|
||||
end
|
||||
|
||||
test "should acknowledge an upgrade prompt" do
|
||||
with_env_overrides UPGRADES_ENABLED: "true" do
|
||||
Upgrader.stubs(:find_upgrade).returns(@available_upgrade)
|
||||
|
||||
post acknowledge_upgrade_url(@available_upgrade.commit_sha)
|
||||
|
||||
@user.reload
|
||||
assert_equal @user.last_prompted_upgrade_commit_sha, @available_upgrade.commit_sha
|
||||
assert :redirect
|
||||
end
|
||||
end
|
||||
|
||||
test "should acknowledge an upgrade alert" do
|
||||
with_env_overrides UPGRADES_ENABLED: "true" do
|
||||
Upgrader.stubs(:find_upgrade).returns(@completed_upgrade)
|
||||
|
||||
post acknowledge_upgrade_url(@completed_upgrade.commit_sha)
|
||||
|
||||
@user.reload
|
||||
assert_equal @user.last_alerted_upgrade_commit_sha, @completed_upgrade.commit_sha
|
||||
assert :redirect
|
||||
end
|
||||
end
|
||||
|
||||
test "should deploy an upgrade" do
|
||||
with_env_overrides UPGRADES_ENABLED: "true" do
|
||||
Upgrader.stubs(:find_upgrade).returns(@available_upgrade)
|
||||
|
||||
post deploy_upgrade_path(@available_upgrade.commit_sha)
|
||||
|
||||
@user.reload
|
||||
assert_equal @user.last_prompted_upgrade_commit_sha, @available_upgrade.commit_sha
|
||||
assert :redirect
|
||||
end
|
||||
end
|
||||
|
||||
test "should rollback user state if upgrade fails" do
|
||||
with_env_overrides UPGRADES_ENABLED: "true" do
|
||||
PRIOR_COMMIT = "47bb430954292d2fdcc81082af731a16b9587da2"
|
||||
@user.update!(last_prompted_upgrade_commit_sha: PRIOR_COMMIT)
|
||||
|
||||
Upgrader.stubs(:find_upgrade).returns(@available_upgrade)
|
||||
Upgrader.stubs(:upgrade_to).returns({ success: false })
|
||||
|
||||
post deploy_upgrade_path(@available_upgrade.commit_sha)
|
||||
|
||||
@user.reload
|
||||
assert_equal @user.last_prompted_upgrade_commit_sha, PRIOR_COMMIT
|
||||
assert :redirect
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue