Skip to content

Commit

Permalink
Update development dependencies (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
codez authored May 30, 2024
1 parent 66c1f39 commit 3de69ad
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 25 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ Discourse/Plugins/NoMonkeyPatching:
Discourse/Plugins/NamespaceMethods:
Exclude:
- bin/prometheus_exporter

Style/InvertibleUnlessCondition:
Exclude:
- '*.gemspec'
6 changes: 3 additions & 3 deletions prometheus_exporter.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rubocop", ">= 0.69"
spec.add_development_dependency "bundler", ">= 2.1.4"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "minitest", "~> 5.15.0" # https://github.com/qrush/m/issues/93
spec.add_development_dependency "minitest", "~> 5.23.0"
spec.add_development_dependency "guard", "~> 2.0"
spec.add_development_dependency "mini_racer", "~> 0.5.0"
spec.add_development_dependency "mini_racer", "~> 0.12.0"
spec.add_development_dependency "guard-minitest", "~> 2.0"
spec.add_development_dependency "oj", "~> 3.0"
spec.add_development_dependency "rack-test", "~> 0.8.3"
spec.add_development_dependency "rack-test", "~> 2.1.0"
spec.add_development_dependency "minitest-stub-const", "~> 0.6"
spec.add_development_dependency "rubocop-discourse", ">= 3"
spec.add_development_dependency "appraisal", "~> 2.3"
Expand Down
20 changes: 10 additions & 10 deletions test/middleware_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_patch_called_with_prepend_instrument
Object.stub_const(:Redis, Module) do
::Redis.stub_const(:Client) do
mock = Minitest::Mock.new
mock.expect :call, nil, [Redis::Client, Array, :redis, { instrument: :prepend }]
mock.expect :call, nil, [Redis::Client, Array, :redis], instrument: :prepend
::PrometheusExporter::Instrumentation::MethodProfiler.stub(:patch, mock) do
configure_middleware(instrument: :prepend)
end
Expand All @@ -144,7 +144,7 @@ def test_patch_called_with_prepend_instrument
Object.stub_const(:PG, Module) do
::PG.stub_const(:Connection) do
mock = Minitest::Mock.new
mock.expect :call, nil, [PG::Connection, Array, :sql, { instrument: :prepend }]
mock.expect :call, nil, [PG::Connection, Array, :sql], instrument: :prepend
::PrometheusExporter::Instrumentation::MethodProfiler.stub(:patch, mock) do
configure_middleware(instrument: :prepend)
end
Expand All @@ -155,9 +155,9 @@ def test_patch_called_with_prepend_instrument
Object.stub_const(:Mysql2, Module) do
::Mysql2.stub_consts({ Client: nil, Statement: nil, Result: nil }) do
mock = Minitest::Mock.new
mock.expect :call, nil, [Mysql2::Client, Array, :sql, { instrument: :prepend }]
mock.expect :call, nil, [Mysql2::Statement, Array, :sql, { instrument: :prepend }]
mock.expect :call, nil, [Mysql2::Result, Array, :sql, { instrument: :prepend }]
mock.expect :call, nil, [Mysql2::Client, Array, :sql], instrument: :prepend
mock.expect :call, nil, [Mysql2::Statement, Array, :sql], instrument: :prepend
mock.expect :call, nil, [Mysql2::Result, Array, :sql], instrument: :prepend
::PrometheusExporter::Instrumentation::MethodProfiler.stub(:patch, mock) do
configure_middleware(instrument: :prepend)
end
Expand All @@ -172,7 +172,7 @@ def test_patch_called_with_alias_method_instrument
::Redis.stub_const(:VERSION, '4.0.4') do
::Redis.stub_const(:Client) do
mock = Minitest::Mock.new
mock.expect :call, nil, [Redis::Client, Array, :redis, { instrument: :alias_method }]
mock.expect :call, nil, [Redis::Client, Array, :redis], instrument: :alias_method
::PrometheusExporter::Instrumentation::MethodProfiler.stub(:patch, mock) do
configure_middleware
end
Expand All @@ -184,7 +184,7 @@ def test_patch_called_with_alias_method_instrument
Object.stub_const(:PG, Module) do
::PG.stub_const(:Connection) do
mock = Minitest::Mock.new
mock.expect :call, nil, [PG::Connection, Array, :sql, { instrument: :alias_method }]
mock.expect :call, nil, [PG::Connection, Array, :sql], instrument: :alias_method
::PrometheusExporter::Instrumentation::MethodProfiler.stub(:patch, mock) do
configure_middleware
end
Expand All @@ -195,9 +195,9 @@ def test_patch_called_with_alias_method_instrument
Object.stub_const(:Mysql2, Module) do
::Mysql2.stub_consts({ Client: nil, Statement: nil, Result: nil }) do
mock = Minitest::Mock.new
mock.expect :call, nil, [Mysql2::Client, Array, :sql, { instrument: :alias_method }]
mock.expect :call, nil, [Mysql2::Statement, Array, :sql, { instrument: :alias_method }]
mock.expect :call, nil, [Mysql2::Result, Array, :sql, { instrument: :alias_method }]
mock.expect :call, nil, [Mysql2::Client, Array, :sql], instrument: :alias_method
mock.expect :call, nil, [Mysql2::Statement, Array, :sql], instrument: :alias_method
mock.expect :call, nil, [Mysql2::Result, Array, :sql], instrument: :alias_method
::PrometheusExporter::Instrumentation::MethodProfiler.stub(:patch, mock) do
configure_middleware
end
Expand Down
20 changes: 10 additions & 10 deletions test/server/collector_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,15 @@ def test_it_can_collect_sidekiq_metrics_with_custom_labels_from_worker_class
queue = "default"

client = Minitest::Mock.new
client.expect(:send_json, '', [{
client.expect(:send_json, '', [],
type: "sidekiq",
name: "PrometheusCollectorTest::#{worker_class}",
queue: queue,
success: true,
shutdown: false,
duration: 0,
custom_labels: WorkerWithCustomLabels.custom_labels
}])
)

::Process.stub(:clock_gettime, 1, ::Process::CLOCK_MONOTONIC) do
instrument = PrometheusExporter::Instrumentation::Sidekiq.new(client: client)
Expand All @@ -386,15 +386,15 @@ def test_it_can_collect_sidekiq_metrics_with_custom_labels_from_job
queue = "default"

client = Minitest::Mock.new
client.expect(:send_json, '', [{
client.expect(:send_json, '', [],
type: "sidekiq",
name: "PrometheusCollectorTest::#{worker_class}",
queue: queue,
success: true,
shutdown: false,
duration: 0,
custom_labels: { first_job_arg: 'arg_one' }
}])
)

::Process.stub(:clock_gettime, 1, ::Process::CLOCK_MONOTONIC) do
instrument = PrometheusExporter::Instrumentation::Sidekiq.new(client: client)
Expand All @@ -416,12 +416,12 @@ def test_it_can_collect_sidekiq_metrics_on_job_death
worker = Minitest::Mock.new

client = Minitest::Mock.new
client.expect(:send_json, '', [{
client.expect(:send_json, '', [],
type: "sidekiq",
name: job["class"],
dead: true,
custom_labels: {}
}])
)

Object.stub(:const_get, worker, [job['class']]) do
PrometheusExporter::Client.stub(:default, client) do
Expand All @@ -444,12 +444,12 @@ def test_it_can_collect_sidekiq_metrics_on_job_death_for_delayed
worker = Minitest::Mock.new

client = Minitest::Mock.new
client.expect(:send_json, '', [{
client.expect(:send_json, '', [],
type: "sidekiq",
name: "DelayedAction#foo",
dead: true,
custom_labels: {}
}])
)

Object.stub(:const_get, worker, [job['class']]) do
PrometheusExporter::Client.stub(:default, client) do
Expand All @@ -469,12 +469,12 @@ def test_it_can_collect_sidekiq_metrics_on_job_death_with_custom_labels_from_wor
}

client = Minitest::Mock.new
client.expect(:send_json, '', [{
client.expect(:send_json, '', [],
type: "sidekiq",
name: job["class"],
dead: true,
custom_labels: WorkerWithCustomLabels.custom_labels
}])
)

Object.stub(:const_get, WorkerWithCustomLabels, [job['class']]) do
PrometheusExporter::Client.stub(:default, client) do
Expand Down
4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
require "prometheus_exporter"

require "minitest/autorun"

require "ostruct"
require "redis"

module TestingMod
class FakeConnection
def call_pipelined(_, _)
def call_pipelined(_, _, _)
end

def call(_, _)
Expand Down

0 comments on commit 3de69ad

Please sign in to comment.