Browse Source

disable if no procfs

pull/2/head
Fredrik Ekre 2 years ago
parent
commit
d21ae6937a
  1. 24
      test/runtests.jl

24
test/runtests.jl

@ -377,17 +377,19 @@ end
else else
@test length(metrics) == 0 @test length(metrics) == 0
end end
# Not a pid if procfs_available
empty!(Prometheus.DEFAULT_REGISTRY.collectors) # Not a pid
procc = Prometheus.ProcessCollector(() -> "notapid") empty!(Prometheus.DEFAULT_REGISTRY.collectors)
empty!(Prometheus.DEFAULT_REGISTRY.collectors) procc = Prometheus.ProcessCollector(() -> "notapid")
metrics = @test_logs (:error, r"/proc/notapid/ does not exist") Prometheus.collect(procc) empty!(Prometheus.DEFAULT_REGISTRY.collectors)
@test length(metrics) == 0 metrics = @test_logs (:error, r"/proc/notapid/ does not exist") Prometheus.collect(procc)
# Pid function error @test length(metrics) == 0
empty!(Prometheus.DEFAULT_REGISTRY.collectors) # Pid function error
procc = Prometheus.ProcessCollector(() -> error()) empty!(Prometheus.DEFAULT_REGISTRY.collectors)
metrics = @test_logs (:error, r"pid from the lambda") Prometheus.collect(procc) procc = Prometheus.ProcessCollector(() -> error())
@test length(metrics) == 0 metrics = @test_logs (:error, r"pid from the lambda") Prometheus.collect(procc)
@test length(metrics) == 0
end
end end
@testset "Prometheus.expose(::Union{String, IO})" begin @testset "Prometheus.expose(::Union{String, IO})" begin

Loading…
Cancel
Save