Add gitlab-workhorse version to admin dashboard

Test for showing GitLab Workhorse version on Admin Dashboard

Refactoring
This commit is contained in:
Katarzyna Kobierska 2016-07-18 13:58:08 +02:00
parent 46a17ffd5a
commit 10d9df28ec
4 changed files with 32 additions and 0 deletions

View File

@ -164,6 +164,7 @@ v 8.10.0
- Export and import avatar as part of project import/export
- Fix migration corrupting import data for old version upgrades
- Show tooltip on GitLab export link in new project page
- Add GitLab Workhorse version to admin dashboard (Katarzyna Kobierska)
v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154

View File

@ -79,6 +79,10 @@
GitLab Shell
%span.pull-right
= Gitlab::Shell.new.version
%p
GitLab Workhorse
%span.pull-right
= Gitlab::Workhorse.version
%p
GitLab API
%span.pull-right

View File

@ -4,6 +4,7 @@ require 'json'
module Gitlab
class Workhorse
SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data'
VERSION_FILE = 'GITLAB_WORKHORSE_VERSION'
class << self
def git_http_ok(repository, user)
@ -75,6 +76,12 @@ module Gitlab
]
end
def version
if File.readable?(File.join(Rails.root, VERSION_FILE))
File.read(File.join(Rails.root, VERSION_FILE))
end
end
protected
def encode(hash)

View File

@ -0,0 +1,20 @@
require 'spec_helper'
describe 'admin/dashboard/index.html.haml' do
include Devise::TestHelpers
before do
assign(:projects, create_list(:empty_project, 1))
assign(:users, create_list(:user, 1))
assign(:groups, create_list(:group, 1))
allow(view).to receive(:admin?).and_return(true)
end
it "shows version of GitLab Workhorse" do
render
expect(rendered).to have_content 'GitLab Workhorse'
expect(rendered).to have_content Gitlab::Workhorse.version
end
end