Commit 7297a06c authored by Shinya Maeda's avatar Shinya Maeda

Fix bunch of texts

parent 3b97710c
......@@ -9,3 +9,4 @@ lib/gitlab/gitaly_client/operation_service.rb
lib/gitlab/background_migration/*
app/models/project_services/kubernetes_service.rb
lib/gitlab/workhorse.rb
lib/gitlab/ci/trace/chunked_io.rb
......@@ -128,7 +128,7 @@ class Projects::JobsController < Projects::ApplicationController
if stream.file?
send_file stream.path, type: 'text/plain; charset=utf-8', disposition: 'inline'
else
render_404
send_data stream.raw, type: 'text/plain; charset=utf-8', disposition: 'inline'
end
end
end
......
......@@ -113,8 +113,6 @@ module Gitlab
end
def write(data)
raise 'Could not write empty data' unless data.present?
start_pos = tell
data = data.force_encoding(Encoding::BINARY)
......
......@@ -8,7 +8,7 @@ module Gitlab
attr_reader :stream
delegate :close, :tell, :seek, :size, :path, :url, :truncate, to: :stream, allow_nil: true
delegate :close, :tell, :seek, :size, :url, :truncate, to: :stream, allow_nil: true
delegate :valid?, to: :stream, as: :present?, allow_nil: true
......@@ -25,6 +25,10 @@ module Gitlab
self.path.present?
end
def file?
self.path if self.stream.respond_to?(:path)
end
def limit(last_bytes = LIMIT_SIZE)
if last_bytes < size
stream.seek(-last_bytes, IO::SEEK_END)
......
......@@ -15,8 +15,6 @@ feature 'Jobs', :clean_gitlab_redis_shared_state do
end
before do
stub_feature_flags(ci_enable_live_trace: true)
project.add_role(user, user_access_level)
sign_in(user)
end
......@@ -537,44 +535,6 @@ feature 'Jobs', :clean_gitlab_redis_shared_state do
end
end
context 'storage form' do
let(:existing_file) { Tempfile.new('existing-trace-file').path }
before do
job.run!
end
context 'when job has trace in file', :js do
before do
allow_any_instance_of(Gitlab::Ci::Trace)
.to receive(:paths)
.and_return([existing_file])
end
it 'sends the right headers' do
requests = inspect_requests(inject_headers: { 'X-Sendfile-Type' => 'X-Sendfile' }) do
visit raw_project_job_path(project, job)
end
expect(requests.first.response_headers['Content-Type']).to eq('text/plain; charset=utf-8')
expect(requests.first.response_headers['X-Sendfile']).to eq(existing_file)
end
end
context 'when job has trace in the database', :js do
before do
allow_any_instance_of(Gitlab::Ci::Trace)
.to receive(:paths)
.and_return([])
visit project_job_path(project, job)
end
it 'sends the right headers' do
expect(page).not_to have_selector('.js-raw-link-controller')
end
end
end
context "when visiting old URL" do
let(:raw_job_url) do
raw_project_job_path(project, job)
......
......@@ -298,14 +298,6 @@ describe Gitlab::Ci::Trace::ChunkedIO, :clean_gitlab_redis_cache do
it_behaves_like 'writes a trace'
end
context 'when data is nil' do
let(:data) { nil }
it 'writes a trace' do
expect { subject } .to raise_error('Could not write empty data')
end
end
end
context 'when data already exists' do
......
require 'spec_helper'
describe API::Runner do
describe API::Runner, :clean_gitlab_redis_shared_state do
include StubGitlabCalls
let(:registration_token) { 'abcdefg123456' }
before do
stub_feature_flags(ci_enable_live_trace: true)
stub_gitlab_calls
stub_application_setting(runners_registration_token: registration_token)
allow_any_instance_of(Ci::Runner).to receive(:cache_attributes)
......
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