diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 18:08:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 18:08:05 +0000 |
commit | 184c2ced0761bd8dd7032619d16d3983fed7944a (patch) | |
tree | cc82b32ee7c1797509da3cf384617e4ffa2e1733 /spec/initializers | |
parent | 238d22c07218adf2b8f3db630ee8b74ca6f29df5 (diff) | |
download | gitlab-ce-184c2ced0761bd8dd7032619d16d3983fed7944a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers')
-rw-r--r-- | spec/initializers/lograge_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/initializers/lograge_spec.rb b/spec/initializers/lograge_spec.rb index 24d366731a2..c2c1960eeab 100644 --- a/spec/initializers/lograge_spec.rb +++ b/spec/initializers/lograge_spec.rb @@ -34,5 +34,38 @@ describe 'lograge', type: :request do subject end + + it 'logs cpu_s on supported platform' do + allow(Gitlab::Metrics::System).to receive(:thread_cpu_time) + .and_return( + 0.111222333, + 0.222333833 + ) + + expect(Lograge.formatter).to receive(:call) + .with(a_hash_including(cpu_s: 0.1111115)) + .and_call_original + + expect(Lograge.logger).to receive(:send) + .with(anything, include('"cpu_s":0.1111115')) + .and_call_original + + subject + end + + it 'does not log cpu_s on unsupported platform' do + allow(Gitlab::Metrics::System).to receive(:thread_cpu_time) + .and_return(nil) + + expect(Lograge.formatter).to receive(:call) + .with(hash_not_including(:cpu_s)) + .and_call_original + + expect(Lograge.logger).not_to receive(:send) + .with(anything, include('"cpu_s":')) + .and_call_original + + subject + end end end |