Commit a7498bbe authored by Stan Hu's avatar Stan Hu

Add Redis versions to admin page

This will help admins tell whether they need to update.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/213174
parent 2df95811
......@@ -16,6 +16,7 @@ class Admin::DashboardController < Admin::ApplicationController
@groups = Group.order_id_desc.with_route.limit(10)
@notices = Gitlab::ConfigChecker::PumaRuggedChecker.check
@notices += Gitlab::ConfigChecker::ExternalDatabaseChecker.check
@redis_versions = [Gitlab::Redis::Queues, Gitlab::Redis::SharedState, Gitlab::Redis::Cache].map(&:version).uniq
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -139,6 +139,10 @@
= Gitlab::Database.human_adapter_name
%span.float-right
= Gitlab::Database.version
%p
= _('Redis')
%span.float-right
= @redis_versions&.join(", ")
%p
= link_to _("Gitaly Servers"), admin_gitaly_servers_path
.row
......
---
title: Add Redis version to admin page
merge_request: 47242
author:
type: added
......@@ -18,6 +18,10 @@ module Gitlab
pool.with { |redis| yield redis }
end
def version
with { |redis| redis.info['redis_version'] }
end
def pool
@pool ||= ConnectionPool.new(size: pool_size) { ::Redis.new(params) }
end
......
......@@ -22148,6 +22148,9 @@ msgstr ""
msgid "Redirect to SAML provider to test configuration"
msgstr ""
msgid "Redis"
msgstr ""
msgid "Reduce project visibility"
msgstr ""
......
......@@ -4,12 +4,20 @@ require 'spec_helper'
RSpec.describe Admin::DashboardController do
describe '#index' do
before do
sign_in(create(:admin))
end
it 'retrieves Redis versions' do
get :index
expect(assigns[:redis_versions].length).to eq(1)
end
context 'with pending_delete projects' do
render_views
it 'does not retrieve projects that are pending deletion' do
sign_in(create(:admin))
project = create(:project)
pending_delete_project = create(:project, pending_delete: true)
......
......@@ -26,6 +26,12 @@ RSpec.describe Gitlab::Redis::Wrapper do
end
end
describe '.version' do
it 'returns a version' do
expect(described_class.version).to be_present
end
end
describe '.instrumentation_class' do
it 'raises a NotImplementedError' do
expect(described_class).to receive(:instrumentation_class).and_call_original
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment