Commit a8aec1f6 authored by Stan Hu's avatar Stan Hu

Remove ci_job_trace_force_encode feature flag

This feature flag was enabled by default in GitLab 14.1, so we can drop
this now.

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/333452

Changelog: changed
parent 1eaea4fc
...@@ -80,12 +80,10 @@ module Ci ...@@ -80,12 +80,10 @@ module Ci
private private
def append_strings(old_data, new_data) def append_strings(old_data, new_data)
if Feature.enabled?(:ci_job_trace_force_encode, default_enabled: :yaml) # When object storage is in use, old_data may be retrieved in UTF-8.
# When object storage is in use, old_data may be retrieved in UTF-8. old_data = old_data.force_encoding(Encoding::ASCII_8BIT)
old_data = old_data.force_encoding(Encoding::ASCII_8BIT) # new_data should already be in ASCII-8BIT, but just in case it isn't, do this.
# new_data should already be in ASCII-8BIT, but just in case it isn't, do this. new_data = new_data.force_encoding(Encoding::ASCII_8BIT)
new_data = new_data.force_encoding(Encoding::ASCII_8BIT)
end
old_data + new_data old_data + new_data
end end
......
---
name: ci_job_trace_force_encode
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64631
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/333452
milestone: '14.1'
type: development
group: group::verify
default_enabled: true
...@@ -107,37 +107,22 @@ RSpec.describe Ci::BuildTraceChunks::Fog do ...@@ -107,37 +107,22 @@ RSpec.describe Ci::BuildTraceChunks::Fog do
let(:model) { create(:ci_build_trace_chunk, :fog_with_data, initial_data: initial_data) } let(:model) { create(:ci_build_trace_chunk, :fog_with_data, initial_data: initial_data) }
let(:data) { data_store.data(model) } let(:data) { data_store.data(model) }
context 'when ci_job_trace_force_encode is enabled' do it 'appends ASCII data' do
it 'appends ASCII data' do data_store.append_data(model, +'hello world', 4)
data_store.append_data(model, +'hello world', 4)
expect(data.encoding).to eq(Encoding::ASCII_8BIT) expect(data.encoding).to eq(Encoding::ASCII_8BIT)
expect(data.force_encoding(Encoding::UTF_8)).to eq('😺hello world') expect(data.force_encoding(Encoding::UTF_8)).to eq('😺hello world')
end end
it 'appends UTF-8 data' do
data_store.append_data(model, +'Résumé', 4)
expect(data.encoding).to eq(Encoding::ASCII_8BIT)
expect(data.force_encoding(Encoding::UTF_8)).to eq("😺Résumé")
end
context 'when initial data is UTF-8' do
let(:initial_data) { +'😺' }
it 'appends ASCII data' do it 'appends UTF-8 data' do
data_store.append_data(model, +'hello world', 4) data_store.append_data(model, +'Résumé', 4)
expect(data.encoding).to eq(Encoding::ASCII_8BIT) expect(data.encoding).to eq(Encoding::ASCII_8BIT)
expect(data.force_encoding(Encoding::UTF_8)).to eq('😺hello world') expect(data.force_encoding(Encoding::UTF_8)).to eq("😺Résumé")
end
end
end end
context 'when ci_job_trace_force_encode is disabled' do context 'when initial data is UTF-8' do
before do let(:initial_data) { +'😺' }
stub_feature_flags(ci_job_trace_force_encode: false)
end
it 'appends ASCII data' do it 'appends ASCII data' do
data_store.append_data(model, +'hello world', 4) data_store.append_data(model, +'hello world', 4)
...@@ -145,11 +130,6 @@ RSpec.describe Ci::BuildTraceChunks::Fog do ...@@ -145,11 +130,6 @@ RSpec.describe Ci::BuildTraceChunks::Fog do
expect(data.encoding).to eq(Encoding::ASCII_8BIT) expect(data.encoding).to eq(Encoding::ASCII_8BIT)
expect(data.force_encoding(Encoding::UTF_8)).to eq('😺hello world') expect(data.force_encoding(Encoding::UTF_8)).to eq('😺hello world')
end end
it 'throws an exception when appending UTF-8 data' do
expect(Gitlab::ErrorTracking).to receive(:track_and_raise_exception).and_call_original
expect { data_store.append_data(model, +'Résumé', 4) }.to raise_exception(Encoding::CompatibilityError)
end
end end
end end
......
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