diff options
Diffstat (limited to 'spec/lib/gitlab/observability_spec.rb')
-rw-r--r-- | spec/lib/gitlab/observability_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/lib/gitlab/observability_spec.rb b/spec/lib/gitlab/observability_spec.rb index 5082d193197..61f69a0171a 100644 --- a/spec/lib/gitlab/observability_spec.rb +++ b/spec/lib/gitlab/observability_spec.rb @@ -3,6 +3,9 @@ require 'spec_helper' RSpec.describe Gitlab::Observability, feature_category: :error_tracking do + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, group: group) } + describe '.observability_url' do let(:gitlab_url) { 'https://example.com' } @@ -31,6 +34,24 @@ RSpec.describe Gitlab::Observability, feature_category: :error_tracking do end end + describe '.oauth_url' do + subject { described_class.oauth_url } + + it { is_expected.to eq("#{described_class.observability_url}/v1/auth/start") } + end + + describe '.tracing_url' do + subject { described_class.tracing_url(project) } + + it { is_expected.to eq("#{described_class.observability_url}/query/#{group.id}/#{project.id}/v1/traces") } + end + + describe '.provisioning_url' do + subject { described_class.provisioning_url(project) } + + it { is_expected.to eq(described_class.observability_url.to_s) } + end + describe '.build_full_url' do let_it_be(:group) { build_stubbed(:group, id: 123) } let(:observability_url) { described_class.observability_url } @@ -148,6 +169,27 @@ RSpec.describe Gitlab::Observability, feature_category: :error_tracking do end end + describe '.tracing_enabled?' do + let_it_be(:project) { create(:project, :repository) } + + it 'returns true if feature is enabled globally' do + expect(described_class.tracing_enabled?(project)).to eq(true) + end + + it 'returns true if feature is enabled for the project' do + stub_feature_flags(observability_tracing: false) + stub_feature_flags(observability_tracing: project) + + expect(described_class.tracing_enabled?(project)).to eq(true) + end + + it 'returns false if feature is disabled globally' do + stub_feature_flags(observability_tracing: false) + + expect(described_class.tracing_enabled?(project)).to eq(false) + end + end + describe '.allowed_for_action?' do let(:group) { build_stubbed(:group) } let(:user) { build_stubbed(:user) } |