diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 16:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 16:38:24 +0300 |
commit | d6192c2ab77ab814b9bd66103663047556fd67e4 (patch) | |
tree | 78253d9abc4a68b07c0013e4d8448f0104cd199d /spec/lib | |
parent | 5e57ed483af358e2404891d87d1f68a8cf60ef89 (diff) |
Add latest changes from gitlab-org/security/gitlab@15-9-stable-eev15.9.4
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/banzai/filter/inline_observability_filter_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/inline_observability_filter_spec.rb b/spec/lib/banzai/filter/inline_observability_filter_spec.rb index fb1ba46e76c..69a9dc96c2c 100644 --- a/spec/lib/banzai/filter/inline_observability_filter_spec.rb +++ b/spec/lib/banzai/filter/inline_observability_filter_spec.rb @@ -34,6 +34,58 @@ RSpec.describe Banzai::Filter::InlineObservabilityFilter do end end + context 'when the document contains an embeddable observability link with redirect' do + let(:url) { 'https://observe.gitlab.com@example.com/12345' } + + it 'leaves the original link unchanged' do + expect(doc.at_css('a').to_s).to eq(input) + end + + it 'does not append an observability charts placeholder' do + node = doc.at_css('.js-render-observability') + + expect(node).not_to be_present + end + end + + context 'when the document contains an embeddable observability link with different port' do + let(:url) { 'https://observe.gitlab.com:3000/12345' } + let(:observe_url) { 'https://observe.gitlab.com:3001' } + + before do + stub_env('OVERRIDE_OBSERVABILITY_URL', observe_url) + end + + it 'leaves the original link unchanged' do + expect(doc.at_css('a').to_s).to eq(input) + end + + it 'does not append an observability charts placeholder' do + node = doc.at_css('.js-render-observability') + + expect(node).not_to be_present + end + end + + context 'when the document contains an embeddable observability link with auth/start' do + let(:url) { 'https://observe.gitlab.com/auth/start' } + let(:observe_url) { 'https://observe.gitlab.com' } + + before do + stub_env('OVERRIDE_OBSERVABILITY_URL', observe_url) + end + + it 'leaves the original link unchanged' do + expect(doc.at_css('a').to_s).to eq(input) + end + + it 'does not append an observability charts placeholder' do + node = doc.at_css('.js-render-observability') + + expect(node).not_to be_present + end + end + context 'when feature flag is disabled' do let(:url) { 'https://observe.gitlab.com/12345' } |