summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2015-12-14 17:37:20 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2015-12-17 17:25:48 +0100
commitd67e2045a02d105bfbc7abf1805fe477eb9155ca (patch)
treecb071d61f409169b7014e27a73e29279d6a72e1e /spec/workers
parent5142c61707cc4169a3f8d9e378aacb8f88760db5 (diff)
downloadgitlab-ce-d67e2045a02d105bfbc7abf1805fe477eb9155ca.tar.gz
Drop empty tag values from metrics
InfluxDB throws an error when trying to store a list of tags where one or more have an empty value.
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/metrics_worker_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/workers/metrics_worker_spec.rb b/spec/workers/metrics_worker_spec.rb
index f5650494c7c..2acd0f8ba30 100644
--- a/spec/workers/metrics_worker_spec.rb
+++ b/spec/workers/metrics_worker_spec.rb
@@ -30,6 +30,14 @@ describe MetricsWorker do
expect(metrics).to eq([{ values: {}, tags: { 'foo' => 'bar\\=' } }])
end
+
+ it 'drops empty tags' do
+ metrics = worker.prepare_metrics([
+ { 'values' => {}, 'tags' => { 'cats' => '', 'dogs' => nil }}
+ ])
+
+ expect(metrics).to eq([{ values: {}, tags: {} }])
+ end
end
describe '#escape_value' do