diff options
Diffstat (limited to 'qa/spec/support')
-rw-r--r-- | qa/spec/support/loglinking_spec.rb | 34 | ||||
-rw-r--r-- | qa/spec/support/page_error_checker_spec.rb | 5 |
2 files changed, 23 insertions, 16 deletions
diff --git a/qa/spec/support/loglinking_spec.rb b/qa/spec/support/loglinking_spec.rb index e02ae45ee93..d1cc76bccc4 100644 --- a/qa/spec/support/loglinking_spec.rb +++ b/qa/spec/support/loglinking_spec.rb @@ -6,6 +6,7 @@ RSpec.describe QA::Support::Loglinking do it 'if correlation_id is empty' do expect(QA::Support::Loglinking.failure_metadata('')).to eq(nil) end + it 'if correlation_id is nil' do expect(QA::Support::Loglinking.failure_metadata(nil)).to eq(nil) end @@ -37,14 +38,14 @@ RSpec.describe QA::Support::Loglinking do describe '.sentry_url' 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', - :foo => nil, - nil => nil + :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', + :foo => nil, + nil => nil } end @@ -60,14 +61,14 @@ RSpec.describe QA::Support::Loglinking do describe '.kibana_url' 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 + :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 } end @@ -168,6 +169,7 @@ RSpec.describe QA::Support::Loglinking do 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' } }) diff --git a/qa/spec/support/page_error_checker_spec.rb b/qa/spec/support/page_error_checker_spec.rb index ab7014f4677..735c0f83ecd 100644 --- a/qa/spec/support/page_error_checker_spec.rb +++ b/qa/spec/support/page_error_checker_spec.rb @@ -113,6 +113,7 @@ RSpec.describe QA::Support::PageErrorChecker do expect(QA::Support::PageErrorChecker.parse_five_c_page_request_id(page).to_str).to eq('req678') end + it 'returns nil if not present' do allow(page).to receive(:html).and_return(error_500_no_code_str) allow(Nokogiri::HTML).to receive(:parse).with(error_500_no_code_str).and_return(NokogiriParse.parse(error_500_no_code_str)) @@ -217,6 +218,7 @@ RSpec.describe QA::Support::PageErrorChecker do expect(QA::Support::PageErrorChecker).to receive(:report!).with(page, 404) QA::Support::PageErrorChecker.check_page_for_error_code(page) end + it 'calls report with 500 if 500 found' do allow(page).to receive(:html).and_return(error_500_str) allow(Nokogiri::HTML).to receive(:parse).with(error_500_str).and_return(NokogiriParse.parse(error_500_str)) @@ -224,6 +226,7 @@ RSpec.describe QA::Support::PageErrorChecker do expect(QA::Support::PageErrorChecker).to receive(:report!).with(page, 500) QA::Support::PageErrorChecker.check_page_for_error_code(page) end + it 'calls report with 500 if GDK backtrace found' do allow(page).to receive(:html).and_return(backtrace_str) allow(Nokogiri::HTML).to receive(:parse).with(backtrace_str).and_return(NokogiriParse.parse(backtrace_str)) @@ -231,6 +234,7 @@ RSpec.describe QA::Support::PageErrorChecker do expect(QA::Support::PageErrorChecker).to receive(:report!).with(page, 500) QA::Support::PageErrorChecker.check_page_for_error_code(page) end + it 'does not call report if 500 found in project name' do allow(page).to receive(:html).and_return(project_name_500_str) allow(Nokogiri::HTML).to receive(:parse).with(project_name_500_str).and_return(NokogiriParse.parse(project_name_500_str)) @@ -238,6 +242,7 @@ RSpec.describe QA::Support::PageErrorChecker do expect(QA::Support::PageErrorChecker).not_to receive(:report!) QA::Support::PageErrorChecker.check_page_for_error_code(page) end + it 'does not call report if no 404, 500 or backtrace found' do allow(page).to receive(:html).and_return(no_error_str) allow(Nokogiri::HTML).to receive(:parse).with(no_error_str).and_return(NokogiriParse.parse(no_error_str)) |