Commit 5a94d6b0 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'sh-add-redis-version-to-admin-page' into 'master'

Add Redis version to admin page

See merge request gitlab-org/gitlab!47242
parents ef88945a a7498bbe
...@@ -16,6 +16,7 @@ class Admin::DashboardController < Admin::ApplicationController ...@@ -16,6 +16,7 @@ class Admin::DashboardController < Admin::ApplicationController
@groups = Group.order_id_desc.with_route.limit(10) @groups = Group.order_id_desc.with_route.limit(10)
@notices = Gitlab::ConfigChecker::PumaRuggedChecker.check @notices = Gitlab::ConfigChecker::PumaRuggedChecker.check
@notices += Gitlab::ConfigChecker::ExternalDatabaseChecker.check @notices += Gitlab::ConfigChecker::ExternalDatabaseChecker.check
@redis_versions = [Gitlab::Redis::Queues, Gitlab::Redis::SharedState, Gitlab::Redis::Cache].map(&:version).uniq
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -139,6 +139,10 @@ ...@@ -139,6 +139,10 @@
= Gitlab::Database.human_adapter_name = Gitlab::Database.human_adapter_name
%span.float-right %span.float-right
= Gitlab::Database.version = Gitlab::Database.version
%p
= _('Redis')
%span.float-right
= @redis_versions&.join(", ")
%p %p
= link_to _("Gitaly Servers"), admin_gitaly_servers_path = link_to _("Gitaly Servers"), admin_gitaly_servers_path
.row .row
......
---
title: Add Redis version to admin page
merge_request: 47242
author:
type: added
...@@ -18,6 +18,10 @@ module Gitlab ...@@ -18,6 +18,10 @@ module Gitlab
pool.with { |redis| yield redis } pool.with { |redis| yield redis }
end end
def version
with { |redis| redis.info['redis_version'] }
end
def pool def pool
@pool ||= ConnectionPool.new(size: pool_size) { ::Redis.new(params) } @pool ||= ConnectionPool.new(size: pool_size) { ::Redis.new(params) }
end end
......
...@@ -22191,6 +22191,9 @@ msgstr "" ...@@ -22191,6 +22191,9 @@ msgstr ""
msgid "Redirect to SAML provider to test configuration" msgid "Redirect to SAML provider to test configuration"
msgstr "" msgstr ""
msgid "Redis"
msgstr ""
msgid "Reduce project visibility" msgid "Reduce project visibility"
msgstr "" msgstr ""
......
...@@ -4,12 +4,20 @@ require 'spec_helper' ...@@ -4,12 +4,20 @@ require 'spec_helper'
RSpec.describe Admin::DashboardController do RSpec.describe Admin::DashboardController do
describe '#index' 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 context 'with pending_delete projects' do
render_views render_views
it 'does not retrieve projects that are pending deletion' do it 'does not retrieve projects that are pending deletion' do
sign_in(create(:admin))
project = create(:project) project = create(:project)
pending_delete_project = create(:project, pending_delete: true) pending_delete_project = create(:project, pending_delete: true)
......
...@@ -26,6 +26,12 @@ RSpec.describe Gitlab::Redis::Wrapper do ...@@ -26,6 +26,12 @@ RSpec.describe Gitlab::Redis::Wrapper do
end end
end end
describe '.version' do
it 'returns a version' do
expect(described_class.version).to be_present
end
end
describe '.instrumentation_class' do describe '.instrumentation_class' do
it 'raises a NotImplementedError' do it 'raises a NotImplementedError' do
expect(described_class).to receive(:instrumentation_class).and_call_original 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