summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-08-30 12:47:31 +0200
committerTomasz Maczukin <tomasz@maczukin.pl>2016-09-01 14:00:46 +0200
commitc8861da76772d781f677a76506f590edc23ba251 (patch)
tree9c8342286be17bf9f449069f0591f8799cdec6fb /app
parente2e8ec6074a4b7552188b169cfe9c4612b740428 (diff)
downloadgitlab-ce-c8861da76772d781f677a76506f590edc23ba251.tar.gz
Update specs - add mocks to simulate old versions
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/projects/builds_controller.rb4
-rw-r--r--app/models/ci/build.rb10
3 files changed, 11 insertions, 7 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 78ed12db516..bd4ba384b29 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -117,10 +117,6 @@ class ApplicationController < ActionController::Base
render file: Rails.root.join("public", "404"), layout: false, status: "404"
end
- def render_410
- render file: Rails.root.join("public", "410"), layout: false, status: "410"
- end
-
def no_cache_headers
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb
index 79d774195f8..77934ff9962 100644
--- a/app/controllers/projects/builds_controller.rb
+++ b/app/controllers/projects/builds_controller.rb
@@ -79,9 +79,9 @@ class Projects::BuildsController < Projects::ApplicationController
def raw
if @build.has_trace_file?
- send_file @build.path_to_trace, type: 'text/plain; charset=utf-8', disposition: 'inline'
+ send_file @build.trace_file_path, type: 'text/plain; charset=utf-8', disposition: 'inline'
else
- render_410
+ render_404
end
end
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 8a8f848d328..f219cee4a62 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -217,7 +217,7 @@ module Ci
end
def raw_trace
- if File.file?(path_to_trace)
+ if File.exist?(path_to_trace)
File.read(path_to_trace)
elsif has_old_trace_file?
# Temporary fix for build trace data integrity
@@ -274,6 +274,14 @@ module Ci
end
end
+ def trace_file_path
+ if has_old_trace_file?
+ old_path_to_trace
+ else
+ path_to_trace
+ end
+ end
+
def dir_to_trace
File.join(
Settings.gitlab_ci.builds_path,