File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
spec/unit/lib/delayed_job_plugins Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 1- require 'db_spec_helper '
1+ require 'spec_helper '
22
33RSpec . describe DelayedJobMetrics ::Plugin do
4- let ( :prometheus ) { instance_double ( VCAP ::CloudController ::Metrics ::PrometheusUpdater ) }
54 let ( :worker ) { instance_double ( Delayed ::Worker , name : 'test_worker' ) }
65
76 before do
8- allow ( CloudController ::DependencyLocator . instance ) . to receive ( :cc_worker_prometheus_updater ) . and_return ( prometheus )
9- allow ( prometheus ) . to receive ( :update_histogram_metric )
7+ @prometheus = instance_double ( VCAP ::CloudController ::Metrics ::PrometheusUpdater )
8+ allow ( CloudController ::DependencyLocator . instance ) . to receive ( :cc_worker_prometheus_updater ) . and_return ( @prometheus )
9+ allow ( @prometheus ) . to receive ( :update_histogram_metric )
1010 end
1111
1212 it 'loads the plugin' do
2525 worker = Delayed ::Worker . new
2626 worker . name = 'test_worker'
2727 worker . work_off ( 1 )
28- # Debug plugins
29- puts "Plugins: #{ Delayed ::Worker . plugins . inspect } "
3028
31- expect ( prometheus ) . to have_received ( :update_histogram_metric ) . with (
29+ expect ( @ prometheus) . to have_received ( :update_histogram_metric ) . with (
3230 :cc_job_pickup_delay_seconds ,
3331 be_within ( 0.5 ) . of ( 10.0 ) ,
3432 labels : { queue : VCAP ::CloudController ::Jobs ::Queues . generic , worker : 'test_worker' }
3533 ) . once
3634
37- expect ( prometheus ) . to have_received ( :update_histogram_metric ) . with (
35+ expect ( @ prometheus) . to have_received ( :update_histogram_metric ) . with (
3836 :cc_job_duration_seconds ,
3937 kind_of ( Numeric ) ,
4038 labels : { queue : VCAP ::CloudController ::Jobs ::Queues . generic , worker : 'test_worker' }
You can’t perform that action at this time.
0 commit comments