Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-07 03:36:59 +0300
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-07 03:38:52 +0300
commita7e1205219387a6d24c8579994f73a33b3028010 (patch)
tree6b0c2398d0f13d8b156eb8f74f8e4f76a9ad4dd9 /spec/models/deployment_spec.rb
parent969b812433b6030b15b591ec5862daae1b707025 (diff)
Use explicit instance of prometheus service and add access methods to it
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r--spec/models/deployment_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 4bda7d4314a..bbb7dbf0922 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -77,6 +77,35 @@ describe Deployment, models: true do
end
end
+ describe '#additional_metrics' do
+ let(:deployment) { create(:deployment) }
+
+ subject { deployment.additional_metrics }
+
+ context 'metrics are disabled' do
+ it { is_expected.to eq({}) }
+ end
+
+ context 'metrics are enabled' do
+ let(:simple_metrics) do
+ {
+ success: true,
+ metrics: {},
+ last_update: 42
+ }
+ end
+
+ let(:prometheus_service) { double('prometheus_service') }
+
+ before do
+ allow(deployment).to receive(:prometheus_service).and_return(prometheus_service)
+ allow(prometheus_service).to receive(:additional_deployment_metrics).and_return(simple_metrics)
+ end
+
+ it { is_expected.to eq(simple_metrics.merge({ deployment_time: deployment.created_at.to_i })) }
+ end
+ end
+
describe '#stop_action' do
let(:build) { create(:ci_build) }