diff options
Diffstat (limited to 'qa/spec/support/loglinking_spec.rb')
-rw-r--r-- | qa/spec/support/loglinking_spec.rb | 62 |
1 files changed, 4 insertions, 58 deletions
diff --git a/qa/spec/support/loglinking_spec.rb b/qa/spec/support/loglinking_spec.rb index d1cc76bccc4..10865068e3d 100644 --- a/qa/spec/support/loglinking_spec.rb +++ b/qa/spec/support/loglinking_spec.rb @@ -29,7 +29,7 @@ RSpec.describe QA::Support::Loglinking do expect(QA::Support::Loglinking.failure_metadata('foo123')).to eql(<<~ERROR.chomp) Correlation Id: foo123 - Kibana Url: https://kibana.address/app/discover#/?_a=(query:(language:kuery,query:'json.correlation_id%20:%20foo123'))&_g=(time:(from:now-24h%2Fh,to:now)) + Kibana Url: https://kibana.address/app/discover#/?_a=%28query%3A%28language%3Akuery%2Cquery%3A%27json.correlation_id%20%3A%20foo123%27%29%29&_g=%28time%3A%28from%3Anow-24h%2Cto%3Anow%29%29 ERROR end end @@ -39,11 +39,9 @@ RSpec.describe QA::Support::Loglinking do let(:url_hash) do { :staging => 'https://sentry.gitlab.net/gitlab/staginggitlabcom/?environment=gstg', - :staging_canary => 'https://sentry.gitlab.net/gitlab/staginggitlabcom/?environment=gstg-cny', - :staging_ref => 'https://sentry.gitlab.net/gitlab/staging-ref/?environment=gstg-ref', - :pre => 'https://sentry.gitlab.net/gitlab/pregitlabcom/?environment=pre', - :canary => 'https://sentry.gitlab.net/gitlab/gitlabcom/?environment=gprd', - :production => 'https://sentry.gitlab.net/gitlab/gitlabcom/?environment=gprd-cny', + :staging_ref => 'https://sentry.gitlab.net/gitlab/staging-ref/?environment=all', + :pre => 'https://sentry.gitlab.net/gitlab/pregitlabcom/?environment=all', + :production => 'https://sentry.gitlab.net/gitlab/gitlabcom/?environment=gprd', :foo => nil, nil => nil } @@ -62,10 +60,7 @@ RSpec.describe QA::Support::Loglinking do let(:url_hash) do { :staging => 'https://nonprod-log.gitlab.net/', - :staging_canary => 'https://nonprod-log.gitlab.net/', :staging_ref => nil, - :pre => nil, - :canary => 'https://log.gprd.gitlab.net/', :production => 'https://log.gprd.gitlab.net/', :foo => nil, nil => nil @@ -90,37 +85,22 @@ RSpec.describe QA::Support::Loglinking do [ { address: staging_address, - canary: false, expected_env: :staging }, { - address: staging_address, - canary: true, - expected_env: :staging_canary - }, - { address: staging_ref_address, - canary: true, expected_env: :staging_ref }, { address: production_address, - canary: false, expected_env: :production }, { - address: production_address, - canary: true, - expected_env: :canary - }, - { address: pre_prod_address, - canary: true, expected_env: :pre }, { address: 'https://foo.com', - canary: true, expected_env: nil } ] @@ -129,7 +109,6 @@ RSpec.describe QA::Support::Loglinking do it 'returns logging environment if environment found' do logging_env_array.each do |logging_env_hash| allow(QA::Runtime::Scenario).to receive(:attributes).and_return({ gitlab_address: logging_env_hash[:address] }) - allow(QA::Support::Loglinking).to receive(:canary?).and_return(logging_env_hash[:canary]) expect(QA::Support::Loglinking.logging_environment).to eq(logging_env_hash[:expected_env]) end @@ -151,37 +130,4 @@ RSpec.describe QA::Support::Loglinking do end end end - - describe '.cookies' do - let(:cookies) { [{ name: 'Foo', value: 'Bar' }, { name: 'gitlab_canary', value: 'true' }] } - - it 'returns browser cookies' do - allow(Capybara.current_session).to receive_message_chain(:driver, :browser, :manage, :all_cookies).and_return(cookies) - - expect(QA::Support::Loglinking.cookies).to eq({ "Foo" => { name: "Foo", value: "Bar" }, "gitlab_canary" => { name: "gitlab_canary", value: "true" } }) - end - end - - describe '.canary?' do - context 'gitlab_canary cookie is present' do - it 'and true returns true' do - allow(QA::Support::Loglinking).to receive(:cookies).and_return({ 'gitlab_canary' => { name: 'gitlab_canary', value: 'true' } }) - - expect(QA::Support::Loglinking.canary?).to eq(true) - end - - it 'and not true returns false' do - allow(QA::Support::Loglinking).to receive(:cookies).and_return({ 'gitlab_canary' => { name: 'gitlab_canary', value: 'false' } }) - - expect(QA::Support::Loglinking.canary?).to eq(false) - end - end - context 'gitlab_canary cookie is not present' do - it 'returns false' do - allow(QA::Support::Loglinking).to receive(:cookies).and_return({ 'foo' => { name: 'foo', path: '/pathname' } }) - - expect(QA::Support::Loglinking.canary?).to eq(false) - end - end - end end |