summaryrefslogtreecommitdiff
path: root/spec/lib/banzai
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-03-30 21:08:43 +0000
committerGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-03-30 21:08:43 +0000
commit125e519c15ece1361000fcdb8379cb40329b33fd (patch)
tree78253d9abc4a68b07c0013e4d8448f0104cd199d /spec/lib/banzai
parentb405157ce7809b3671155faa8f3c3395e3fc74ce (diff)
parentd6192c2ab77ab814b9bd66103663047556fd67e4 (diff)
downloadgitlab-ce-125e519c15ece1361000fcdb8379cb40329b33fd.tar.gz
Merge remote-tracking branch 'dev/15-9-stable' into 15-9-stable
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r--spec/lib/banzai/filter/inline_observability_filter_spec.rb52
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' }