diff options
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/ci/runner/jobs_artifacts_spec.rb | 28 | ||||
-rw-r--r-- | spec/requests/api/settings_spec.rb | 5 |
2 files changed, 31 insertions, 2 deletions
diff --git a/spec/requests/api/ci/runner/jobs_artifacts_spec.rb b/spec/requests/api/ci/runner/jobs_artifacts_spec.rb index 77ff561bbdf..97110b63ff6 100644 --- a/spec/requests/api/ci/runner/jobs_artifacts_spec.rb +++ b/spec/requests/api/ci/runner/jobs_artifacts_spec.rb @@ -238,9 +238,24 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do expect(json_response['ProcessLsif']).to be_truthy end + it 'tracks code_intelligence usage ping' do + tracking_params = { + event_names: 'i_source_code_code_intelligence', + start_date: Date.yesterday, + end_date: Date.today + } + + expect { authorize_artifacts_with_token_in_headers(artifact_type: :lsif) } + .to change { Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(tracking_params) } + .by(1) + end + context 'code_navigation feature flag is disabled' do - it 'responds with a forbidden error' do + before do stub_feature_flags(code_navigation: false) + end + + it 'responds with a forbidden error' do authorize_artifacts_with_token_in_headers(artifact_type: :lsif) aggregate_failures do @@ -248,6 +263,17 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do expect(json_response['ProcessLsif']).to be_falsy end end + + it 'does not track code_intelligence usage ping' do + tracking_params = { + event_names: 'i_source_code_code_intelligence', + start_date: Date.yesterday, + end_date: Date.today + } + + expect { authorize_artifacts_with_token_in_headers(artifact_type: :lsif) } + .not_to change { Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(tracking_params) } + end end end diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb index 356a3d8d2d7..ef12f6dbed3 100644 --- a/spec/requests/api/settings_spec.rb +++ b/spec/requests/api/settings_spec.rb @@ -39,6 +39,7 @@ RSpec.describe API::Settings, 'Settings' do expect(json_response['snippet_size_limit']).to eq(50.megabytes) expect(json_response['spam_check_endpoint_enabled']).to be_falsey expect(json_response['spam_check_endpoint_url']).to be_nil + expect(json_response['wiki_page_max_content_bytes']).to be_a(Integer) end end @@ -116,7 +117,8 @@ RSpec.describe API::Settings, 'Settings' do spam_check_endpoint_enabled: true, spam_check_endpoint_url: 'https://example.com/spam_check', disabled_oauth_sign_in_sources: 'unknown', - import_sources: 'github,bitbucket' + import_sources: 'github,bitbucket', + wiki_page_max_content_bytes: 12345 } expect(response).to have_gitlab_http_status(:ok) @@ -158,6 +160,7 @@ RSpec.describe API::Settings, 'Settings' do expect(json_response['spam_check_endpoint_url']).to eq('https://example.com/spam_check') expect(json_response['disabled_oauth_sign_in_sources']).to eq([]) expect(json_response['import_sources']).to match_array(%w(github bitbucket)) + expect(json_response['wiki_page_max_content_bytes']).to eq(12345) end end |