Skip to content

Commit

Permalink
Drop unused StatusController#history
Browse files Browse the repository at this point in the history
It is not used since:
e39a9a7

Co-authored-by: Saray Cabrera Padrón <scabrerapadron@suse.de>
  • Loading branch information
vpereira and saraycp committed Sep 6, 2018
1 parent ea3715a commit fb84e9a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 55 deletions.
9 changes: 0 additions & 9 deletions src/api/app/controllers/status_controller.rb
@@ -1,13 +1,4 @@
require_dependency 'status_helper'

class StatusController < ApplicationController
def history
required_parameters :hours, :key

@samples = [params[:samples].to_i, 1].max
@values = StatusHistory.history_by_key_and_hours(params[:key], params[:hours])
end

def project
dbproj = Project.get_by_name(params[:project])
@packages = ProjectStatus::Calculator.new(dbproj).calc_status
Expand Down
6 changes: 0 additions & 6 deletions src/api/app/views/status/history.xml.builder

This file was deleted.

2 changes: 0 additions & 2 deletions src/api/config/routes.rb
Expand Up @@ -620,9 +620,7 @@ def self.public_or_about_path?(request)
# Routes for status_messages
# --------------------------
get 'status_message' => 'status_messages#index'

get 'status/workerstatus' => 'worker/status#index'
get 'status/history' => :history
get 'status/project/:project' => :project, constraints: cons
end

Expand Down
38 changes: 0 additions & 38 deletions src/api/test/functional/status_controller_test.rb
Expand Up @@ -98,42 +98,4 @@ def test_project_status
get '/status/project/home:Iggy'
assert_response :success
end

def test_history
get '/status/history'
assert_response 400
assert_select 'status', code: 'missing_parameter' do
assert_select 'summary', 'Required Parameter hours missing'
end

Timecop.freeze(2010, 7, 12) do
day_before_yesterday = Time.now.to_i - 2.days
yesterday = Time.now.to_i - 1.day
1.times do |i|
StatusHistory.create(time: day_before_yesterday + i, key: 'squeue_low_aarch64', value: i)
end
2.times do |i|
StatusHistory.create(time: yesterday + i, key: 'squeue_low_aarch64', value: i)
end

get '/status/history?hours=24&key=squeue_low_aarch64'
assert_response :success
assert_select 'history' do
assert_select 'value', time: '1278806399.5', value: '0.0'
end

# there is no history in fixtures so the result doesn't matter
# invalid parameters
get '/status/history?hours=-1&samples=-10'
assert_response 400
assert_select 'status', code: 'missing_parameter' do
assert_select 'summary', 'Required Parameter key missing'
end

get '/status/history?hours=5&samples=10&key=idle_i586'
assert_select 'history' do
assert_select 'value', 0
end
end
end
end

0 comments on commit fb84e9a

Please sign in to comment.