Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-06 06:07:26 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-06 06:07:26 +0300
commit5e448ff06309854c838fb5eaa46fd05ebc5218ab (patch)
tree0fd59db933c6f11053028559a8f6fc2e2b050f6e
parentbdad4dd5dabec7a0a611d5241fa2d56359884420 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/controllers/graphql_controller.rb36
-rw-r--r--app/graphql/cached_introspection_query.rb107
-rw-r--r--app/models/integration.rb7
-rw-r--r--app/models/project.rb23
-rw-r--r--config/feature_flags/development/cache_introspection_query.yml8
-rw-r--r--config/locales/de.yml14
-rw-r--r--config/locales/en.yml14
-rw-r--r--config/locales/es.yml14
-rw-r--r--config/routes.rb4
-rw-r--r--doc/api/graphql/reference/index.md2
-rw-r--r--doc/user/admin_area/reporting/git_abuse_rate_limit.md4
-rw-r--r--spec/controllers/graphql_controller_spec.rb60
-rw-r--r--spec/features/admin/admin_sees_project_statistics_spec.rb2
-rw-r--r--spec/features/admin/admin_sees_projects_statistics_spec.rb2
-rw-r--r--spec/features/admin/admin_system_info_spec.rb4
-rw-r--r--spec/features/projects/artifacts/user_browses_artifacts_spec.rb4
-rw-r--r--spec/fixtures/api/graphql/fake_introspection.graphql5
-rw-r--r--spec/fixtures/api/graphql/introspection.graphql1
-rw-r--r--spec/helpers/blob_helper_spec.rb4
-rw-r--r--spec/helpers/instance_configuration_helper_spec.rb4
-rw-r--r--spec/helpers/storage_helper_spec.rb12
-rw-r--r--spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_five_mb_spec.rb4
-rw-r--r--spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_one_mb_spec.rb4
-rw-r--r--spec/lib/gitlab/ci/artifact_file_reader_spec.rb4
-rw-r--r--spec/lib/gitlab/ci/config/external/file/artifact_spec.rb2
-rw-r--r--spec/lib/gitlab/database/reindexing/index_selection_spec.rb4
-rw-r--r--spec/lib/gitlab/git/conflict/parser_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/attachments_downloader_spec.rb2
-rw-r--r--spec/lib/gitlab/repository_size_error_message_spec.rb6
-rw-r--r--spec/lib/object_storage/direct_upload_spec.rb2
-rw-r--r--spec/lib/peek/views/memory_spec.rb4
-rw-r--r--spec/mailers/emails/merge_requests_spec.rb2
-rw-r--r--spec/models/integration_spec.rb22
-rw-r--r--spec/models/project_spec.rb63
-rw-r--r--spec/models/snippet_spec.rb6
-rw-r--r--spec/models/wiki_page_spec.rb6
-rw-r--r--spec/presenters/project_presenter_spec.rb6
-rw-r--r--spec/requests/api/integrations_spec.rb14
-rw-r--r--spec/requests/api/projects_spec.rb2
-rw-r--r--spec/services/bulk_imports/file_download_service_spec.rb4
-rw-r--r--spec/services/import/github_service_spec.rb2
-rw-r--r--spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_s3_spec.rb2
-rw-r--r--spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_spec.rb2
-rw-r--r--spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/lib/sentry/client_shared_examples.rb2
-rw-r--r--spec/validators/bytesize_validator_spec.rb6
-rw-r--r--spec/validators/import/gitlab_projects/remote_file_validator_spec.rb4
47 files changed, 416 insertions, 94 deletions
diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb
index ff4fce9ad1e..11ac641419f 100644
--- a/app/controllers/graphql_controller.rb
+++ b/app/controllers/graphql_controller.rb
@@ -12,6 +12,9 @@ class GraphqlController < ApplicationController
# Max size of the query text in characters
MAX_QUERY_SIZE = 10_000
+ # The query string of a standard IntrospectionQuery, used to compare incoming requests for caching
+ CACHED_INTROSPECTION_QUERY_STRING = CachedIntrospectionQuery.query_string
+
# If a user is using their session to access GraphQL, we need to have session
# storage, since the admin-mode check is session wide.
# We can't enable this for anonymous users because that would cause users using
@@ -54,7 +57,12 @@ class GraphqlController < ApplicationController
urgency :low, [:execute]
def execute
- result = multiplex? ? execute_multiplex : execute_query
+ result = if Feature.enabled?(:cache_introspection_query) && params[:operationName] == 'IntrospectionQuery'
+ execute_introspection_query
+ else
+ multiplex? ? execute_multiplex : execute_query
+ end
+
render json: result
end
@@ -259,4 +267,30 @@ class GraphqlController < ApplicationController
def logs
RequestStore.store[:graphql_logs].to_a
end
+
+ def execute_introspection_query
+ if introspection_query_can_use_cache?
+ # Context for caching: https://gitlab.com/gitlab-org/gitlab/-/issues/409448
+ Rails.cache.fetch(
+ introspection_query_cache_key,
+ expires_in: 1.day) do
+ execute_query.to_json
+ end
+ else
+ execute_query
+ end
+ end
+
+ def introspection_query_can_use_cache?
+ graphql_query = GraphQL::Query.new(GitlabSchema, query: query, variables: build_variables(params[:variables]))
+
+ CACHED_INTROSPECTION_QUERY_STRING == graphql_query.query_string.squish
+ end
+
+ def introspection_query_cache_key
+ # We use context[:remove_deprecated] here as an introspection query result can differ based on the
+ # visibility of schema items. Visibility can be affected by the remove_deprecated param. For more context, see:
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/409448#note_1377558096
+ ['introspection-query-cache', Gitlab.revision, context[:remove_deprecated]]
+ end
end
diff --git a/app/graphql/cached_introspection_query.rb b/app/graphql/cached_introspection_query.rb
new file mode 100644
index 00000000000..f2b98426714
--- /dev/null
+++ b/app/graphql/cached_introspection_query.rb
@@ -0,0 +1,107 @@
+# frozen_string_literal: true
+
+module CachedIntrospectionQuery
+ def self.query_string
+ <<~QUERY.squish
+ query IntrospectionQuery {
+ __schema {
+ queryType {
+ name
+ }
+ mutationType {
+ name
+ }
+ subscriptionType {
+ name
+ }
+ types {
+ ...FullType
+ }
+ directives {
+ name
+ description
+ locations
+ args {
+ ...InputValue
+ }
+ }
+ }
+ }
+
+ fragment FullType on __Type {
+ kind
+ name
+ description
+ fields(includeDeprecated: true) {
+ name
+ description
+ args {
+ ...InputValue
+ }
+ type {
+ ...TypeRef
+ }
+ isDeprecated
+ deprecationReason
+ }
+ inputFields {
+ ...InputValue
+ }
+ interfaces {
+ ...TypeRef
+ }
+ enumValues(includeDeprecated: true) {
+ name
+ description
+ isDeprecated
+ deprecationReason
+ }
+ possibleTypes {
+ ...TypeRef
+ }
+ }
+
+ fragment InputValue on __InputValue {
+ name
+ description
+ type {
+ ...TypeRef
+ }
+ defaultValue
+ }
+
+ fragment TypeRef on __Type {
+ kind
+ name
+ ofType {
+ kind
+ name
+ ofType {
+ kind
+ name
+ ofType {
+ kind
+ name
+ ofType {
+ kind
+ name
+ ofType {
+ kind
+ name
+ ofType {
+ kind
+ name
+ ofType {
+ kind
+ name
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ QUERY
+ end
+end
diff --git a/app/models/integration.rb b/app/models/integration.rb
index 43e923511bb..fa3a47f8936 100644
--- a/app/models/integration.rb
+++ b/app/models/integration.rb
@@ -28,7 +28,7 @@ class Integration < ApplicationRecord
# TODO Shimo is temporary disabled on group and instance-levels.
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/345677
PROJECT_SPECIFIC_INTEGRATION_NAMES = %w[
- apple_app_store google_play jenkins shimo
+ apple_app_store gitlab_slack_application google_play jenkins shimo
].freeze
# Fake integrations to help with local development.
@@ -282,7 +282,6 @@ class Integration < ApplicationRecord
# Returns a list of available integration names.
# Example: ["asana", ...]
- # @deprecated
def self.available_integration_names(include_project_specific: true, include_dev: true)
names = integration_names
names += project_specific_integration_names if include_project_specific
@@ -302,7 +301,9 @@ class Integration < ApplicationRecord
end
def self.project_specific_integration_names
- PROJECT_SPECIFIC_INTEGRATION_NAMES
+ names = PROJECT_SPECIFIC_INTEGRATION_NAMES.dup
+ names.delete('gitlab_slack_application') unless Gitlab::CurrentSettings.slack_app_enabled || Rails.env.test?
+ names
end
# Returns a list of available integration types.
diff --git a/app/models/project.rb b/app/models/project.rb
index 05e61e70853..e5278f7f1ea 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -195,6 +195,7 @@ class Project < ApplicationRecord
has_one :emails_on_push_integration, class_name: 'Integrations::EmailsOnPush'
has_one :ewm_integration, class_name: 'Integrations::Ewm'
has_one :external_wiki_integration, class_name: 'Integrations::ExternalWiki'
+ has_one :gitlab_slack_application_integration, class_name: 'Integrations::GitlabSlackApplication'
has_one :google_play_integration, class_name: 'Integrations::GooglePlay'
has_one :hangouts_chat_integration, class_name: 'Integrations::HangoutsChat'
has_one :harbor_integration, class_name: 'Integrations::Harbor'
@@ -796,6 +797,20 @@ class Project < ApplicationRecord
preload(:project_feature, :route, :creator, group: :parent, namespace: [:route, :owner])
end
+ def self.with_slack_application_disabled
+ # Using Arel to avoid exposing what the column backing the type: attribute is
+ # rubocop: disable GitlabSecurity/PublicSend
+ with_active_slack = Integration.active.by_name(:gitlab_slack_application)
+ join_contraint = arel_table[:id].eq(Integration.arel_table[:project_id])
+ constraint = with_active_slack.where_clause.send(:predicates).reduce(join_contraint) { |a, b| a.and(b) }
+ join = arel_table.join(Integration.arel_table, Arel::Nodes::OuterJoin).on(constraint).join_sources
+ # rubocop: enable GitlabSecurity/PublicSend
+
+ joins(join).where(integrations: { id: nil })
+ rescue Integration::UnknownType
+ all
+ end
+
def self.eager_load_namespace_and_owner
includes(namespace: :owner)
end
@@ -1707,7 +1722,13 @@ class Project < ApplicationRecord
end
def disabled_integrations
- %w[shimo zentao]
+ return [] if Rails.env.development?
+
+ names = %w[shimo zentao]
+
+ # The Slack Slash Commands integration is only available for customers who cannot use the GitLab for Slack app.
+ # The GitLab for Slack app integration is only available when enabled through settings.
+ names << (Gitlab::CurrentSettings.slack_app_enabled ? 'slack_slash_commands' : 'gitlab_slack_application')
end
def find_or_initialize_integration(name)
diff --git a/config/feature_flags/development/cache_introspection_query.yml b/config/feature_flags/development/cache_introspection_query.yml
new file mode 100644
index 00000000000..d0b12993631
--- /dev/null
+++ b/config/feature_flags/development/cache_introspection_query.yml
@@ -0,0 +1,8 @@
+---
+name: cache_introspection_query
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/120279
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/412457
+milestone: '16.1'
+type: development
+group: group::application performance
+default_enabled: false
diff --git a/config/locales/de.yml b/config/locales/de.yml
index e5fee6dbb6c..673f0a5f74e 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -229,13 +229,13 @@ de:
storage_units:
format: "%n %u"
units:
- byte:
- one: Byte
- other: Bytes
- gb: GB
- kb: KB
- mb: MB
- tb: TB
+ byte: B
+ kb: KiB
+ mb: MiB
+ gb: GiB
+ tb: TiB
+ pb: PiB
+ eb: EiB
percentage:
format:
delimiter: ''
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 796ca56c604..87184d51a17 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -269,13 +269,13 @@ en:
storage_units:
format: "%n %u"
units:
- byte:
- one: Byte
- other: Bytes
- gb: GB
- kb: KB
- mb: MB
- tb: TB
+ byte: B
+ kb: KiB
+ mb: MiB
+ gb: GiB
+ tb: TiB
+ pb: PiB
+ eb: EiB
percentage:
format:
delimiter: ''
diff --git a/config/locales/es.yml b/config/locales/es.yml
index e336865b2a5..ebc84dee12d 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -227,13 +227,13 @@ es:
storage_units:
format: "%n %u"
units:
- byte:
- one: Byte
- other: Bytes
- gb: GB
- kb: KB
- mb: MB
- tb: TB
+ byte: B
+ kb: KiB
+ mb: MiB
+ gb: GiB
+ tb: TiB
+ pb: PiB
+ eb: EiB
percentage:
format:
delimiter: ''
diff --git a/config/routes.rb b/config/routes.rb
index ff3ca48501a..16328e1a6c3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -66,9 +66,7 @@ InitializerConnections.raise_if_new_database_connection do
Gitlab.ee do
resource :company, only: [:new, :create], controller: 'company'
- resources :groups, only: [:new, :create] do
- post :import, on: :collection
- end
+ resources :groups, only: [:new, :create]
draw :verification
end
end
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index 39aba86b8c0..428fd2743be 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -26076,7 +26076,7 @@ State of a Sentry error.
| <a id="servicetypeewm_service"></a>`EWM_SERVICE` | EwmService type. |
| <a id="servicetypeexternal_wiki_service"></a>`EXTERNAL_WIKI_SERVICE` | ExternalWikiService type. |
| <a id="servicetypegithub_service"></a>`GITHUB_SERVICE` | GithubService type. |
-| <a id="servicetypegitlab_slack_application_service"></a>`GITLAB_SLACK_APPLICATION_SERVICE` | GitlabSlackApplicationService type (Gitlab.com only). |
+| <a id="servicetypegitlab_slack_application_service"></a>`GITLAB_SLACK_APPLICATION_SERVICE` | GitlabSlackApplicationService type. |
| <a id="servicetypegoogle_play_service"></a>`GOOGLE_PLAY_SERVICE` | GooglePlayService type. |
| <a id="servicetypehangouts_chat_service"></a>`HANGOUTS_CHAT_SERVICE` | HangoutsChatService type. |
| <a id="servicetypeharbor_service"></a>`HARBOR_SERVICE` | HarborService type. |
diff --git a/doc/user/admin_area/reporting/git_abuse_rate_limit.md b/doc/user/admin_area/reporting/git_abuse_rate_limit.md
index 83b28404714..ecf06bd8502 100644
--- a/doc/user/admin_area/reporting/git_abuse_rate_limit.md
+++ b/doc/user/admin_area/reporting/git_abuse_rate_limit.md
@@ -15,6 +15,10 @@ Git abuse rate limiting is a feature to automatically [ban users](../moderate_us
Git abuse rate limiting does not apply to instance administrators, [deploy tokens](../../../user/project/deploy_tokens/index.md), or [deploy keys](../../../user/project/deploy_keys/index.md).
+How GitLab determines a user's rate limit is under development.
+For more information, see the [confidential epic](../../project/issues/confidential_issues.md)
+`https://gitlab.com/groups/gitlab-org/modelops/anti-abuse/-/epics/14`.
+
## Configure Git abuse rate limiting
1. On the top bar, select **Main menu > Admin**.
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb
index 92b228b6836..2842ce93e3a 100644
--- a/spec/controllers/graphql_controller_spec.rb
+++ b/spec/controllers/graphql_controller_spec.rb
@@ -407,6 +407,66 @@ RSpec.describe GraphqlController, feature_category: :integrations do
expect(assigns(:context)[:remove_deprecated]).to be true
end
+
+ context 'when querying an IntrospectionQuery', :use_clean_rails_memory_store_caching do
+ let_it_be(:query) { File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql')) }
+
+ it 'caches the IntrospectionQuery' do
+ expect(GitlabSchema).to receive(:execute).exactly(:once)
+
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
+ end
+
+ it 'caches separately for both remove_deprecated set to true and false' do
+ expect(GitlabSchema).to receive(:execute).exactly(:twice)
+
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery', remove_deprecated: true }
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery', remove_deprecated: true }
+
+ # We clear this instance variable to reset remove_deprecated
+ subject.remove_instance_variable(:@context) if subject.instance_variable_defined?(:@context)
+
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery', remove_deprecated: false }
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery', remove_deprecated: false }
+ end
+
+ it 'has a different cache for each Gitlab.revision' do
+ expect(GitlabSchema).to receive(:execute).exactly(:twice)
+
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
+
+ allow(Gitlab).to receive(:revision).and_return('new random value')
+
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
+ end
+
+ it 'does not cache an unknown introspection query' do
+ query = File.read(Rails.root.join('spec/fixtures/api/graphql/fake_introspection.graphql'))
+
+ expect(GitlabSchema).to receive(:execute).exactly(:twice)
+
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
+ post :execute, params: { query: query, operationName: 'IntrospectionQuery' }
+ end
+
+ it 'hits the cache even if the whitespace in the query differs' do
+ query_1 = File.read(Rails.root.join('spec/fixtures/api/graphql/introspection.graphql'))
+ query_2 = "#{query_1} " # add a couple of spaces to change the fingerprint
+
+ expect(GitlabSchema).to receive(:execute).exactly(:once)
+
+ post :execute, params: { query: query_1, operationName: 'IntrospectionQuery' }
+ post :execute, params: { query: query_2, operationName: 'IntrospectionQuery' }
+ end
+
+ it 'fails if the GraphiQL gem version is not 1.8.0' do
+ # We cache the IntrospectionQuery based on the default IntrospectionQuery by GraphiQL. If this spec fails,
+ # GraphiQL has been updated, so we should check whether the IntropsectionQuery we cache is still valid.
+ # It is stored in `app/assets/javascripts/graphql_shared/queries/introspection.query.graphql`
+ expect(GraphiQL::Rails::VERSION).to eq("1.8.0")
+ end
+ end
end
describe 'Admin Mode' do
diff --git a/spec/features/admin/admin_sees_project_statistics_spec.rb b/spec/features/admin/admin_sees_project_statistics_spec.rb
index 61e4ef42e12..d977735daf8 100644
--- a/spec/features/admin/admin_sees_project_statistics_spec.rb
+++ b/spec/features/admin/admin_sees_project_statistics_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe "Admin > Admin sees project statistics", feature_category: :group
let(:project) { create(:project, :repository) }
it "shows project statistics" do
- expect(page).to have_content("Storage: 0 Bytes (Repository: 0 Bytes / Wikis: 0 Bytes / Build Artifacts: 0 Bytes / Pipeline Artifacts: 0 Bytes / LFS: 0 Bytes / Snippets: 0 Bytes / Packages: 0 Bytes / Uploads: 0 Bytes)")
+ expect(page).to have_content("Storage: 0 B (Repository: 0 B / Wikis: 0 B / Build Artifacts: 0 B / Pipeline Artifacts: 0 B / LFS: 0 B / Snippets: 0 B / Packages: 0 B / Uploads: 0 B)")
end
end
diff --git a/spec/features/admin/admin_sees_projects_statistics_spec.rb b/spec/features/admin/admin_sees_projects_statistics_spec.rb
index 791351c78d0..3363a67ea90 100644
--- a/spec/features/admin/admin_sees_projects_statistics_spec.rb
+++ b/spec/features/admin/admin_sees_projects_statistics_spec.rb
@@ -16,6 +16,6 @@ RSpec.describe "Admin > Admin sees projects statistics", feature_category: :grou
end
it "shows project statistics for projects that have them" do
- expect(page.all('.stats').map(&:text)).to contain_exactly("0 Bytes", "Unknown")
+ expect(page.all('.stats').map(&:text)).to contain_exactly("0 B", "Unknown")
end
end
diff --git a/spec/features/admin/admin_system_info_spec.rb b/spec/features/admin/admin_system_info_spec.rb
index 21a001f12c3..71a0b829932 100644
--- a/spec/features/admin/admin_system_info_spec.rb
+++ b/spec/features/admin/admin_system_info_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe 'Admin System Info', feature_category: :shared do
it 'shows system info page' do
expect(page).to have_content 'CPU 2 cores'
- expect(page).to have_content 'Memory Usage 4 GB / 16 GB'
+ expect(page).to have_content 'Memory Usage 4 GiB / 16 GiB'
expect(page).to have_content 'Disk Usage'
expect(page).to have_content 'System started'
end
@@ -37,7 +37,7 @@ RSpec.describe 'Admin System Info', feature_category: :shared do
it 'shows system info page with no CPU info' do
expect(page).to have_content 'CPU Unable to collect CPU info'
- expect(page).to have_content 'Memory Usage 4 GB / 16 GB'
+ expect(page).to have_content 'Memory Usage 4 GiB / 16 GiB'
expect(page).to have_content 'Disk Usage'
expect(page).to have_content 'System started'
end
diff --git a/spec/features/projects/artifacts/user_browses_artifacts_spec.rb b/spec/features/projects/artifacts/user_browses_artifacts_spec.rb
index 6948a26196b..04d93b11ca9 100644
--- a/spec/features/projects/artifacts/user_browses_artifacts_spec.rb
+++ b/spec/features/projects/artifacts/user_browses_artifacts_spec.rb
@@ -33,8 +33,8 @@ RSpec.describe "User browses artifacts", feature_category: :build_artifacts do
page.within(".tree-table") do
expect(page).to have_no_content("..")
.and have_content("other_artifacts_0.1.2")
- .and have_content("ci_artifacts.txt 27 Bytes")
- .and have_content("rails_sample.jpg 34.4 KB")
+ .and have_content("ci_artifacts.txt 27 B")
+ .and have_content("rails_sample.jpg 34.4 KiB")
end
page.within(".build-header") do
diff --git a/spec/fixtures/api/graphql/fake_introspection.graphql b/spec/fixtures/api/graphql/fake_introspection.graphql
new file mode 100644
index 00000000000..493c9312681
--- /dev/null
+++ b/spec/fixtures/api/graphql/fake_introspection.graphql
@@ -0,0 +1,5 @@
+query IntrospectionQuery {
+ project(fullPath: "gitlab-org/gitlab") {
+ id
+ }
+}
diff --git a/spec/fixtures/api/graphql/introspection.graphql b/spec/fixtures/api/graphql/introspection.graphql
index 6b6de2efbaf..d17da75f352 100644
--- a/spec/fixtures/api/graphql/introspection.graphql
+++ b/spec/fixtures/api/graphql/introspection.graphql
@@ -1,4 +1,3 @@
-# pulled from GraphiQL query
query IntrospectionQuery {
__schema {
queryType {
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb
index 1fd953d52d8..6d97afd4c78 100644
--- a/spec/helpers/blob_helper_spec.rb
+++ b/spec/helpers/blob_helper_spec.rb
@@ -106,7 +106,7 @@ RSpec.describe BlobHelper do
let(:blob) { fake_blob(size: 10.megabytes) }
it 'returns an error message' do
- expect(helper.blob_render_error_reason(viewer)).to eq('it is larger than 5 MB')
+ expect(helper.blob_render_error_reason(viewer)).to eq('it is larger than 5 MiB')
end
end
@@ -114,7 +114,7 @@ RSpec.describe BlobHelper do
let(:blob) { fake_blob(size: 2.megabytes) }
it 'returns an error message' do
- expect(helper.blob_render_error_reason(viewer)).to eq('it is larger than 1 MB')
+ expect(helper.blob_render_error_reason(viewer)).to eq('it is larger than 1 MiB')
end
end
end
diff --git a/spec/helpers/instance_configuration_helper_spec.rb b/spec/helpers/instance_configuration_helper_spec.rb
index 921ec7ee588..f19f6fbb5c0 100644
--- a/spec/helpers/instance_configuration_helper_spec.rb
+++ b/spec/helpers/instance_configuration_helper_spec.rb
@@ -43,11 +43,11 @@ RSpec.describe InstanceConfigurationHelper do
end
it 'accepts the value in bytes' do
- expect(helper.instance_configuration_human_size_cell(1024)).to eq('1 KB')
+ expect(helper.instance_configuration_human_size_cell(1024)).to eq('1 KiB')
end
it 'returns the value in human size readable format' do
- expect(helper.instance_configuration_human_size_cell(1048576)).to eq('1 MB')
+ expect(helper.instance_configuration_human_size_cell(1048576)).to eq('1 MiB')
end
end
diff --git a/spec/helpers/storage_helper_spec.rb b/spec/helpers/storage_helper_spec.rb
index d62da2ca714..d37ab7f14a5 100644
--- a/spec/helpers/storage_helper_spec.rb
+++ b/spec/helpers/storage_helper_spec.rb
@@ -5,19 +5,19 @@ require "spec_helper"
RSpec.describe StorageHelper do
describe "#storage_counter" do
it "formats bytes to one decimal place" do
- expect(helper.storage_counter(1.23.megabytes)).to eq("1.2 MB")
+ expect(helper.storage_counter(1.23.megabytes)).to eq("1.2 MiB")
end
- it "does not add decimals for sizes < 1 MB" do
- expect(helper.storage_counter(23.5.kilobytes)).to eq("24 KB")
+ it "does not add decimals for sizes < 1 MiB" do
+ expect(helper.storage_counter(23.5.kilobytes)).to eq("24 KiB")
end
it "does not add decimals for zeroes" do
- expect(helper.storage_counter(2.megabytes)).to eq("2 MB")
+ expect(helper.storage_counter(2.megabytes)).to eq("2 MiB")
end
it "uses commas as thousands separator" do
- expect(helper.storage_counter(100_000_000_000_000_000_000_000)).to eq("86,736.2 EB")
+ expect(helper.storage_counter(100_000_000_000_000_000_000_000)).to eq("86,736.2 EiB")
end
end
@@ -42,7 +42,7 @@ RSpec.describe StorageHelper do
)
end
- let(:message) { 'Repository: 10 KB / Wikis: 10 Bytes / Build Artifacts: 30 MB / Pipeline Artifacts: 11 MB / LFS: 20 GB / Snippets: 40 MB / Packages: 12 MB / Uploads: 15 MB' }
+ let(:message) { 'Repository: 10 KiB / Wikis: 10 B / Build Artifacts: 30 MiB / Pipeline Artifacts: 11 MiB / LFS: 20 GiB / Snippets: 40 MiB / Packages: 12 MiB / Uploads: 15 MiB' }
it 'works on ProjectStatistics' do
expect(helper.storage_counters_details(project.statistics)).to eq(message)
diff --git a/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_five_mb_spec.rb b/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_five_mb_spec.rb
index 2f53a5da272..a153507837c 100644
--- a/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_five_mb_spec.rb
+++ b/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_five_mb_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe Gitlab::BackgroundMigration::DisableLegacyOpenSourceLicenseForPro
.perform
end
- it 'sets `legacy_open_source_license_available` to false only for projects less than 5 MB', :aggregate_failures do
+ it 'sets `legacy_open_source_license_available` to false only for projects less than 5 MiB', :aggregate_failures do
project_setting_2_mb = create_legacy_license_project_setting(repo_size: 2)
project_setting_4_mb = create_legacy_license_project_setting(repo_size: 4)
project_setting_5_mb = create_legacy_license_project_setting(repo_size: 5)
@@ -41,7 +41,7 @@ RSpec.describe Gitlab::BackgroundMigration::DisableLegacyOpenSourceLicenseForPro
private
- # @param repo_size: Repo size in MB
+ # @param repo_size: Repo size in MiB
def create_legacy_license_project_setting(repo_size:)
path = "path-for-repo-size-#{repo_size}"
namespace = namespaces_table.create!(name: "namespace-#{path}", path: "namespace-#{path}")
diff --git a/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_one_mb_spec.rb b/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_one_mb_spec.rb
index 205350f9df4..2e6bc2f77ae 100644
--- a/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_one_mb_spec.rb
+++ b/spec/lib/gitlab/background_migration/disable_legacy_open_source_license_for_projects_less_than_one_mb_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe Gitlab::BackgroundMigration::DisableLegacyOpenSourceLicenseForPro
.perform
end
- it 'sets `legacy_open_source_license_available` to false only for projects less than 1 MB',
+ it 'sets `legacy_open_source_license_available` to false only for projects less than 1 MiB',
:aggregate_failures do
project_setting_1_mb = create_legacy_license_project_setting(repo_size: 1)
project_setting_2_mb = create_legacy_license_project_setting(repo_size: 2)
@@ -39,7 +39,7 @@ RSpec.describe Gitlab::BackgroundMigration::DisableLegacyOpenSourceLicenseForPro
private
- # @param repo_size: Repo size in MB
+ # @param repo_size: Repo size in MiB
def create_legacy_license_project_setting(repo_size:)
path = "path-for-repo-size-#{repo_size}"
namespace = namespaces_table.create!(name: "namespace-#{path}", path: "namespace-#{path}")
diff --git a/spec/lib/gitlab/ci/artifact_file_reader_spec.rb b/spec/lib/gitlab/ci/artifact_file_reader_spec.rb
index 813dc15e79f..76a596e1db3 100644
--- a/spec/lib/gitlab/ci/artifact_file_reader_spec.rb
+++ b/spec/lib/gitlab/ci/artifact_file_reader_spec.rb
@@ -49,7 +49,7 @@ RSpec.describe Gitlab::Ci::ArtifactFileReader do
context 'when artifact archive size is greater than the limit' do
let(:expected_error) do
- "Artifacts archive for job `#{job.name}` is too large: max 1 KB"
+ "Artifacts archive for job `#{job.name}` is too large: max 1 KiB"
end
before do
@@ -63,7 +63,7 @@ RSpec.describe Gitlab::Ci::ArtifactFileReader do
context 'when metadata entry shows size greater than the limit' do
let(:expected_error) do
- "Artifacts archive for job `#{job.name}` is too large: max 5 MB"
+ "Artifacts archive for job `#{job.name}` is too large: max 5 MiB"
end
before do
diff --git a/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb b/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb
index 087dacd5ef0..1f4586bd5a9 100644
--- a/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb
+++ b/spec/lib/gitlab/ci/config/external/file/artifact_spec.rb
@@ -105,7 +105,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Artifact, feature_category: :
context 'when job has artifacts exceeding the max allowed size' do
let(:expected_error) do
- "Artifacts archive for job `generator` is too large: max 1 KB"
+ "Artifacts archive for job `generator` is too large: max 1 KiB"
end
before do
diff --git a/spec/lib/gitlab/database/reindexing/index_selection_spec.rb b/spec/lib/gitlab/database/reindexing/index_selection_spec.rb
index e82a2ab467d..f1d88615762 100644
--- a/spec/lib/gitlab/database/reindexing/index_selection_spec.rb
+++ b/spec/lib/gitlab/database/reindexing/index_selection_spec.rb
@@ -38,7 +38,7 @@ RSpec.describe Gitlab::Database::Reindexing::IndexSelection, feature_category: :
expect(subject).not_to include(excluded.index)
end
- it 'excludes indexes smaller than 1 GB ondisk size' do
+ it 'excludes indexes smaller than 1 GiB ondisk size' do
excluded = create(
:postgres_index_bloat_estimate,
index: create(:postgres_index, ondisk_size_bytes: 0.99.gigabytes),
@@ -48,7 +48,7 @@ RSpec.describe Gitlab::Database::Reindexing::IndexSelection, feature_category: :
expect(subject).not_to include(excluded.index)
end
- it 'includes indexes larger than 100 GB ondisk size' do
+ it 'includes indexes larger than 100 GiB ondisk size' do
included = create(
:postgres_index_bloat_estimate,
index: create(:postgres_index, ondisk_size_bytes: 101.gigabytes),
diff --git a/spec/lib/gitlab/git/conflict/parser_spec.rb b/spec/lib/gitlab/git/conflict/parser_spec.rb
index 67f288e0299..d3ee0b8d1ce 100644
--- a/spec/lib/gitlab/git/conflict/parser_spec.rb
+++ b/spec/lib/gitlab/git/conflict/parser_spec.rb
@@ -229,7 +229,7 @@ RSpec.describe Gitlab::Git::Conflict::Parser do
.to raise_error(Gitlab::Git::Conflict::Parser::UnmergeableFile)
end
- it 'raises UnmergeableFile when the file is over 200 KB' do
+ it 'raises UnmergeableFile when the file is over 200 KiB' do
expect { parse_text('a' * 204801) }
.to raise_error(Gitlab::Git::Conflict::Parser::UnmergeableFile)
end
diff --git a/spec/lib/gitlab/github_import/attachments_downloader_spec.rb b/spec/lib/gitlab/github_import/attachments_downloader_spec.rb
index f7781226ecf..84d6713efdb 100644
--- a/spec/lib/gitlab/github_import/attachments_downloader_spec.rb
+++ b/spec/lib/gitlab/github_import/attachments_downloader_spec.rb
@@ -56,7 +56,7 @@ RSpec.describe Gitlab::GithubImport::AttachmentsDownloader do
it 'raises expected exception' do
expect { downloader.perform }.to raise_exception(
Gitlab::GithubImport::AttachmentsDownloader::DownloadError,
- 'File size 26 MB exceeds limit of 25 MB'
+ 'File size 26 MiB exceeds limit of 25 MiB'
)
end
end
diff --git a/spec/lib/gitlab/repository_size_error_message_spec.rb b/spec/lib/gitlab/repository_size_error_message_spec.rb
index 633ec41ab00..8fce76f50db 100644
--- a/spec/lib/gitlab/repository_size_error_message_spec.rb
+++ b/spec/lib/gitlab/repository_size_error_message_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe Gitlab::RepositorySizeErrorMessage do
end
let(:message) { checker.error_message }
- let(:base_message) { 'because this repository has exceeded its size limit of 10 MB by 5 MB' }
+ let(:base_message) { 'because this repository has exceeded its size limit of 10 MiB by 5 MiB' }
before do
allow(namespace).to receive(:total_repository_size_excess).and_return(0)
@@ -36,7 +36,7 @@ RSpec.describe Gitlab::RepositorySizeErrorMessage do
describe '#push_error' do
context 'with exceeded_limit value' do
let(:rejection_message) do
- 'because this repository has exceeded its size limit of 10 MB by 15 MB'
+ 'because this repository has exceeded its size limit of 10 MiB by 15 MiB'
end
it 'returns the correct message' do
@@ -64,7 +64,7 @@ RSpec.describe Gitlab::RepositorySizeErrorMessage do
context 'when no additional repo storage is available' do
it 'returns the correct message' do
- expect(message.new_changes_error).to eq("Your push to this repository would cause it to exceed the size limit of 10 MB so it has been rejected. #{message.more_info_message}")
+ expect(message.new_changes_error).to eq("Your push to this repository would cause it to exceed the size limit of 10 MiB so it has been rejected. #{message.more_info_message}")
end
end
end
diff --git a/spec/lib/object_storage/direct_upload_spec.rb b/spec/lib/object_storage/direct_upload_spec.rb
index 4fcc0e3f306..3a42e6ebd09 100644
--- a/spec/lib/object_storage/direct_upload_spec.rb
+++ b/spec/lib/object_storage/direct_upload_spec.rb
@@ -377,7 +377,7 @@ RSpec.describe ObjectStorage::DirectUpload, feature_category: :shared do
end
end
- context 'when maximum upload size is < 5 MB' do
+ context 'when maximum upload size is < 5 MiB' do
let(:maximum_size) { 1024 }
it 'returns only 1 part' do
diff --git a/spec/lib/peek/views/memory_spec.rb b/spec/lib/peek/views/memory_spec.rb
index 1f88aadfc54..9532ef04c54 100644
--- a/spec/lib/peek/views/memory_spec.rb
+++ b/spec/lib/peek/views/memory_spec.rb
@@ -17,12 +17,12 @@ RSpec.describe Peek::Views::Memory, :request_store do
it 'returns memory instrumentation data when it has fired' do
publish_notification
- expect(subject.results[:calls]).to eq('2 MB')
+ expect(subject.results[:calls]).to eq('2 MiB')
expect(subject.results[:details]).to all(have_key(:item_header))
expect(subject.results[:details]).to all(have_key(:item_content))
expect(subject.results[:summary]).to include('Objects allocated' => '200 k')
expect(subject.results[:summary]).to include('Allocator calls' => '500')
- expect(subject.results[:summary]).to include('Large allocations' => '1 KB')
+ expect(subject.results[:summary]).to include('Large allocations' => '1 KiB')
end
end
diff --git a/spec/mailers/emails/merge_requests_spec.rb b/spec/mailers/emails/merge_requests_spec.rb
index 9aece9538dc..9a8d1e1279b 100644
--- a/spec/mailers/emails/merge_requests_spec.rb
+++ b/spec/mailers/emails/merge_requests_spec.rb
@@ -253,7 +253,7 @@ RSpec.describe Emails::MergeRequests do
}
end
- it { expect(subject).to have_content('attachment has been truncated to avoid exceeding the maximum allowed attachment size of 15 MB.') }
+ it { expect(subject).to have_content('attachment has been truncated to avoid exceeding the maximum allowed attachment size of 15 MiB.') }
end
end
diff --git a/spec/models/integration_spec.rb b/spec/models/integration_spec.rb
index 46c30074ae7..ed49009d6d9 100644
--- a/spec/models/integration_spec.rb
+++ b/spec/models/integration_spec.rb
@@ -994,9 +994,25 @@ RSpec.describe Integration, feature_category: :integrations do
end
describe '.project_specific_integration_names' do
- specify do
- expect(described_class.project_specific_integration_names)
- .to include(*described_class::PROJECT_SPECIFIC_INTEGRATION_NAMES)
+ subject { described_class.project_specific_integration_names }
+
+ it { is_expected.to include(*described_class::PROJECT_SPECIFIC_INTEGRATION_NAMES) }
+ it { is_expected.to include('gitlab_slack_application') }
+
+ context 'when Rails.env is not test' do
+ before do
+ allow(Rails.env).to receive(:test?).and_return(false)
+ end
+
+ it { is_expected.not_to include('gitlab_slack_application') }
+
+ context 'when `slack_app_enabled` setting is enabled' do
+ before do
+ stub_application_setting(slack_app_enabled: true)
+ end
+
+ it { is_expected.to include('gitlab_slack_application') }
+ end
end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 1074a328103..51c87217d9d 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -82,6 +82,7 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
it { is_expected.to have_one(:ewm_integration) }
it { is_expected.to have_one(:external_wiki_integration) }
it { is_expected.to have_one(:confluence_integration) }
+ it { is_expected.to have_one(:gitlab_slack_application_integration) }
it { is_expected.to have_one(:project_feature) }
it { is_expected.to have_one(:project_repository) }
it { is_expected.to have_one(:container_expiration_policy) }
@@ -2131,6 +2132,43 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
end
end
+ describe '.with_slack_application_disabled' do
+ let_it_be(:project1) { create(:project) }
+ let_it_be(:project2) { create(:project) }
+ let_it_be(:project3) { create(:project) }
+
+ before_all do
+ create(:gitlab_slack_application_integration, project: project2)
+ create(:gitlab_slack_application_integration, project: project3).update!(active: false)
+ end
+
+ context 'when the Slack app setting is enabled' do
+ before do
+ stub_application_setting(slack_app_enabled: true)
+ end
+
+ it 'includes only projects where Slack app is disabled or absent' do
+ projects = described_class.with_slack_application_disabled
+
+ expect(projects).to include(project1, project3)
+ expect(projects).not_to include(project2)
+ end
+ end
+
+ context 'when the Slack app setting is not enabled' do
+ before do
+ stub_application_setting(slack_app_enabled: false)
+ allow(Rails.env).to receive(:test?).and_return(false, true)
+ end
+
+ it 'includes all projects' do
+ projects = described_class.with_slack_application_disabled
+
+ expect(projects).to include(project1, project2, project3)
+ end
+ end
+ end
+
describe '.cached_count', :use_clean_rails_memory_store_caching do
let(:group) { create(:group, :public) }
let!(:project1) { create(:project, :public, group: group) }
@@ -6780,6 +6818,31 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
end
end
+ describe '#disabled_integrations' do
+ subject { build(:project).disabled_integrations }
+
+ it { is_expected.to include('gitlab_slack_application') }
+ it { is_expected.not_to include('slack_slash_commands') }
+
+ context 'when slack_app_enabled setting is enabled' do
+ before do
+ stub_application_setting(slack_app_enabled: true)
+ end
+
+ it { is_expected.to include('slack_slash_commands') }
+ it { is_expected.not_to include('gitlab_slack_application') }
+ end
+
+ context 'when Rails.env.development?' do
+ before do
+ allow(Rails.env).to receive(:development?).and_return(true)
+ end
+
+ it { is_expected.not_to include('slack_slash_commands') }
+ it { is_expected.not_to include('gitlab_slack_application') }
+ end
+ end
+
describe '#find_or_initialize_integration' do
it 'avoids N+1 database queries' do
allow(Integration).to receive(:available_integration_names).and_return(%w[prometheus pushover])
diff --git a/spec/models/snippet_spec.rb b/spec/models/snippet_spec.rb
index 6a5456fce3f..a808c12a39a 100644
--- a/spec/models/snippet_spec.rb
+++ b/spec/models/snippet_spec.rb
@@ -42,7 +42,7 @@ RSpec.describe Snippet do
is_expected
.to validate_length_of(:content)
.is_at_most(Gitlab::CurrentSettings.snippet_size_limit)
- .with_message("is too long (2 Bytes). The maximum size is 1 Byte.")
+ .with_message("is too long (2 B). The maximum size is 1 B.")
end
context 'content validations' do
@@ -86,7 +86,7 @@ RSpec.describe Snippet do
aggregate_failures do
expect(snippet).not_to be_valid
- expect(snippet.errors[:content]).to include("is too long (#{snippet.content.size} Bytes). The maximum size is #{limit} Bytes.")
+ expect(snippet.errors[:content]).to include("is too long (#{snippet.content.size} B). The maximum size is #{limit} B.")
end
end
end
@@ -125,7 +125,7 @@ RSpec.describe Snippet do
aggregate_failures do
expect(snippet).not_to be_valid
- expect(snippet.errors.messages_for(:description)).to include("is too long (2 MB). The maximum size is 1 MB.")
+ expect(snippet.errors.messages_for(:description)).to include("is too long (2 MiB). The maximum size is 1 MiB.")
end
end
end
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index efade74688a..c626f98f874 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -230,7 +230,7 @@ RSpec.describe WikiPage do
expect(subject).not_to be_valid
expect(subject.errors.messages).to eq(
- content: ['is too long (11 Bytes). The maximum size is 10 Bytes.']
+ content: ['is too long (11 B). The maximum size is 10 B.']
)
end
@@ -239,7 +239,7 @@ RSpec.describe WikiPage do
expect(subject).not_to be_valid
expect(subject.errors.messages).to eq(
- content: ['is too long (12 Bytes). The maximum size is 10 Bytes.']
+ content: ['is too long (12 B). The maximum size is 10 B.']
)
end
end
@@ -261,7 +261,7 @@ RSpec.describe WikiPage do
expect(subject).not_to be_valid
expect(subject.errors.messages).to eq(
- content: ['is too long (12 Bytes). The maximum size is 11 Bytes.']
+ content: ['is too long (12 B). The maximum size is 11 B.']
)
end
end
diff --git a/spec/presenters/project_presenter_spec.rb b/spec/presenters/project_presenter_spec.rb
index c4dfa73f648..b61847b37bb 100644
--- a/spec/presenters/project_presenter_spec.rb
+++ b/spec/presenters/project_presenter_spec.rb
@@ -231,7 +231,7 @@ RSpec.describe ProjectPresenter do
it 'returns storage data' do
expect(presenter.storage_anchor_data).to have_attributes(
is_link: true,
- label: a_string_including('0 Bytes'),
+ label: a_string_including('0 B'),
link: nil
)
end
@@ -285,7 +285,7 @@ RSpec.describe ProjectPresenter do
it 'returns storage data without usage quotas link for non-admin users' do
expect(presenter.storage_anchor_data).to have_attributes(
is_link: true,
- label: a_string_including('0 Bytes'),
+ label: a_string_including('0 B'),
link: nil
)
end
@@ -295,7 +295,7 @@ RSpec.describe ProjectPresenter do
expect(presenter.storage_anchor_data).to have_attributes(
is_link: true,
- label: a_string_including('0 Bytes'),
+ label: a_string_including('0 B'),
link: presenter.project_usage_quotas_path(project)
)
end
diff --git a/spec/requests/api/integrations_spec.rb b/spec/requests/api/integrations_spec.rb
index 8d348dc0a54..8334d6b6832 100644
--- a/spec/requests/api/integrations_spec.rb
+++ b/spec/requests/api/integrations_spec.rb
@@ -44,11 +44,17 @@ RSpec.describe API::Integrations, feature_category: :integrations do
end
where(:integration) do
- # The API supports all integrations except the GitLab Slack Application
- # integration; this integration must be installed via the UI.
+ # The Project Integrations API supports all integrations except:
+ # - The GitLab Slack Application integration, as it must be installed via the UI.
+ # - Shimo and ZenTao integrations, as new integrations are blocked from being created.
+ unavailable_integration_names = [
+ Integrations::GitlabSlackApplication.to_param,
+ Integrations::Shimo.to_param,
+ Integrations::Zentao.to_param
+ ]
+
names = Integration.available_integration_names
- names.delete(Integrations::GitlabSlackApplication.to_param) if Gitlab.ee?
- names - %w[shimo zentao]
+ names.reject { |name| name.in?(unavailable_integration_names) }
end
with_them do
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 1b08e7f0dc6..bb96771b3d5 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -2158,7 +2158,7 @@ RSpec.describe API::Projects, :aggregate_failures, feature_category: :groups_and
end
shared_examples 'capped upload attachments' do |upload_allowed|
- it "limits the upload to 1 GB" do
+ it "limits the upload to 1 GiB" do
expect_next_instance_of(UploadService) do |instance|
expect(instance).to receive(:override_max_attachment_size=).with(1.gigabyte).and_call_original
end
diff --git a/spec/services/bulk_imports/file_download_service_spec.rb b/spec/services/bulk_imports/file_download_service_spec.rb
index 4aa9cf3a73d..cbeea5b0f46 100644
--- a/spec/services/bulk_imports/file_download_service_spec.rb
+++ b/spec/services/bulk_imports/file_download_service_spec.rb
@@ -95,7 +95,7 @@ RSpec.describe BulkImports::FileDownloadService, feature_category: :importers do
it 'raises an error' do
expect { subject.execute }.to raise_error(
described_class::ServiceError,
- 'File size 1000 Bytes exceeds limit of 1 Byte'
+ 'File size 1000 B exceeds limit of 1 B'
)
end
end
@@ -128,7 +128,7 @@ RSpec.describe BulkImports::FileDownloadService, feature_category: :importers do
it 'raises an error' do
expect { subject.execute }.to raise_error(
described_class::ServiceError,
- 'File size 151 Bytes exceeds limit of 150 Bytes'
+ 'File size 151 B exceeds limit of 150 B'
)
end
end
diff --git a/spec/services/import/github_service_spec.rb b/spec/services/import/github_service_spec.rb
index fa8b2489599..21dc24e28f6 100644
--- a/spec/services/import/github_service_spec.rb
+++ b/spec/services/import/github_service_spec.rb
@@ -268,7 +268,7 @@ RSpec.describe Import::GithubService, feature_category: :importers do
{
status: :error,
http_status: :unprocessable_entity,
- message: '"repository" size (101 Bytes) is larger than the limit of 100 Bytes.'
+ message: '"repository" size (101 B) is larger than the limit of 100 B.'
}
end
diff --git a/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_s3_spec.rb b/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_s3_spec.rb
index 411e2ec5286..147bfccbfb7 100644
--- a/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_s3_spec.rb
+++ b/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_s3_spec.rb
@@ -64,7 +64,7 @@ RSpec.describe ::Import::GitlabProjects::FileAcquisitionStrategies::RemoteFileS3
it 'validates the remote content-length' do
expect(subject).not_to be_valid
expect(subject.errors.full_messages)
- .to include('Content length is too big (should be at most 10 GB)')
+ .to include('Content length is too big (should be at most 10 GiB)')
end
end
diff --git a/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_spec.rb b/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_spec.rb
index a28a552746f..0807a0e9d05 100644
--- a/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_spec.rb
+++ b/spec/services/import/gitlab_projects/file_acquisition_strategies/remote_file_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe ::Import::GitlabProjects::FileAcquisitionStrategies::RemoteFile,
expect(subject).not_to be_valid
expect(subject.errors.full_messages)
- .to include('Content length is too big (should be at most 10 GB)')
+ .to include('Content length is too big (should be at most 10 GiB)')
end
it 'validates the remote content-type' do
diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
index 7725366d565..91cacaf9209 100644
--- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
+++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
@@ -248,7 +248,7 @@ RSpec.shared_examples 'User updates wiki page' do
click_on 'Save changes'
expect(page).to have_content('The form contains the following error:')
- expect(page).to have_content('Content is too long (11 Bytes). The maximum size is 10 Bytes.')
+ expect(page).to have_content('Content is too long (11 B). The maximum size is 10 B.')
end
end
end
diff --git a/spec/support/shared_examples/lib/sentry/client_shared_examples.rb b/spec/support/shared_examples/lib/sentry/client_shared_examples.rb
index fa3e9bf5340..842801708d0 100644
--- a/spec/support/shared_examples/lib/sentry/client_shared_examples.rb
+++ b/spec/support/shared_examples/lib/sentry/client_shared_examples.rb
@@ -92,7 +92,7 @@ RSpec.shared_examples 'Sentry API response size limit' do
it 'raises an exception when response is too large' do
expect { subject }.to raise_error(
ErrorTracking::SentryClient::ResponseInvalidSizeError,
- 'Sentry API response is too big. Limit is 1 MB.'
+ 'Sentry API response is too big. Limit is 1 MiB.'
)
end
end
diff --git a/spec/validators/bytesize_validator_spec.rb b/spec/validators/bytesize_validator_spec.rb
index 1914ccedd87..d28b5925519 100644
--- a/spec/validators/bytesize_validator_spec.rb
+++ b/spec/validators/bytesize_validator_spec.rb
@@ -19,9 +19,9 @@ RSpec.describe BytesizeValidator do
where(:content, :validity, :errors) do
'short' | true | {}
- 'very long' | false | { content: ['is too long (9 Bytes). The maximum size is 7 Bytes.'] }
- 'short😁' | false | { content: ['is too long (9 Bytes). The maximum size is 7 Bytes.'] }
- 'short⇏' | false | { content: ['is too long (8 Bytes). The maximum size is 7 Bytes.'] }
+ 'very long' | false | { content: ['is too long (9 B). The maximum size is 7 B.'] }
+ 'short😁' | false | { content: ['is too long (9 B). The maximum size is 7 B.'] }
+ 'short⇏' | false | { content: ['is too long (8 B). The maximum size is 7 B.'] }
end
with_them do
diff --git a/spec/validators/import/gitlab_projects/remote_file_validator_spec.rb b/spec/validators/import/gitlab_projects/remote_file_validator_spec.rb
index 428e0279821..996fe16dc7f 100644
--- a/spec/validators/import/gitlab_projects/remote_file_validator_spec.rb
+++ b/spec/validators/import/gitlab_projects/remote_file_validator_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe ::Import::GitlabProjects::RemoteFileValidator, :aggregate_failure
subject.validate(validated_object)
expect(validated_object.errors.full_messages)
- .to include('Content length is too small (should be at least 1 Byte)')
+ .to include('Content length is too small (should be at least 1 B)')
end
it 'is invalid with file too large' do
@@ -46,7 +46,7 @@ RSpec.describe ::Import::GitlabProjects::RemoteFileValidator, :aggregate_failure
subject.validate(validated_object)
expect(validated_object.errors.full_messages)
- .to include('Content length is too big (should be at most 10 GB)')
+ .to include('Content length is too big (should be at most 10 GiB)')
end
end