diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /qa/spec/support/system_logs/kibana_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'qa/spec/support/system_logs/kibana_spec.rb')
-rw-r--r-- | qa/spec/support/system_logs/kibana_spec.rb | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/qa/spec/support/system_logs/kibana_spec.rb b/qa/spec/support/system_logs/kibana_spec.rb new file mode 100644 index 00000000000..7e13f5a0a06 --- /dev/null +++ b/qa/spec/support/system_logs/kibana_spec.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +RSpec.describe QA::Support::SystemLogs::Kibana do + using RSpec::Parameterized::TableSyntax + + let(:correlation_id) { 'foo123' } + + shared_examples 'returns the expected URL' do + where(:env, :expected_url) do + :staging | ref(:staging_url) + :production | ref(:production_url) + :pre | ref(:pre_url) + :foo | nil + nil | nil + end + + with_them do + before do + allow(Time).to receive(:now).and_return(Time.new(2022, 11, 14, 0, 0, 0, '+00:00')) + end + + specify do + expect(subject).to eq(expected_url) + end + end + end + + describe '#discover_url' do + subject { described_class.new(env, correlation_id).discover_url } + + let(:staging_url) do + "https://nonprod-log.gitlab.net/app/discover#/?_a=%28index:%27ed942d00-5186-11ea-ad8a-f3610a492295%27" \ + "%2Cquery%3A%28language%3Akuery%2Cquery%3A%27json.correlation_id%20%3A%20#{correlation_id}%27%29" \ + "%29&_g=%28time%3A%28from%3A%272022-11-13T00:00:00.000Z%27%2Cto%3A%272022-11-14T00:00:00.000Z%27%29%29" + end + + let(:production_url) do + "https://log.gprd.gitlab.net/app/discover#/?_a=%28index:%277092c4e2-4eb5-46f2-8305-a7da2edad090%27" \ + "%2Cquery%3A%28language%3Akuery%2Cquery%3A%27json.correlation_id%20%3A%20#{correlation_id}%27%29" \ + "%29&_g=%28time%3A%28from%3A%272022-11-13T00:00:00.000Z%27%2Cto%3A%272022-11-14T00:00:00.000Z%27%29%29" + end + + let(:pre_url) do + "https://nonprod-log.gitlab.net/app/discover#/?_a=%28index:%27pubsub-rails-inf-pre%27" \ + "%2Cquery%3A%28language%3Akuery%2Cquery%3A%27json.correlation_id%20%3A%20#{correlation_id}%27%29" \ + "%29&_g=%28time%3A%28from%3A%272022-11-13T00:00:00.000Z%27%2Cto%3A%272022-11-14T00:00:00.000Z%27%29%29" + end + + it_behaves_like 'returns the expected URL' + end + + describe '#dashboard_url' do + subject { described_class.new(env, correlation_id).dashboard_url } + + let(:staging_url) do + "https://nonprod-log.gitlab.net/app/dashboards#/view/b74dc030-6f56-11ed-9af2-6131f0ee4ce6?_g=%28time" \ + "%3A%28from:%272022-11-13T00:00:00.000Z%27%2Cto%3A%272022-11-14T00:00:00.000Z%27%29%29&_a=%28filters%3A%21" \ + "%28%28query%3A%28match_phrase%3A%28json.correlation_id%3A%27#{correlation_id}%27%29%29%29%29%29" + end + + let(:production_url) do + "https://log.gprd.gitlab.net/app/dashboards#/view/5e6d3440-7597-11ed-9f43-e3784d7fe3ca?_g=%28time" \ + "%3A%28from:%272022-11-13T00:00:00.000Z%27%2Cto%3A%272022-11-14T00:00:00.000Z%27%29%29&_a=%28filters%3A%21" \ + "%28%28query%3A%28match_phrase%3A%28json.correlation_id%3A%27#{correlation_id}%27%29%29%29%29%29" + end + + let(:pre_url) do + "https://nonprod-log.gitlab.net/app/dashboards#/view/15596340-7570-11ed-9af2-6131f0ee4ce6?_g=%28time" \ + "%3A%28from:%272022-11-13T00:00:00.000Z%27%2Cto%3A%272022-11-14T00:00:00.000Z%27%29%29&_a=%28filters%3A%21" \ + "%28%28query%3A%28match_phrase%3A%28json.correlation_id%3A%27#{correlation_id}%27%29%29%29%29%29" + end + + it_behaves_like 'returns the expected URL' + end +end |