diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 00:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-11 00:10:04 +0300 |
commit | 997968e3fa7d1f623f7bd9e2581c58dc7afc5aa5 (patch) | |
tree | 1e5b86231fffe652e554abdd914aa6a152edc843 | |
parent | 50ecbfaf1bfe883056ab366c8e4a28fd4574c6fa (diff) |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | .rubocop.yml | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/new_card.scss | 4 | ||||
-rw-r--r-- | app/views/admin/application_settings/general.html.haml | 2 | ||||
-rw-r--r-- | db/post_migrate/20230727132342_prepare_index_on_vulnerability_occurrences_uuid_async.rb | 21 | ||||
-rw-r--r-- | db/post_migrate/20230728122928_prepare_index_on_vulnerability_occurrences_uuid_including_vulnerability_id_async.rb | 22 | ||||
-rw-r--r-- | db/schema_migrations/20230727132342 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20230728122928 | 1 | ||||
-rw-r--r-- | doc/development/testing_guide/end_to_end/resources.md | 19 | ||||
-rw-r--r-- | locale/gitlab.pot | 18 | ||||
-rw-r--r-- | qa/Gemfile | 2 | ||||
-rw-r--r-- | qa/Gemfile.lock | 3 | ||||
-rw-r--r-- | qa/qa.rb | 1 | ||||
-rw-r--r-- | qa/qa/factories/_shared.rb | 7 | ||||
-rw-r--r-- | qa/qa/factories/issues.rb | 17 | ||||
-rw-r--r-- | qa/qa/factories/projects.rb | 19 | ||||
-rw-r--r-- | qa/qa/resource/issue.rb | 7 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb | 5 | ||||
-rw-r--r-- | qa/qa/specs/spec_helper.rb | 8 |
19 files changed, 139 insertions, 21 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 25e65fe6b8d..f4bd7913b47 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -190,6 +190,7 @@ Naming/FileName: - 'jh/spec/**/*' - 'qa/bin/*' - 'qa/spec/**/*' + - 'qa/qa/factories/**/*' - 'qa/qa/specs/**/*' - 'qa/tasks/**/*.rake' - '**/*.ru' diff --git a/app/assets/stylesheets/framework/new_card.scss b/app/assets/stylesheets/framework/new_card.scss index 3fcaab671f3..1432e7a174c 100644 --- a/app/assets/stylesheets/framework/new_card.scss +++ b/app/assets/stylesheets/framework/new_card.scss @@ -102,6 +102,10 @@ @include gl-border-t-0; } + &:last-of-type td:not(:last-of-type) { + @include gl-border-b-1; + } + > td[data-label] { @include gl-border-left-0; @include gl-border-l-none; diff --git a/app/views/admin/application_settings/general.html.haml b/app/views/admin/application_settings/general.html.haml index 2cd94bc8416..63f67cd6de6 100644 --- a/app/views/admin/application_settings/general.html.haml +++ b/app/views/admin/application_settings/general.html.haml @@ -25,8 +25,6 @@ .settings-content = render 'account_and_limit' -= render_if_exists 'admin/application_settings/free_user_cap' - %section.settings.as-diff-limits.no-animate#js-merge-request-settings{ class: ('expanded' if expanded_by_default?) } .settings-header %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only diff --git a/db/post_migrate/20230727132342_prepare_index_on_vulnerability_occurrences_uuid_async.rb b/db/post_migrate/20230727132342_prepare_index_on_vulnerability_occurrences_uuid_async.rb new file mode 100644 index 00000000000..40670a60df0 --- /dev/null +++ b/db/post_migrate/20230727132342_prepare_index_on_vulnerability_occurrences_uuid_async.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class PrepareIndexOnVulnerabilityOccurrencesUuidAsync < Gitlab::Database::Migration[2.1] + INDEX_NAME = "index_vulnerability_occurrences_on_uuid_1" + + def up + prepare_async_index( + :vulnerability_occurrences, + :uuid_convert_string_to_uuid, + unique: true, + name: INDEX_NAME + ) + end + + def down + unprepare_async_index( + :vulnerability_occurrences, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20230728122928_prepare_index_on_vulnerability_occurrences_uuid_including_vulnerability_id_async.rb b/db/post_migrate/20230728122928_prepare_index_on_vulnerability_occurrences_uuid_including_vulnerability_id_async.rb new file mode 100644 index 00000000000..abd296a308f --- /dev/null +++ b/db/post_migrate/20230728122928_prepare_index_on_vulnerability_occurrences_uuid_including_vulnerability_id_async.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class PrepareIndexOnVulnerabilityOccurrencesUuidIncludingVulnerabilityIdAsync < Gitlab::Database::Migration[2.1] + INDEX_NAME = "index_vuln_findings_on_uuid_including_vuln_id_1" + + def up + index_sql = <<~SQL + CREATE UNIQUE INDEX CONCURRENTLY #{INDEX_NAME} + ON vulnerability_occurrences(uuid_convert_string_to_uuid) + INCLUDE(vulnerability_id) + SQL + + prepare_async_index_from_sql(index_sql) + end + + def down + unprepare_async_index_by_name( + :vulnerability_occurrences, + INDEX_NAME + ) + end +end diff --git a/db/schema_migrations/20230727132342 b/db/schema_migrations/20230727132342 new file mode 100644 index 00000000000..c9ca8639120 --- /dev/null +++ b/db/schema_migrations/20230727132342 @@ -0,0 +1 @@ +e896540db12617f10f58ae18bd5790adcfe26098cba589de9f2a93f2507a6239
\ No newline at end of file diff --git a/db/schema_migrations/20230728122928 b/db/schema_migrations/20230728122928 new file mode 100644 index 00000000000..7f1f6f735af --- /dev/null +++ b/db/schema_migrations/20230728122928 @@ -0,0 +1 @@ +47ccfbc79bcce6f7775e0713c2f4580f65df516e32355fa30c3a28cd9534505b
\ No newline at end of file diff --git a/doc/development/testing_guide/end_to_end/resources.md b/doc/development/testing_guide/end_to_end/resources.md index f9e136a86df..becdc375c63 100644 --- a/doc/development/testing_guide/end_to_end/resources.md +++ b/doc/development/testing_guide/end_to_end/resources.md @@ -347,7 +347,7 @@ end ## Creating resources in your tests To create a resource in your tests, you can call the `.fabricate!` method on -the resource class. +the resource class, or use the [factory](#factories) to create it. Note that if the resource class supports API fabrication, this uses this fabrication by default. @@ -390,6 +390,23 @@ end In this case, the result is similar to calling `Resource::Shirt.fabricate!`. +### Factories + +You may also use FactoryBot invocations to create resources within your tests. + +```ruby +# create a project via the API to use in the test +let(:project) { create(:project) } + +# create an issue belonging to a project via the API to use in the test +let(:issue) { create(:issue, project: project) } + +# create a private project via the API with a specific name +let(:project) { create(:project, :private, name: 'my-project-name', add_name_uuid: false) } +``` + +All factories are defined in [`qa/qa/factories`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/qa/factories/). + ### Resources cleanup We have a mechanism to [collect](https://gitlab.com/gitlab-org/gitlab/-/blob/44345381e89d6bbd440f7b4c680d03e8b75b86de/qa/qa/tools/test_resource_data_processor.rb#L32) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index cd125826060..e615b046ffe 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -2911,6 +2911,9 @@ msgstr "" msgid "Add new key" msgstr "" +msgid "Add new pipeline subscription" +msgstr "" + msgid "Add new pipeline trigger token" msgstr "" @@ -5781,9 +5784,6 @@ msgstr "" msgid "ApplicationSettings|Text shown after a user signs up. Markdown enabled." msgstr "" -msgid "ApplicationSettings|This feature is only available on GitLab.com" -msgstr "" - msgid "ApplicationSettings|Upload denylist file" msgstr "" @@ -17714,9 +17714,6 @@ msgstr "" msgid "Enable cleanup policy caching." msgstr "" -msgid "Enable dashboard limits on namespaces" -msgstr "" - msgid "Enable diagrams.net" msgstr "" @@ -20368,9 +20365,6 @@ msgstr "" msgid "Free Trial of GitLab.com Ultimate" msgstr "" -msgid "Free User Cap" -msgstr "" - msgid "Free groups are limited to %{free_user_limit} member and the remaining members will get a status of over-limit and lose access to the group." msgid_plural "Free groups are limited to %{free_user_limit} members and the remaining members will get a status of over-limit and lose access to the group." msgstr[0] "" @@ -40090,9 +40084,6 @@ msgstr "" msgid "Rollback" msgstr "" -msgid "Rollout of free user limits within GitLab.com. Do not edit these values unless approval has been given via %{link_start}this issue%{link_end}." -msgstr "" - msgid "Root cause analysis" msgstr "" @@ -45475,6 +45466,9 @@ msgstr "" msgid "Subscription deletion failed." msgstr "" +msgid "Subscription for %{subscription} will be removed. Do you want to continue?" +msgstr "" + msgid "Subscription service outage" msgstr "" diff --git a/qa/Gemfile b/qa/Gemfile index 887d7939fd3..16a5c9aa73e 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -44,6 +44,8 @@ gem 'nokogiri', '~> 1.15', '>= 1.15.3' gem 'deprecation_toolkit', '~> 2.0.3', require: false +gem 'factory_bot', '~> 6.2.1' + group :development do gem 'pry-byebug', '~> 3.10.1', platform: :mri gem "ruby-debug-ide", "~> 0.7.3" diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index d61eda6ff1e..071592f591a 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -80,6 +80,8 @@ GEM unf (>= 0.0.5, < 1.0.0) erubi (1.12.0) excon (0.92.4) + factory_bot (6.2.1) + activesupport (>= 5.0.0) faker (3.2.0) i18n (>= 1.8.11, < 2) faraday (2.5.2) @@ -344,6 +346,7 @@ DEPENDENCIES chemlab-library-www-gitlab-com (~> 0.1, >= 0.1.1) confiner (~> 0.4) deprecation_toolkit (~> 2.0.3) + factory_bot (~> 6.2.1) faker (~> 3.2) faraday-retry (~> 2.2) fog-core (= 2.1.0) @@ -29,6 +29,7 @@ module QA loader.push_dir(root, namespace: QA) + loader.ignore("#{root}/factories") loader.ignore("#{root}/specs/features") loader.ignore("#{root}/specs/spec_helper.rb") diff --git a/qa/qa/factories/_shared.rb b/qa/qa/factories/_shared.rb new file mode 100644 index 00000000000..0fd38faa7dd --- /dev/null +++ b/qa/qa/factories/_shared.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module QA + FactoryBot.define do + to_create(&:fabricate_via_api!) + end +end diff --git a/qa/qa/factories/issues.rb b/qa/qa/factories/issues.rb new file mode 100644 index 00000000000..2931a41e347 --- /dev/null +++ b/qa/qa/factories/issues.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module QA + FactoryBot.define do + # https://docs.gitlab.com/ee/api/issues.html + factory :issue, class: 'QA::Resource::Issue' do + title { Faker::Lorem.sentence } + description { Faker::Lorem.paragraph } + + confidential { false } + + trait :confidential do + confidential { true } + end + end + end +end diff --git a/qa/qa/factories/projects.rb b/qa/qa/factories/projects.rb new file mode 100644 index 00000000000..65127b93207 --- /dev/null +++ b/qa/qa/factories/projects.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module QA + FactoryBot.define do + # https://docs.gitlab.com/ee/api/projects.html + factory :project, class: 'QA::Resource::Project' do + name { 'Project Name' } + visibility { 'public' } + + trait :private do + visibility { 'private' } + end + + trait :with_readme do + initialize_with_readme { true } + end + end + end +end diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb index a39e04c61a3..72b57801053 100644 --- a/qa/qa/resource/issue.rb +++ b/qa/qa/resource/issue.rb @@ -20,6 +20,10 @@ module QA :title, :description + attribute :confidential do + false + end + def initialize @assignee_ids = [] @labels = [] @@ -57,7 +61,8 @@ module QA { assignee_ids: assignee_ids, labels: labels, - title: title + title: title, + confidential: confidential }.tap do |hash| hash[:milestone_id] = @milestone.id if @milestone hash[:weight] = @weight if @weight diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb index f7dc9157275..2fe88c543de 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb @@ -6,7 +6,7 @@ module QA before do Flow::Login.sign_in - Resource::Issue.fabricate_via_api!.visit! + create(:issue).visit! end it 'comments on an issue and edits the comment', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347978' do diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb index bad312bb392..c489a61ca2a 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb @@ -7,10 +7,7 @@ module QA let(:template_content) { 'This is a custom issue template test' } let(:template_project) do - Resource::Project.fabricate_via_api! do |project| - project.name = "custom-issue-template-project" - project.initialize_with_readme = true - end + create(:project, :with_readme, name: 'custom-issue-template-project') end before do diff --git a/qa/qa/specs/spec_helper.rb b/qa/qa/specs/spec_helper.rb index 7768966b19c..965e3c2f88c 100644 --- a/qa/qa/specs/spec_helper.rb +++ b/qa/qa/specs/spec_helper.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'active_support/testing/time_helpers' +require 'factory_bot' require_relative '../../qa' @@ -28,6 +29,9 @@ RSpec.configure do |config| config.include ActiveSupport::Testing::TimeHelpers config.include QA::Support::Matchers::EventuallyMatcher config.include QA::Support::Matchers::HaveMatcher + config.include FactoryBot::Syntax::Methods + + FactoryBot.definition_file_paths = ['qa/factories'] config.add_formatter QA::Support::Formatters::ContextFormatter config.add_formatter QA::Support::Formatters::QuarantineFormatter @@ -45,6 +49,10 @@ RSpec.configure do |config| Thread.current[:browser_ui_fabrication] = 0 end + config.before(:suite) do + FactoryBot.find_definitions + end + config.after do # If a .netrc file was created during the test, delete it so that subsequent tests don't try to use the same logins QA::Git::Repository.new.delete_netrc |