Skip to content

Commit

Permalink
Use REDIS_HOST in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Feb 27, 2025
1 parent e6eba31 commit b51ff06
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions sentry-ruby/spec/sentry/breadcrumb/redis_logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "spec_helper"

RSpec.describe :redis_logger do
let(:redis) { Redis.new(host: "127.0.0.1") }
let(:redis) { Redis.new(host: REDIS_HOST) }

before do
perform_basic_setup do |config|
Expand All @@ -20,7 +20,7 @@
expect(result).to eq("OK")
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
category: "db.redis",
data: { commands: [{ command: "SET", key: "key" }], server: "127.0.0.1:6379/0" }
data: { commands: [{ command: "SET", key: "key" }], server: "#{REDIS_HOST}:6379/0" }
)
end
end
Expand All @@ -34,7 +34,7 @@
expect(result).to eq("OK")
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
category: "db.redis",
data: { commands: [{ command: "SET", key: "key", arguments: "value" }], server: "127.0.0.1:6379/0" }
data: { commands: [{ command: "SET", key: "key", arguments: "value" }], server: "#{REDIS_HOST}:6379/0" }
)
end

Expand Down Expand Up @@ -62,7 +62,7 @@
expect(result.key?("uptime_in_days")).to eq(true)
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
category: "db.redis",
data: { commands: [{ command: "INFO", key: nil }], server: "127.0.0.1:6379/0" }
data: { commands: [{ command: "INFO", key: nil }], server: "#{REDIS_HOST}:6379/0" }
)
end
end
Expand All @@ -88,7 +88,7 @@
{ command: "INCR", key: "counter" },
{ command: "EXEC", key: nil }
],
server: "127.0.0.1:6379/0"
server: "#{REDIS_HOST}:6379/0"
}
)
end
Expand All @@ -105,7 +105,7 @@
expect(result).to eq("OK")
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
category: "db.redis",
data: { commands: [{ command: "SET", key: "key" }], server: "127.0.0.1:6379/0" }
data: { commands: [{ command: "SET", key: "key" }], server: "#{REDIS_HOST}:6379/0" }
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions sentry-ruby/spec/sentry/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "spec_helper"

RSpec.describe Sentry::Redis do
let(:redis) { Redis.new(host: "127.0.0.1") }
let(:redis) { Redis.new(host: REDIS_HOST) }

context "with tracing enabled" do
before do
Expand Down Expand Up @@ -33,7 +33,7 @@
expect(request_span.data).to eq({
"db.name" => 0,
"db.system" => "redis",
"server.address" => "127.0.0.1",
"server.address" => REDIS_HOST,
"server.port" => 6379
})
end
Expand Down
2 changes: 2 additions & 0 deletions sentry-ruby/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
coverage_dir File.join(__FILE__, "../../coverage")
end

REDIS_HOST = ENV.fetch("REDIS_HOST", "127.0.0.1")

if ENV["CI"]
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
Expand Down

0 comments on commit b51ff06

Please sign in to comment.