diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2017-09-20 16:03:53 +0200 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2017-10-03 11:35:23 +0200 |
commit | 570940858599fb2f4e5410b9a6743a0aeb0a09e7 (patch) | |
tree | 919a699d9b165be1bac447550a5fa1aba91cf456 /spec/lib | |
parent | d103e95513704314a38ab8ae441851524031c4a1 (diff) | |
download | gitlab-ce-570940858599fb2f4e5410b9a6743a0aeb0a09e7.tar.gz |
Hide CI section markers from job trace
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ci/ansi2html_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/ansi2html_spec.rb b/spec/lib/gitlab/ci/ansi2html_spec.rb index e6645985ba4..33540eab5d6 100644 --- a/spec/lib/gitlab/ci/ansi2html_spec.rb +++ b/spec/lib/gitlab/ci/ansi2html_spec.rb @@ -195,6 +195,32 @@ describe Gitlab::Ci::Ansi2html do end end + context "with section markers" do + let(:section_name) { 'test_section' } + let(:section_start_time) { Time.new(2017, 9, 20).utc } + let(:section_duration) { 3.seconds } + let(:section_end_time) { section_start_time + section_duration } + let(:section_start) { "section_start:#{section_start_time.to_i}:#{section_name}\r\033[0K"} + let(:section_end) { "section_end:#{section_end_time.to_i}:#{section_name}\r\033[0K"} + let(:section_start_html) do + '<div class="hidden" data-action="start"'\ + " data-timestamp=\"#{section_start_time.to_i}\" data-section=\"#{section_name}\">"\ + "#{section_start[0...-5]}</div>" + end + let(:section_end_html) do + '<div class="hidden" data-action="end"'\ + " data-timestamp=\"#{section_end_time.to_i}\" data-section=\"#{section_name}\">"\ + "#{section_end[0...-5]}</div>" + end + + it "prints light red" do + text = "#{section_start}\e[91mHello\e[0m\n#{section_end}" + html = %{#{section_start_html}<span class="term-fg-l-red">Hello</span><br>#{section_end_html}} + + expect(convert_html(text)).to eq(html) + end + end + describe "truncates" do let(:text) { "Hello World" } let(:stream) { StringIO.new(text) } |