Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/prometheus_exporter/client.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require_relative "../prometheus_exporter"
require "socket"
require "logger"

Expand Down
1 change: 1 addition & 0 deletions lib/prometheus_exporter/server.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require_relative "../prometheus_exporter"
require_relative "metric"
require_relative "server/type_collector"
require_relative "server/web_collector"
Expand Down
18 changes: 18 additions & 0 deletions test/client_independent_loading_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# This test verifies that the client can be loaded independently
# without requiring the main prometheus_exporter module first.
#
# DO NOT require test_helper here, as it pre-loads the main module.

require "minitest/autorun"

class ClientIndependentLoadingTest < Minitest::Test
def test_client_has_constants_when_loaded_independently
require_relative "../lib/prometheus_exporter/client"

assert_equal 9394, PrometheusExporter::DEFAULT_PORT
assert_equal "localhost", PrometheusExporter::DEFAULT_BIND_ADDRESS
assert_equal 2, PrometheusExporter::DEFAULT_TIMEOUT
end
end
20 changes: 20 additions & 0 deletions test/server_independent_loading_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

# This test verifies that the server can be loaded independently
# without requiring the main prometheus_exporter module first.
#
# DO NOT require test_helper here, as it pre-loads the main module.

require "minitest/autorun"

class ServerIndependentLoadingTest < Minitest::Test
def test_server_has_constants_when_loaded_independently
require_relative "../lib/prometheus_exporter/server"

assert_equal 9394, PrometheusExporter::DEFAULT_PORT
assert_equal "localhost", PrometheusExporter::DEFAULT_BIND_ADDRESS
assert_equal 2, PrometheusExporter::DEFAULT_TIMEOUT
assert_equal "ruby_", PrometheusExporter::DEFAULT_PREFIX
assert_equal "Prometheus Exporter", PrometheusExporter::DEFAULT_REALM
end
end