diff options
Diffstat (limited to 'spec/lib/gitlab/ci/trace/stream_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/trace/stream_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb index e28469c9404..d65b6fb41f6 100644 --- a/spec/lib/gitlab/ci/trace/stream_spec.rb +++ b/spec/lib/gitlab/ci/trace/stream_spec.rb @@ -151,6 +151,28 @@ RSpec.describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do it_behaves_like 'appends' end + + describe 'metrics' do + let(:metrics) { spy('metrics') } + let(:io) { StringIO.new } + let(:stream) { described_class.new(metrics) { io } } + + it 'increments trace streamed operation' do + stream.append(+'123456', 0) + + expect(metrics) + .to have_received(:increment_trace_operation) + .with(operation: :streamed) + end + + it 'increments trace bytes counter' do + stream.append(+'123456', 0) + + expect(metrics) + .to have_received(:increment_trace_bytes) + .with(6) + end + end end describe '#set' do |