summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/metrics_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/lib/gitlab/metrics_spec.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/lib/gitlab/metrics_spec.rb')
-rw-r--r--spec/lib/gitlab/metrics_spec.rb78
1 files changed, 0 insertions, 78 deletions
diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb
index f0ba12c1cd0..2ebe1958487 100644
--- a/spec/lib/gitlab/metrics_spec.rb
+++ b/spec/lib/gitlab/metrics_spec.rb
@@ -53,60 +53,6 @@ describe Gitlab::Metrics do
end
end
- describe '.influx_metrics_enabled?' do
- it 'returns a boolean' do
- expect(described_class.influx_metrics_enabled?).to be_in([true, false])
- end
- end
-
- describe '.submit_metrics' do
- it 'prepares and writes the metrics to InfluxDB' do
- connection = double(:connection)
- pool = double(:pool)
-
- expect(pool).to receive(:with).and_yield(connection)
- expect(connection).to receive(:write_points).with(an_instance_of(Array))
- expect(described_class).to receive(:pool).and_return(pool)
-
- described_class.submit_metrics([{ 'series' => 'kittens', 'tags' => {} }])
- end
- end
-
- describe '.prepare_metrics' do
- it 'returns a Hash with the keys as Symbols' do
- metrics = described_class
- .prepare_metrics([{ 'values' => {}, 'tags' => {} }])
-
- expect(metrics).to eq([{ values: {}, tags: {} }])
- end
-
- it 'escapes tag values' do
- metrics = described_class.prepare_metrics([
- { 'values' => {}, 'tags' => { 'foo' => 'bar=' } }
- ])
-
- expect(metrics).to eq([{ values: {}, tags: { 'foo' => 'bar\\=' } }])
- end
-
- it 'drops empty tags' do
- metrics = described_class.prepare_metrics([
- { 'values' => {}, 'tags' => { 'cats' => '', 'dogs' => nil } }
- ])
-
- expect(metrics).to eq([{ values: {}, tags: {} }])
- end
- end
-
- describe '.escape_value' do
- it 'escapes an equals sign' do
- expect(described_class.escape_value('foo=')).to eq('foo\\=')
- end
-
- it 'casts values to Strings' do
- expect(described_class.escape_value(10)).to eq('10')
- end
- end
-
describe '.measure' do
context 'without a transaction' do
it 'returns the return value of the block' do
@@ -145,30 +91,6 @@ describe Gitlab::Metrics do
end
end
- describe '.action=' do
- context 'without a transaction' do
- it 'does nothing' do
- expect_any_instance_of(Gitlab::Metrics::Transaction)
- .not_to receive(:action=)
-
- described_class.action = 'foo'
- end
- end
-
- context 'with a transaction' do
- it 'sets the action of a transaction' do
- trans = Gitlab::Metrics::WebTransaction.new({})
-
- expect(described_class).to receive(:current_transaction)
- .and_return(trans)
-
- expect(trans).to receive(:action=).with('foo')
-
- described_class.action = 'foo'
- end
- end
- end
-
describe '#series_prefix' do
it 'returns a String' do
expect(described_class.series_prefix).to be_an_instance_of(String)