diff --git a/spec/mnemosyne/probes/redis-client/command_spec.rb b/spec/mnemosyne/probes/redis-client/command_spec.rb index c08c8c0..13f593e 100644 --- a/spec/mnemosyne/probes/redis-client/command_spec.rb +++ b/spec/mnemosyne/probes/redis-client/command_spec.rb @@ -29,19 +29,19 @@ trace.span[0].tap do |span| expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'HELLO ?' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379' end trace.span[1].tap do |span| expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'SET mykey ?' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379' end trace.span[2].tap do |span| expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'GET mykey' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379' end end @@ -60,14 +60,14 @@ trace.span[0].tap do |span| expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'HELLO ?' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379' end trace.span[1].tap do |span| expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq "SET foo ?\nSET baz ?" expect(span.meta[:pipelined]).to eq true - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379' end end @@ -83,14 +83,14 @@ trace.span[0].tap do |span| expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'HELLO ?' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379' end trace.span[1].tap do |span| expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'UNKNOWN_FUNCTION ?' expect(span.meta[:error]).to start_with 'ERR unknown command' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379' end end end diff --git a/spec/mnemosyne/probes/redis/command_spec.rb b/spec/mnemosyne/probes/redis/command_spec.rb index 9b076bc..94c0550 100644 --- a/spec/mnemosyne/probes/redis/command_spec.rb +++ b/spec/mnemosyne/probes/redis/command_spec.rb @@ -27,12 +27,12 @@ span = trace.span[0] expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'SET mykey ?' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to match %r{^redis://127.0.0.1:16379(/0)?$} span = trace.span[1] expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'GET mykey' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to match %r{^redis://127.0.0.1:16379(/0)?$} end it 'creates just one span for pipelined (parallel) commands' do @@ -51,7 +51,7 @@ expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq "SET foo ?\nSET baz ?" expect(span.meta[:pipelined]).to eq true - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to match %r{^redis://127.0.0.1:16379(/0)?$} end it 'traces queued commands (also run in parallel when committing)' do @@ -74,7 +74,7 @@ expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq "SET mykey ?\nSET foo ?" expect(span.meta[:pipelined]).to eq true - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to match %r{^redis://127.0.0.1:16379(/0)?$} end it 'traces commands queued with array syntax' do @@ -97,7 +97,7 @@ expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq "SET mykey ?\nSET foo ?" expect(span.meta[:pipelined]).to eq true - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to match %r{^redis://127.0.0.1:16379(/0)?$} end it 'attaches errors to the span' do @@ -113,6 +113,6 @@ expect(span.name).to eq 'db.query.redis' expect(span.meta[:commands]).to eq 'UNKNOWN_FUNCTION ?' expect(span.meta[:error]).to start_with 'ERR unknown command' - expect(span.meta[:server]).to eq 'redis://127.0.0.1:16379/0' + expect(span.meta[:server]).to match %r{^redis://127.0.0.1:16379(/0)?$} end end