1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 23:59:40 +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:
Zach Gollwitzer 2025-03-19 12:36:16 -04:00 committed by GitHub
parent a7db914005
commit 19cc63c8f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 328 additions and 1684 deletions

View file

@ -1,9 +0,0 @@
require "test_helper"
class Provider::GithubTest < ActiveSupport::TestCase
include GitRepositoryProviderInterfaceTest
setup do
@subject = Provider::Github.new(owner: "rails", name: "rails", branch: "main")
end
end

View file

@ -1,36 +0,0 @@
require "test_helper"
class UpgradeTest < ActiveSupport::TestCase
setup do
data = {
commit_sha: "latestcommit",
version: Semver.new("0.1.0-alpha.2")
}
@commit_upgrade = Upgrader::Upgrade.new "commit", data
@release_upgrade = Upgrader::Upgrade.new "release", data
end
test "available if latest commit and app not upgraded" do
Maybe.stubs(:version).returns(@commit_upgrade.version)
Maybe.stubs(:commit_sha).returns("outdatedcommitsha")
assert @commit_upgrade.available?
assert_not @release_upgrade.available?
end
test "available if latest release and app not upgraded" do
Maybe.stubs(:version).returns(Semver.new("0.1.0-alpha.1"))
Maybe.stubs(:commit_sha).returns("outdatedcommitsha")
assert @commit_upgrade.available?
assert @release_upgrade.available?
end
test "not available if app commit greater or equal to" do
Maybe.stubs(:version).returns(@commit_upgrade.version)
Maybe.stubs(:commit_sha).returns(@commit_upgrade.commit_sha)
assert_not @commit_upgrade.available?
end
end

View file

@ -1,88 +0,0 @@
require "test_helper"
class UpgraderTest < ActiveSupport::TestCase
PRIOR_COMMIT = "47bb430954292d2fdcc81082af731a16b9587da2"
CURRENT_COMMIT = "47bb430954292d2fdcc81082af731a16b9587da3"
NEXT_COMMIT = "47bb430954292d2fdcc81082af731a16b9587da4"
PRIOR_VERSION = Semver.new("0.1.0-alpha.3")
CURRENT_VERSION = Semver.new("0.1.0-alpha.4")
NEXT_VERSION = Semver.new("0.1.0-alpha.5")
# Default setup assumes app is up to date
setup do
Upgrader.config = Upgrader::Config.new({ mode: :enabled })
Maybe.stubs(:version).returns(CURRENT_VERSION)
Maybe.stubs(:commit_sha).returns(CURRENT_COMMIT)
stub_github_data(
commit: create_upgrade_stub(CURRENT_VERSION, CURRENT_COMMIT),
release: create_upgrade_stub(CURRENT_VERSION, CURRENT_COMMIT)
)
end
test "finds 1 completed upgrade, 0 available upgrades when app is up to date" do
assert_instance_of Upgrader::Upgrade, Upgrader.completed_upgrade
assert_nil Upgrader.available_upgrade
end
test "finds 1 available and 1 completed upgrade when app is on latest release but behind latest commit" do
stub_github_data(
commit: create_upgrade_stub(CURRENT_VERSION, NEXT_COMMIT),
release: create_upgrade_stub(CURRENT_VERSION, CURRENT_COMMIT)
)
assert_instance_of Upgrader::Upgrade, Upgrader.available_upgrade # commit is ahead of release
assert_instance_of Upgrader::Upgrade, Upgrader.completed_upgrade # release is completed
end
test "when app is behind latest version and latest commit is ahead of release finds release upgrade and no completed upgrades" do
Maybe.stubs(:version).returns(PRIOR_VERSION)
Maybe.stubs(:commit_sha).returns(PRIOR_COMMIT)
stub_github_data(
commit: create_upgrade_stub(CURRENT_VERSION, NEXT_COMMIT),
release: create_upgrade_stub(CURRENT_VERSION, CURRENT_COMMIT)
)
assert_equal "release", Upgrader.available_upgrade.type
assert_nil Upgrader.completed_upgrade
end
test "defaults to app version when no release is found" do
stub_github_data(
commit: create_upgrade_stub(CURRENT_VERSION, NEXT_COMMIT),
release: nil
)
# Upstream is 1 commit ahead, and we assume we're on the same release
assert_equal "commit", Upgrader.available_upgrade.type
end
test "gracefully handles empty github info" do
Provider::Github.any_instance.stubs(:fetch_latest_upgrade_candidates).returns(nil)
assert_nil Upgrader.available_upgrade
assert_nil Upgrader.completed_upgrade
end
test "deployer is null by default" do
Upgrader.config = Upgrader::Config.new({ mode: :enabled })
Upgrader::Deployer::Null.any_instance.expects(:deploy).with(nil).once
Upgrader.upgrade_to(nil)
end
private
def create_upgrade_stub(version, commit_sha)
{
version: version,
commit_sha: commit_sha,
url: ""
}
end
def stub_github_data(commit: create_upgrade_stub(LATEST_VERSION, LATEST_COMMIT), release: create_upgrade_stub(LATEST_VERSION, LATEST_COMMIT))
Provider::Github.any_instance.stubs(:fetch_latest_upgrade_candidates).returns({ commit:, release: })
end
end