more good_job arguments, specs tolerate enqueuing user links

This commit is contained in:
Dylan Knutson
2025-02-25 17:05:33 +00:00
parent d32d583196
commit 5ad0828aa8
13 changed files with 224 additions and 151 deletions

View File

@@ -1,6 +1,20 @@
# typed: strict
unless Rails.env.test?
START_PROMETHEUS_EXPORTER =
T.let(
# do not start in test or console mode
(
!Rails.env.test? && !Rails.const_defined?("Console") &&
Rails.const_defined?("Server")
) ||
# always start in sever mode
Rails.const_defined?("Server") ||
# always start in worker mode
(Rails.env == "worker"),
T::Boolean,
)
if START_PROMETHEUS_EXPORTER
require "prometheus_exporter"
require "prometheus_exporter/client"
require "prometheus_exporter/metric"
@@ -24,6 +38,7 @@ else
# PrometheusExporter::Client is a singleton and we can't easily mock it out
# in a test environment, and simply constructing a new instance attempts to
# connect to a Prometheus server, which we can't rely on in a test environment.
$stderr.puts "PrometheusExporter is disabled in test, console, and rake task environments"
module PrometheusExporter
class Client
class RemoteMetric