summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-10-12 16:10:47 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2016-10-12 16:11:50 +0200
commit1d68fefe5016baa61043e72ba7ee5458eded8634 (patch)
treee40a001e12b025cf5934e9393c4baa17a35e9990 /spec
parent3cba0e6ea6d30e9faca7727b66eb9ddfe5b5b51c (diff)
downloadgitlab-shell-1d68fefe5016baa61043e72ba7ee5458eded8634.tar.gz
Re-use the default logger for performance metrics
This removes the need for configuring anything extra. To make scraping easier each line is prefixed by "metrics:". Fixes #64
Diffstat (limited to 'spec')
-rw-r--r--spec/gitlab_metrics_spec.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/spec/gitlab_metrics_spec.rb b/spec/gitlab_metrics_spec.rb
index 885fa3b..07be670 100644
--- a/spec/gitlab_metrics_spec.rb
+++ b/spec/gitlab_metrics_spec.rb
@@ -2,22 +2,18 @@ require_relative 'spec_helper'
require_relative '../lib/gitlab_metrics'
describe GitlabMetrics do
- describe '::measure' do
+ describe '.measure' do
it 'returns the return value of the block' do
val = described_class.measure('foo') { 10 }
expect(val).to eq(10)
end
- it 'write in a file metrics data' do
- result = nil
- expect(described_class.logger).to receive(:debug) do |&b|
- result = b.call
- end
+ it 'writes the metrics data to a log file' do
+ expect(described_class.logger).to receive(:debug).
+ with(/metrics: name=\"foo\" wall_time=\d+ cpu_time=\d+/)
described_class.measure('foo') { 10 }
-
- expect(result).to match(/name=\"foo\" wall_time=\d+ cpu_time=\d+/)
end
it 'calls proper measure methods' do