Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b51ff06

Browse files
committedFeb 27, 2025··
Use REDIS_HOST in specs
1 parent e6eba31 commit b51ff06

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed
 

‎sentry-ruby/spec/sentry/breadcrumb/redis_logger_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "spec_helper"
44

55
RSpec.describe :redis_logger do
6-
let(:redis) { Redis.new(host: "127.0.0.1") }
6+
let(:redis) { Redis.new(host: REDIS_HOST) }
77

88
before do
99
perform_basic_setup do |config|
@@ -20,7 +20,7 @@
2020
expect(result).to eq("OK")
2121
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
2222
category: "db.redis",
23-
data: { commands: [{ command: "SET", key: "key" }], server: "127.0.0.1:6379/0" }
23+
data: { commands: [{ command: "SET", key: "key" }], server: "#{REDIS_HOST}:6379/0" }
2424
)
2525
end
2626
end
@@ -34,7 +34,7 @@
3434
expect(result).to eq("OK")
3535
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
3636
category: "db.redis",
37-
data: { commands: [{ command: "SET", key: "key", arguments: "value" }], server: "127.0.0.1:6379/0" }
37+
data: { commands: [{ command: "SET", key: "key", arguments: "value" }], server: "#{REDIS_HOST}:6379/0" }
3838
)
3939
end
4040

@@ -62,7 +62,7 @@
6262
expect(result.key?("uptime_in_days")).to eq(true)
6363
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
6464
category: "db.redis",
65-
data: { commands: [{ command: "INFO", key: nil }], server: "127.0.0.1:6379/0" }
65+
data: { commands: [{ command: "INFO", key: nil }], server: "#{REDIS_HOST}:6379/0" }
6666
)
6767
end
6868
end
@@ -88,7 +88,7 @@
8888
{ command: "INCR", key: "counter" },
8989
{ command: "EXEC", key: nil }
9090
],
91-
server: "127.0.0.1:6379/0"
91+
server: "#{REDIS_HOST}:6379/0"
9292
}
9393
)
9494
end
@@ -105,7 +105,7 @@
105105
expect(result).to eq("OK")
106106
expect(Sentry.get_current_scope.breadcrumbs.peek).to have_attributes(
107107
category: "db.redis",
108-
data: { commands: [{ command: "SET", key: "key" }], server: "127.0.0.1:6379/0" }
108+
data: { commands: [{ command: "SET", key: "key" }], server: "#{REDIS_HOST}:6379/0" }
109109
)
110110
end
111111
end

‎sentry-ruby/spec/sentry/redis_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "spec_helper"
44

55
RSpec.describe Sentry::Redis do
6-
let(:redis) { Redis.new(host: "127.0.0.1") }
6+
let(:redis) { Redis.new(host: REDIS_HOST) }
77

88
context "with tracing enabled" do
99
before do
@@ -33,7 +33,7 @@
3333
expect(request_span.data).to eq({
3434
"db.name" => 0,
3535
"db.system" => "redis",
36-
"server.address" => "127.0.0.1",
36+
"server.address" => REDIS_HOST,
3737
"server.port" => 6379
3838
})
3939
end

‎sentry-ruby/spec/spec_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
coverage_dir File.join(__FILE__, "../../coverage")
1919
end
2020

21+
REDIS_HOST = ENV.fetch("REDIS_HOST", "127.0.0.1")
22+
2123
if ENV["CI"]
2224
require 'simplecov-cobertura'
2325
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter

0 commit comments

Comments
 (0)
Please sign in to comment.