diff options
Diffstat (limited to 'spec')
107 files changed, 537 insertions, 276 deletions
diff --git a/spec/config/application_spec.rb b/spec/config/application_spec.rb index 94fecc26e7f..7b64ad4a9b9 100644 --- a/spec/config/application_spec.rb +++ b/spec/config/application_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Application do # rubocop:disable RSpec/FilePath +RSpec.describe Gitlab::Application, feature_category: :scalability do # rubocop:disable RSpec/FilePath using RSpec::Parameterized::TableSyntax filtered_param = ActiveSupport::ParameterFilter::FILTERED diff --git a/spec/config/inject_enterprise_edition_module_spec.rb b/spec/config/inject_enterprise_edition_module_spec.rb index 96fc26fc80a..47cb36c569e 100644 --- a/spec/config/inject_enterprise_edition_module_spec.rb +++ b/spec/config/inject_enterprise_edition_module_spec.rb @@ -2,7 +2,7 @@ require 'fast_spec_helper' -RSpec.describe InjectEnterpriseEditionModule do +RSpec.describe InjectEnterpriseEditionModule, feature_category: :fulfillment_developer_productivity do let(:extension_name) { 'FF' } let(:extension_namespace) { Module.new } let(:fish_name) { 'Fish' } diff --git a/spec/config/mail_room_spec.rb b/spec/config/mail_room_spec.rb index ec306837361..cf2146bdf77 100644 --- a/spec/config/mail_room_spec.rb +++ b/spec/config/mail_room_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'mail_room.yml' do +RSpec.describe 'mail_room.yml', feature_category: :service_desk do include StubENV let(:mailroom_config_path) { 'config/mail_room.yml' } diff --git a/spec/config/object_store_settings_spec.rb b/spec/config/object_store_settings_spec.rb index 9275c809550..8feb0ab7b0f 100644 --- a/spec/config/object_store_settings_spec.rb +++ b/spec/config/object_store_settings_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('config', 'object_store_settings.rb') -RSpec.describe ObjectStoreSettings do +RSpec.describe ObjectStoreSettings, feature_category: :not_owned do describe '#parse!' do let(:settings) { Settingslogic.new(config) } diff --git a/spec/config/settings_spec.rb b/spec/config/settings_spec.rb index fe2081fa5de..4917b043812 100644 --- a/spec/config/settings_spec.rb +++ b/spec/config/settings_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Settings do +RSpec.describe Settings, feature_category: :authentication_and_authorization do describe 'omniauth' do it 'defaults to enabled' do expect(described_class.omniauth.enabled).to be true diff --git a/spec/config/smime_signature_settings_spec.rb b/spec/config/smime_signature_settings_spec.rb index 5ce6fdd975b..477ad4a74ed 100644 --- a/spec/config/smime_signature_settings_spec.rb +++ b/spec/config/smime_signature_settings_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe SmimeSignatureSettings do +RSpec.describe SmimeSignatureSettings, feature_category: :not_owned do describe '.parse' do let(:default_smime_key) { Rails.root.join('.gitlab_smime_key') } let(:default_smime_cert) { Rails.root.join('.gitlab_smime_cert') } diff --git a/spec/controllers/admin/hooks_controller_spec.rb b/spec/controllers/admin/hooks_controller_spec.rb index 82e4b873bf6..4101bd7f658 100644 --- a/spec/controllers/admin/hooks_controller_spec.rb +++ b/spec/controllers/admin/hooks_controller_spec.rb @@ -68,7 +68,7 @@ RSpec.describe Admin::HooksController do hook.reload expect(response).to have_gitlab_http_status(:found) - expect(flash[:notice]).to include('successfully updated') + expect(flash[:notice]).to include('was updated') expect(hook).to have_attributes(hook_params.except(:url_variables)) expect(hook).to have_attributes( url_variables: { 'token' => 'some secret value', 'baz' => 'woo' } diff --git a/spec/controllers/projects/hooks_controller_spec.rb b/spec/controllers/projects/hooks_controller_spec.rb index 0045262a4af..815370d428d 100644 --- a/spec/controllers/projects/hooks_controller_spec.rb +++ b/spec/controllers/projects/hooks_controller_spec.rb @@ -59,7 +59,7 @@ RSpec.describe Projects::HooksController do put :update, params: params expect(response).to have_gitlab_http_status(:found) - expect(flash[:notice]).to include('successfully updated') + expect(flash[:notice]).to include('was updated') expect(hook.reload.url_variables).to eq( 'a' => 'updated', diff --git a/spec/factories/ci/build_runner_sessions.rb b/spec/factories/ci/build_runner_sessions.rb new file mode 100644 index 00000000000..f78eaa6a5f1 --- /dev/null +++ b/spec/factories/ci/build_runner_sessions.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :ci_build_runner_session, class: 'Ci::BuildRunnerSession' do + build factory: :ci_build + url { 'https://gitlab.example.com' } + end +end diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 94c26bcc8a6..e6630e40147 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -58,10 +58,7 @@ RSpec.describe 'Admin::Hooks', feature_category: :integrations do describe 'Update existing hook' do let(:new_url) { generate(:url) } - - before do - create(:system_hook) - end + let_it_be(:hook) { create(:system_hook) } it 'updates existing hook' do visit admin_hooks_path @@ -71,9 +68,9 @@ RSpec.describe 'Admin::Hooks', feature_category: :integrations do check 'Enable SSL verification' click_button 'Save changes' - expect(page).to have_content 'SSL Verification: enabled' - expect(page).to have_current_path(admin_hooks_path, ignore_query: true) - expect(page).to have_content(new_url) + expect(page).to have_content('Enable SSL verification') + expect(page).to have_current_path(edit_admin_hook_path(hook), ignore_query: true) + expect(page).to have_content('Recent events') end end diff --git a/spec/features/discussion_comments/commit_spec.rb b/spec/features/discussion_comments/commit_spec.rb index 261e9fb9f3b..5407542dfc6 100644 --- a/spec/features/discussion_comments/commit_spec.rb +++ b/spec/features/discussion_comments/commit_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Thread Comments Commit', :js do +RSpec.describe 'Thread Comments Commit', :js, feature_category: :source_code_management do include RepoHelpers let(:user) { create(:user) } diff --git a/spec/features/discussion_comments/issue_spec.rb b/spec/features/discussion_comments/issue_spec.rb index ebb57b37918..90be3f0760d 100644 --- a/spec/features/discussion_comments/issue_spec.rb +++ b/spec/features/discussion_comments/issue_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Thread Comments Issue', :js do +RSpec.describe 'Thread Comments Issue', :js, feature_category: :source_code_management do let(:user) { create(:user) } let(:project) { create(:project) } let(:issue) { create(:issue, project: project) } diff --git a/spec/features/discussion_comments/merge_request_spec.rb b/spec/features/discussion_comments/merge_request_spec.rb index a90ff3721d3..64395a44e57 100644 --- a/spec/features/discussion_comments/merge_request_spec.rb +++ b/spec/features/discussion_comments/merge_request_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Thread Comments Merge Request', :js do +RSpec.describe 'Thread Comments Merge Request', :js, feature_category: :source_code_management do let(:user) { create(:user) } let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/features/discussion_comments/snippets_spec.rb b/spec/features/discussion_comments/snippets_spec.rb index ca0a6d6e1c5..a703c880737 100644 --- a/spec/features/discussion_comments/snippets_spec.rb +++ b/spec/features/discussion_comments/snippets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Thread Comments Snippet', :js do +RSpec.describe 'Thread Comments Snippet', :js, feature_category: :source_code_management do let_it_be(:user) { create(:user) } before do diff --git a/spec/features/error_tracking/user_filters_errors_by_status_spec.rb b/spec/features/error_tracking/user_filters_errors_by_status_spec.rb index 2ac43f67f64..168c4f330ca 100644 --- a/spec/features/error_tracking/user_filters_errors_by_status_spec.rb +++ b/spec/features/error_tracking/user_filters_errors_by_status_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe 'When a user filters Sentry errors by status', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do +RSpec.describe 'When a user filters Sentry errors by status', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline, +feature_category: :error_tracking do include_context 'sentry error tracking context feature' let_it_be(:issues_response_body) { fixture_file('sentry/issues_sample_response.json') } diff --git a/spec/features/error_tracking/user_searches_sentry_errors_spec.rb b/spec/features/error_tracking/user_searches_sentry_errors_spec.rb index 40718deed75..6026b42f7de 100644 --- a/spec/features/error_tracking/user_searches_sentry_errors_spec.rb +++ b/spec/features/error_tracking/user_searches_sentry_errors_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe 'When a user searches for Sentry errors', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do +RSpec.describe 'When a user searches for Sentry errors', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline, +feature_category: :error_tracking do include_context 'sentry error tracking context feature' let_it_be(:issues_response_body) { fixture_file('sentry/issues_sample_response.json') } diff --git a/spec/features/error_tracking/user_sees_error_details_spec.rb b/spec/features/error_tracking/user_sees_error_details_spec.rb index ecbb3fe0412..d7676d90d21 100644 --- a/spec/features/error_tracking/user_sees_error_details_spec.rb +++ b/spec/features/error_tracking/user_sees_error_details_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe 'View error details page', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do +RSpec.describe 'View error details page', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline, +feature_category: :error_tracking do include_context 'sentry error tracking context feature' context 'with current user as project owner' do diff --git a/spec/features/error_tracking/user_sees_error_index_spec.rb b/spec/features/error_tracking/user_sees_error_index_spec.rb index 21f9e688e3f..b7dfb6afc18 100644 --- a/spec/features/error_tracking/user_sees_error_index_spec.rb +++ b/spec/features/error_tracking/user_sees_error_index_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe 'View error index page', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline do +RSpec.describe 'View error index page', :js, :use_clean_rails_memory_store_caching, :sidekiq_inline, +feature_category: :error_tracking do include_context 'sentry error tracking context feature' let_it_be(:issues_response_body) { fixture_file('sentry/issues_sample_response.json') } diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index ba09cc20154..3ffa0dc5b64 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Explore Groups page', :js do +RSpec.describe 'Explore Groups page', :js, feature_category: :subgroups do let!(:user) { create :user } let!(:group) { create(:group) } let!(:public_group) { create(:group, :public) } diff --git a/spec/features/explore/groups_spec.rb b/spec/features/explore/groups_spec.rb index 201dc24b359..458f83dffb4 100644 --- a/spec/features/explore/groups_spec.rb +++ b/spec/features/explore/groups_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Explore Groups', :js do +RSpec.describe 'Explore Groups', :js, feature_category: :subgroups do let(:user) { create :user } let(:group) { create :group } let!(:private_project) do diff --git a/spec/features/explore/topics_spec.rb b/spec/features/explore/topics_spec.rb index f0c57c2417a..b5787a2dba8 100644 --- a/spec/features/explore/topics_spec.rb +++ b/spec/features/explore/topics_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Explore Topics' do +RSpec.describe 'Explore Topics', feature_category: :users do context 'when no topics exist' do it 'renders empty message', :aggregate_failures do visit topics_explore_projects_path diff --git a/spec/features/explore/user_explores_projects_spec.rb b/spec/features/explore/user_explores_projects_spec.rb index c082ff1fb0c..31dafca6206 100644 --- a/spec/features/explore/user_explores_projects_spec.rb +++ b/spec/features/explore/user_explores_projects_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'User explores projects' do +RSpec.describe 'User explores projects', feature_category: :users do context 'when some projects exist' do let_it_be(:archived_project) { create(:project, :archived) } let_it_be(:internal_project) { create(:project, :internal) } diff --git a/spec/features/issue_rebalancing_spec.rb b/spec/features/issue_rebalancing_spec.rb index 4fa29361c54..3b14924b90e 100644 --- a/spec/features/issue_rebalancing_spec.rb +++ b/spec/features/issue_rebalancing_spec.rb @@ -41,13 +41,13 @@ RSpec.describe 'Issue rebalancing' do it 'shows an alert in project issues list with manual sort', :js do visit project_issues_path(project, sort: 'relative_position') - expect(page).to have_selector('.gl-alert-danger', text: alert_message_regex, count: 1) + expect(page).to have_selector('.gl-alert-info', text: alert_message_regex, count: 1) end it 'shows an alert in group issues list with manual sort', :js do visit issues_group_path(group, sort: 'relative_position') - expect(page).to have_selector('.gl-alert-danger', text: alert_message_regex, count: 1) + expect(page).to have_selector('.gl-alert-info', text: alert_message_regex, count: 1) end it 'does not show an alert in project issues list with other sorts' do diff --git a/spec/features/jira_connect/branches_spec.rb b/spec/features/jira_connect/branches_spec.rb index c334a425849..bee31949dd4 100644 --- a/spec/features/jira_connect/branches_spec.rb +++ b/spec/features/jira_connect/branches_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Create GitLab branches from Jira', :js do +RSpec.describe 'Create GitLab branches from Jira', :js, feature_category: :integrations do let_it_be(:alice) { create(:user, name: 'Alice') } let_it_be(:bob) { create(:user, name: 'Bob') } diff --git a/spec/features/jira_connect/subscriptions_spec.rb b/spec/features/jira_connect/subscriptions_spec.rb index 0468cfd70fc..8686234df01 100644 --- a/spec/features/jira_connect/subscriptions_spec.rb +++ b/spec/features/jira_connect/subscriptions_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Subscriptions Content Security Policy' do +RSpec.describe 'Subscriptions Content Security Policy', feature_category: :integrations do include ContentSecurityPolicyHelpers let(:installation) { create(:jira_connect_installation) } diff --git a/spec/features/markdown/copy_as_gfm_spec.rb b/spec/features/markdown/copy_as_gfm_spec.rb index b5bf9279371..928ee16cd60 100644 --- a/spec/features/markdown/copy_as_gfm_spec.rb +++ b/spec/features/markdown/copy_as_gfm_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Copy as GFM', :js do +RSpec.describe 'Copy as GFM', :js, feature_category: :team_planning do include MarkupHelper include RepoHelpers include ActionView::Helpers::JavaScriptHelper diff --git a/spec/features/markdown/gitlab_flavored_markdown_spec.rb b/spec/features/markdown/gitlab_flavored_markdown_spec.rb index 17fe2dab8f7..36b02b17924 100644 --- a/spec/features/markdown/gitlab_flavored_markdown_spec.rb +++ b/spec/features/markdown/gitlab_flavored_markdown_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe "GitLab Flavored Markdown" do +RSpec.describe "GitLab Flavored Markdown", feature_category: :team_planning do let(:user) { create(:user) } let(:project) { create(:project) } let(:issue) { create(:issue, project: project) } diff --git a/spec/features/markdown/json_table_spec.rb b/spec/features/markdown/json_table_spec.rb index 6b74dbac255..a9afbe1fc57 100644 --- a/spec/features/markdown/json_table_spec.rb +++ b/spec/features/markdown/json_table_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Rendering json:table code block in markdown', :js do +RSpec.describe 'Rendering json:table code block in markdown', :js, feature_category: :team_planning do let_it_be(:project) { create(:project, :public) } it 'creates table correctly' do diff --git a/spec/features/markdown/keyboard_shortcuts_spec.rb b/spec/features/markdown/keyboard_shortcuts_spec.rb index 82288af1f9f..cfb8e61689f 100644 --- a/spec/features/markdown/keyboard_shortcuts_spec.rb +++ b/spec/features/markdown/keyboard_shortcuts_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Markdown keyboard shortcuts', :js do +RSpec.describe 'Markdown keyboard shortcuts', :js, feature_category: :team_planning do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } diff --git a/spec/features/markdown/kroki_spec.rb b/spec/features/markdown/kroki_spec.rb index f02f5d44244..dca00c5f2fa 100644 --- a/spec/features/markdown/kroki_spec.rb +++ b/spec/features/markdown/kroki_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'kroki rendering', :js do +RSpec.describe 'kroki rendering', :js, feature_category: :team_planning do let_it_be(:project) { create(:project, :public) } before do diff --git a/spec/features/markdown/markdown_spec.rb b/spec/features/markdown/markdown_spec.rb index 73670772402..132a03877f8 100644 --- a/spec/features/markdown/markdown_spec.rb +++ b/spec/features/markdown/markdown_spec.rb @@ -26,7 +26,7 @@ require 'erb' # # See the MarkdownFeature class for setup details. -RSpec.describe 'GitLab Markdown', :aggregate_failures do +RSpec.describe 'GitLab Markdown', :aggregate_failures, feature_category: :team_planning do include Capybara::Node::Matchers include MarkupHelper include MarkdownMatchers diff --git a/spec/features/markdown/math_spec.rb b/spec/features/markdown/math_spec.rb index 1f219886818..0c77bd2a8ff 100644 --- a/spec/features/markdown/math_spec.rb +++ b/spec/features/markdown/math_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Math rendering', :js do +RSpec.describe 'Math rendering', :js, feature_category: :team_planning do let!(:project) { create(:project, :public) } it 'renders inline and display math correctly' do diff --git a/spec/features/markdown/metrics_spec.rb b/spec/features/markdown/metrics_spec.rb index 61dd41204f8..b5e42b16f87 100644 --- a/spec/features/markdown/metrics_spec.rb +++ b/spec/features/markdown/metrics_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_store_caching, :sidekiq_inline do +RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_store_caching, :sidekiq_inline, feature_category: :team_planning do include PrometheusHelpers include KubernetesHelpers include GrafanaApiHelpers diff --git a/spec/features/markdown/sandboxed_mermaid_spec.rb b/spec/features/markdown/sandboxed_mermaid_spec.rb index 2bf88d7882d..26b397a1fd5 100644 --- a/spec/features/markdown/sandboxed_mermaid_spec.rb +++ b/spec/features/markdown/sandboxed_mermaid_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Sandboxed Mermaid rendering', :js do +RSpec.describe 'Sandboxed Mermaid rendering', :js, feature_category: :team_planning do let_it_be(:project) { create(:project, :public, :repository) } let_it_be(:description) do <<~MERMAID diff --git a/spec/features/projects/settings/webhooks_settings_spec.rb b/spec/features/projects/settings/webhooks_settings_spec.rb index b6a197e368f..8d22d84b9c9 100644 --- a/spec/features/projects/settings/webhooks_settings_spec.rb +++ b/spec/features/projects/settings/webhooks_settings_spec.rb @@ -74,8 +74,8 @@ RSpec.describe 'Projects > Settings > Webhook Settings', feature_category: :proj check 'Enable SSL verification' click_button 'Save changes' - expect(page).to have_content 'SSL Verification: enabled' - expect(page).to have_content(url) + expect(page).to have_content('Enable SSL verification') + expect(page).to have_current_path(edit_project_hook_path(project, hook), ignore_query: true) end it 'test existing webhook', :js do diff --git a/spec/fixtures/api/schemas/variable.json b/spec/fixtures/api/schemas/variable.json index c49d7d8c5ea..440e812d95b 100644 --- a/spec/fixtures/api/schemas/variable.json +++ b/spec/fixtures/api/schemas/variable.json @@ -8,13 +8,31 @@ "protected" ], "properties": { - "id": { "type": "integer" }, - "key": { "type": "string" }, - "value": { "type": "string" }, - "masked": { "type": "boolean" }, - "protected": { "type": "boolean" }, - "variable_type": { "type": "string" }, - "environment_scope": { "type": "string", "optional": true } + "id": { + "type": "integer" + }, + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "masked": { + "type": "boolean" + }, + "protected": { + "type": "boolean" + }, + "raw": { + "type": "boolean" + }, + "variable_type": { + "type": "string" + }, + "environment_scope": { + "type": "string", + "optional": true + } }, "additionalProperties": false -} +}
\ No newline at end of file diff --git a/spec/frontend/ci/ci_lint/components/ci_lint_spec.js b/spec/frontend/ci/ci_lint/components/ci_lint_spec.js index 518375cb831..d4f588a0e09 100644 --- a/spec/frontend/ci/ci_lint/components/ci_lint_spec.js +++ b/spec/frontend/ci/ci_lint/components/ci_lint_spec.js @@ -3,8 +3,8 @@ import { shallowMount } from '@vue/test-utils'; import { nextTick } from 'vue'; import waitForPromises from 'helpers/wait_for_promises'; import CiLint from '~/ci/ci_lint/components/ci_lint.vue'; -import CiLintResults from '~/pipeline_editor/components/lint/ci_lint_results.vue'; -import lintCIMutation from '~/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql'; +import CiLintResults from '~/ci/pipeline_editor/components/lint/ci_lint_results.vue'; +import lintCIMutation from '~/ci/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql'; import SourceEditor from '~/vue_shared/components/source_editor.vue'; import { mockLintDataValid } from '../mock_data'; diff --git a/spec/frontend/ci/ci_lint/mock_data.js b/spec/frontend/ci/ci_lint/mock_data.js index 660b2ad6e8b..05582470dfa 100644 --- a/spec/frontend/ci/ci_lint/mock_data.js +++ b/spec/frontend/ci/ci_lint/mock_data.js @@ -1,4 +1,4 @@ -import { mockJobs } from 'jest/pipeline_editor/mock_data'; +import { mockJobs } from 'jest/ci/pipeline_editor/mock_data'; export const mockLintDataError = { data: { diff --git a/spec/frontend/pipeline_editor/components/code_snippet_alert/code_snippet_alert_spec.js b/spec/frontend/ci/pipeline_editor/components/code_snippet_alert/code_snippet_alert_spec.js index d03f12bc249..b00e1adab63 100644 --- a/spec/frontend/pipeline_editor/components/code_snippet_alert/code_snippet_alert_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/code_snippet_alert/code_snippet_alert_spec.js @@ -3,8 +3,8 @@ import { mount } from '@vue/test-utils'; import { merge } from 'lodash'; import { TEST_HOST } from 'helpers/test_constants'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -import CodeSnippetAlert from '~/pipeline_editor/components/code_snippet_alert/code_snippet_alert.vue'; -import { CODE_SNIPPET_SOURCE_API_FUZZING } from '~/pipeline_editor/components/code_snippet_alert/constants'; +import CodeSnippetAlert from '~/ci/pipeline_editor/components/code_snippet_alert/code_snippet_alert.vue'; +import { CODE_SNIPPET_SOURCE_API_FUZZING } from '~/ci/pipeline_editor/components/code_snippet_alert/constants'; const apiFuzzingConfigurationPath = '/namespace/project/-/security/configuration/api_fuzzing'; diff --git a/spec/frontend/pipeline_editor/components/commit/commit_form_spec.js b/spec/frontend/ci/pipeline_editor/components/commit/commit_form_spec.js index 0ee6da9d329..8e1d8081dd8 100644 --- a/spec/frontend/pipeline_editor/components/commit/commit_form_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/commit/commit_form_spec.js @@ -2,7 +2,7 @@ import { nextTick } from 'vue'; import { GlFormInput, GlFormTextarea } from '@gitlab/ui'; import { shallowMount, mount } from '@vue/test-utils'; -import CommitForm from '~/pipeline_editor/components/commit/commit_form.vue'; +import CommitForm from '~/ci/pipeline_editor/components/commit/commit_form.vue'; import { mockCommitMessage, mockDefaultBranch } from '../../mock_data'; diff --git a/spec/frontend/pipeline_editor/components/commit/commit_section_spec.js b/spec/frontend/ci/pipeline_editor/components/commit/commit_section_spec.js index 744b0378a75..f6e93c55bbb 100644 --- a/spec/frontend/pipeline_editor/components/commit/commit_section_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/commit/commit_section_spec.js @@ -4,18 +4,18 @@ import { mount } from '@vue/test-utils'; import Vue from 'vue'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import CommitForm from '~/pipeline_editor/components/commit/commit_form.vue'; -import CommitSection from '~/pipeline_editor/components/commit/commit_section.vue'; +import CommitForm from '~/ci/pipeline_editor/components/commit/commit_form.vue'; +import CommitSection from '~/ci/pipeline_editor/components/commit/commit_section.vue'; import { COMMIT_ACTION_CREATE, COMMIT_ACTION_UPDATE, COMMIT_SUCCESS, COMMIT_SUCCESS_WITH_REDIRECT, -} from '~/pipeline_editor/constants'; -import { resolvers } from '~/pipeline_editor/graphql/resolvers'; -import commitCreate from '~/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql'; -import getCurrentBranch from '~/pipeline_editor/graphql/queries/client/current_branch.query.graphql'; -import updatePipelineEtag from '~/pipeline_editor/graphql/mutations/client/update_pipeline_etag.mutation.graphql'; +} from '~/ci/pipeline_editor/constants'; +import { resolvers } from '~/ci/pipeline_editor/graphql/resolvers'; +import commitCreate from '~/ci/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql'; +import getCurrentBranch from '~/ci/pipeline_editor/graphql/queries/client/current_branch.query.graphql'; +import updatePipelineEtag from '~/ci/pipeline_editor/graphql/mutations/client/update_pipeline_etag.mutation.graphql'; import { mockCiConfigPath, diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js b/spec/frontend/ci/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js index 7e1e5004d91..137137ec657 100644 --- a/spec/frontend/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/drawer/cards/first_pipeline_card_spec.js @@ -1,8 +1,8 @@ import { getByRole } from '@testing-library/dom'; import { mount } from '@vue/test-utils'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; -import FirstPipelineCard from '~/pipeline_editor/components/drawer/cards/first_pipeline_card.vue'; -import { pipelineEditorTrackingOptions } from '~/pipeline_editor/constants'; +import FirstPipelineCard from '~/ci/pipeline_editor/components/drawer/cards/first_pipeline_card.vue'; +import { pipelineEditorTrackingOptions } from '~/ci/pipeline_editor/constants'; describe('First pipeline card', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/getting_started_card_spec.js b/spec/frontend/ci/pipeline_editor/components/drawer/cards/getting_started_card_spec.js index c592e959068..cdce757ce7c 100644 --- a/spec/frontend/pipeline_editor/components/drawer/cards/getting_started_card_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/drawer/cards/getting_started_card_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import GettingStartedCard from '~/pipeline_editor/components/drawer/cards/getting_started_card.vue'; +import GettingStartedCard from '~/ci/pipeline_editor/components/drawer/cards/getting_started_card.vue'; describe('Getting started card', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/pipeline_config_reference_card_spec.js b/spec/frontend/ci/pipeline_editor/components/drawer/cards/pipeline_config_reference_card_spec.js index 49177befe0e..6909916c3e6 100644 --- a/spec/frontend/pipeline_editor/components/drawer/cards/pipeline_config_reference_card_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/drawer/cards/pipeline_config_reference_card_spec.js @@ -1,8 +1,8 @@ import { getByRole } from '@testing-library/dom'; import { mount } from '@vue/test-utils'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; -import PipelineConfigReferenceCard from '~/pipeline_editor/components/drawer/cards/pipeline_config_reference_card.vue'; -import { pipelineEditorTrackingOptions } from '~/pipeline_editor/constants'; +import PipelineConfigReferenceCard from '~/ci/pipeline_editor/components/drawer/cards/pipeline_config_reference_card.vue'; +import { pipelineEditorTrackingOptions } from '~/ci/pipeline_editor/constants'; describe('Pipeline config reference card', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/drawer/cards/visualize_and_lint_card_spec.js b/spec/frontend/ci/pipeline_editor/components/drawer/cards/visualize_and_lint_card_spec.js index bebd2484c1d..0c6879020de 100644 --- a/spec/frontend/pipeline_editor/components/drawer/cards/visualize_and_lint_card_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/drawer/cards/visualize_and_lint_card_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import VisualizeAndLintCard from '~/pipeline_editor/components/drawer/cards/getting_started_card.vue'; +import VisualizeAndLintCard from '~/ci/pipeline_editor/components/drawer/cards/getting_started_card.vue'; describe('Visual and Lint card', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js b/spec/frontend/ci/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js index 33b53bf6a56..42e372cc1db 100644 --- a/spec/frontend/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/drawer/pipeline_editor_drawer_spec.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils'; import { GlDrawer } from '@gitlab/ui'; -import PipelineEditorDrawer from '~/pipeline_editor/components/drawer/pipeline_editor_drawer.vue'; +import PipelineEditorDrawer from '~/ci/pipeline_editor/components/drawer/pipeline_editor_drawer.vue'; describe('Pipeline editor drawer', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/drawer/ui/demo_job_pill_spec.js b/spec/frontend/ci/pipeline_editor/components/drawer/ui/demo_job_pill_spec.js index edd2b45569a..f510c61ee74 100644 --- a/spec/frontend/pipeline_editor/components/drawer/ui/demo_job_pill_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/drawer/ui/demo_job_pill_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import DemoJobPill from '~/pipeline_editor/components/drawer/ui/demo_job_pill.vue'; +import DemoJobPill from '~/ci/pipeline_editor/components/drawer/ui/demo_job_pill.vue'; describe('Demo job pill', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/editor/ci_config_merged_preview_spec.js b/spec/frontend/ci/pipeline_editor/components/editor/ci_config_merged_preview_spec.js index 7dd8a77d055..2a2bc2547cc 100644 --- a/spec/frontend/pipeline_editor/components/editor/ci_config_merged_preview_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/editor/ci_config_merged_preview_spec.js @@ -2,7 +2,7 @@ import { GlIcon } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import { EDITOR_READY_EVENT } from '~/editor/constants'; -import CiConfigMergedPreview from '~/pipeline_editor/components/editor/ci_config_merged_preview.vue'; +import CiConfigMergedPreview from '~/ci/pipeline_editor/components/editor/ci_config_merged_preview.vue'; import { mockLintResponse, mockCiConfigPath } from '../../mock_data'; describe('Text editor component', () => { diff --git a/spec/frontend/pipeline_editor/components/editor/ci_editor_header_spec.js b/spec/frontend/ci/pipeline_editor/components/editor/ci_editor_header_spec.js index 930f08ef545..d7f0ce838d6 100644 --- a/spec/frontend/pipeline_editor/components/editor/ci_editor_header_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/editor/ci_editor_header_spec.js @@ -1,11 +1,11 @@ import { shallowMount } from '@vue/test-utils'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; -import CiEditorHeader from '~/pipeline_editor/components/editor/ci_editor_header.vue'; +import CiEditorHeader from '~/ci/pipeline_editor/components/editor/ci_editor_header.vue'; import { pipelineEditorTrackingOptions, TEMPLATE_REPOSITORY_URL, -} from '~/pipeline_editor/constants'; +} from '~/ci/pipeline_editor/constants'; describe('CI Editor Header', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/editor/text_editor_spec.js b/spec/frontend/ci/pipeline_editor/components/editor/text_editor_spec.js index 6cdf9a93d55..63e23c41263 100644 --- a/spec/frontend/pipeline_editor/components/editor/text_editor_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/editor/text_editor_spec.js @@ -1,8 +1,8 @@ import { shallowMount } from '@vue/test-utils'; import { EDITOR_READY_EVENT } from '~/editor/constants'; -import { SOURCE_EDITOR_DEBOUNCE } from '~/pipeline_editor/constants'; -import TextEditor from '~/pipeline_editor/components/editor/text_editor.vue'; +import { SOURCE_EDITOR_DEBOUNCE } from '~/ci/pipeline_editor/constants'; +import TextEditor from '~/ci/pipeline_editor/components/editor/text_editor.vue'; import { mockCiConfigPath, mockCiYml, diff --git a/spec/frontend/pipeline_editor/components/file-nav/branch_switcher_spec.js b/spec/frontend/ci/pipeline_editor/components/file-nav/branch_switcher_spec.js index f0347ad19ac..a26232df58f 100644 --- a/spec/frontend/pipeline_editor/components/file-nav/branch_switcher_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/file-nav/branch_switcher_spec.js @@ -9,12 +9,12 @@ import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import BranchSwitcher from '~/pipeline_editor/components/file_nav/branch_switcher.vue'; -import { DEFAULT_FAILURE } from '~/pipeline_editor/constants'; -import getAvailableBranchesQuery from '~/pipeline_editor/graphql/queries/available_branches.query.graphql'; -import getCurrentBranch from '~/pipeline_editor/graphql/queries/client/current_branch.query.graphql'; -import getLastCommitBranch from '~/pipeline_editor/graphql/queries/client/last_commit_branch.query.graphql'; -import { resolvers } from '~/pipeline_editor/graphql/resolvers'; +import BranchSwitcher from '~/ci/pipeline_editor/components/file_nav/branch_switcher.vue'; +import { DEFAULT_FAILURE } from '~/ci/pipeline_editor/constants'; +import getAvailableBranchesQuery from '~/ci/pipeline_editor/graphql/queries/available_branches.query.graphql'; +import getCurrentBranch from '~/ci/pipeline_editor/graphql/queries/client/current_branch.query.graphql'; +import getLastCommitBranch from '~/ci/pipeline_editor/graphql/queries/client/last_commit_branch.query.graphql'; +import { resolvers } from '~/ci/pipeline_editor/graphql/resolvers'; import { mockBranchPaginationLimit, diff --git a/spec/frontend/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js b/spec/frontend/ci/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js index d503aff40b8..907db16913c 100644 --- a/spec/frontend/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/file-nav/pipeline_editor_file_nav_spec.js @@ -3,15 +3,15 @@ import VueApollo from 'vue-apollo'; import { shallowMount } from '@vue/test-utils'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import createMockApollo from 'helpers/mock_apollo_helper'; -import BranchSwitcher from '~/pipeline_editor/components/file_nav/branch_switcher.vue'; -import PipelineEditorFileNav from '~/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue'; -import FileTreePopover from '~/pipeline_editor/components/popovers/file_tree_popover.vue'; -import getAppStatus from '~/pipeline_editor/graphql/queries/client/app_status.query.graphql'; +import BranchSwitcher from '~/ci/pipeline_editor/components/file_nav/branch_switcher.vue'; +import PipelineEditorFileNav from '~/ci/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue'; +import FileTreePopover from '~/ci/pipeline_editor/components/popovers/file_tree_popover.vue'; +import getAppStatus from '~/ci/pipeline_editor/graphql/queries/client/app_status.query.graphql'; import { EDITOR_APP_STATUS_EMPTY, EDITOR_APP_STATUS_LOADING, EDITOR_APP_STATUS_VALID, -} from '~/pipeline_editor/constants'; +} from '~/ci/pipeline_editor/constants'; Vue.use(VueApollo); diff --git a/spec/frontend/pipeline_editor/components/file-tree/container_spec.js b/spec/frontend/ci/pipeline_editor/components/file-tree/container_spec.js index f79074f1e0f..11ba517e0eb 100644 --- a/spec/frontend/pipeline_editor/components/file-tree/container_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/file-tree/container_spec.js @@ -3,9 +3,9 @@ import { shallowMount } from '@vue/test-utils'; import { GlAlert } from '@gitlab/ui'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { createMockDirective } from 'helpers/vue_mock_directive'; -import PipelineEditorFileTreeContainer from '~/pipeline_editor/components/file_tree/container.vue'; -import PipelineEditorFileTreeItem from '~/pipeline_editor/components/file_tree/file_item.vue'; -import { FILE_TREE_TIP_DISMISSED_KEY } from '~/pipeline_editor/constants'; +import PipelineEditorFileTreeContainer from '~/ci/pipeline_editor/components/file_tree/container.vue'; +import PipelineEditorFileTreeItem from '~/ci/pipeline_editor/components/file_tree/file_item.vue'; +import { FILE_TREE_TIP_DISMISSED_KEY } from '~/ci/pipeline_editor/constants'; import { mockCiConfigPath, mockIncludes, mockIncludesHelpPagePath } from '../../mock_data'; describe('Pipeline editor file nav', () => { diff --git a/spec/frontend/pipeline_editor/components/file-tree/file_item_spec.js b/spec/frontend/ci/pipeline_editor/components/file-tree/file_item_spec.js index f12ac14c6be..bceb741f91c 100644 --- a/spec/frontend/pipeline_editor/components/file-tree/file_item_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/file-tree/file_item_spec.js @@ -1,7 +1,7 @@ import { GlLink } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import FileIcon from '~/vue_shared/components/file_icon.vue'; -import PipelineEditorFileTreeItem from '~/pipeline_editor/components/file_tree/file_item.vue'; +import PipelineEditorFileTreeItem from '~/ci/pipeline_editor/components/file_tree/file_item.vue'; import { mockIncludesWithBlob, mockDefaultIncludes } from '../../mock_data'; describe('Pipeline editor file nav', () => { diff --git a/spec/frontend/pipeline_editor/components/header/pipeline_editor_header_spec.js b/spec/frontend/ci/pipeline_editor/components/header/pipeline_editor_header_spec.js index e1dc08b637f..555b9f29fbf 100644 --- a/spec/frontend/pipeline_editor/components/header/pipeline_editor_header_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/header/pipeline_editor_header_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; -import PipelineEditorHeader from '~/pipeline_editor/components/header/pipeline_editor_header.vue'; -import PipelineStatus from '~/pipeline_editor/components/header/pipeline_status.vue'; -import ValidationSegment from '~/pipeline_editor/components/header/validation_segment.vue'; +import PipelineEditorHeader from '~/ci/pipeline_editor/components/header/pipeline_editor_header.vue'; +import PipelineStatus from '~/ci/pipeline_editor/components/header/pipeline_status.vue'; +import ValidationSegment from '~/ci/pipeline_editor/components/header/validation_segment.vue'; import { mockCiYml, mockLintResponse } from '../../mock_data'; diff --git a/spec/frontend/pipeline_editor/components/header/pipeline_editor_mini_graph_spec.js b/spec/frontend/ci/pipeline_editor/components/header/pipeline_editor_mini_graph_spec.js index d40a9cc8100..6f28362e478 100644 --- a/spec/frontend/pipeline_editor/components/header/pipeline_editor_mini_graph_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/header/pipeline_editor_mini_graph_spec.js @@ -3,10 +3,10 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import PipelineEditorMiniGraph from '~/pipeline_editor/components/header/pipeline_editor_mini_graph.vue'; +import PipelineEditorMiniGraph from '~/ci/pipeline_editor/components/header/pipeline_editor_mini_graph.vue'; import PipelineMiniGraph from '~/pipelines/components/pipeline_mini_graph/pipeline_mini_graph.vue'; import getLinkedPipelinesQuery from '~/projects/commit_box/info/graphql/queries/get_linked_pipelines.query.graphql'; -import { PIPELINE_FAILURE } from '~/pipeline_editor/constants'; +import { PIPELINE_FAILURE } from '~/ci/pipeline_editor/constants'; import { mockLinkedPipelines, mockProjectFullPath, mockProjectPipeline } from '../../mock_data'; Vue.use(VueApollo); diff --git a/spec/frontend/pipeline_editor/components/header/pipeline_status_spec.js b/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js index 35315db39f8..a62c51ffb59 100644 --- a/spec/frontend/pipeline_editor/components/header/pipeline_status_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/header/pipeline_status_spec.js @@ -4,9 +4,9 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import PipelineStatus, { i18n } from '~/pipeline_editor/components/header/pipeline_status.vue'; -import getPipelineQuery from '~/pipeline_editor/graphql/queries/pipeline.query.graphql'; -import PipelineEditorMiniGraph from '~/pipeline_editor/components/header/pipeline_editor_mini_graph.vue'; +import PipelineStatus, { i18n } from '~/ci/pipeline_editor/components/header/pipeline_status.vue'; +import getPipelineQuery from '~/ci/pipeline_editor/graphql/queries/pipeline.query.graphql'; +import PipelineEditorMiniGraph from '~/ci/pipeline_editor/components/header/pipeline_editor_mini_graph.vue'; import { mockCommitSha, mockProjectPipeline, mockProjectFullPath } from '../../mock_data'; Vue.use(VueApollo); diff --git a/spec/frontend/pipeline_editor/components/header/pipline_editor_mini_graph_spec.js b/spec/frontend/ci/pipeline_editor/components/header/pipline_editor_mini_graph_spec.js index d40a9cc8100..6f28362e478 100644 --- a/spec/frontend/pipeline_editor/components/header/pipline_editor_mini_graph_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/header/pipline_editor_mini_graph_spec.js @@ -3,10 +3,10 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import PipelineEditorMiniGraph from '~/pipeline_editor/components/header/pipeline_editor_mini_graph.vue'; +import PipelineEditorMiniGraph from '~/ci/pipeline_editor/components/header/pipeline_editor_mini_graph.vue'; import PipelineMiniGraph from '~/pipelines/components/pipeline_mini_graph/pipeline_mini_graph.vue'; import getLinkedPipelinesQuery from '~/projects/commit_box/info/graphql/queries/get_linked_pipelines.query.graphql'; -import { PIPELINE_FAILURE } from '~/pipeline_editor/constants'; +import { PIPELINE_FAILURE } from '~/ci/pipeline_editor/constants'; import { mockLinkedPipelines, mockProjectFullPath, mockProjectPipeline } from '../../mock_data'; Vue.use(VueApollo); diff --git a/spec/frontend/pipeline_editor/components/header/validation_segment_spec.js b/spec/frontend/ci/pipeline_editor/components/header/validation_segment_spec.js index 1ad621e6f45..0853a6f4ca4 100644 --- a/spec/frontend/pipeline_editor/components/header/validation_segment_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/header/validation_segment_spec.js @@ -8,8 +8,8 @@ import createMockApollo from 'helpers/mock_apollo_helper'; import { sprintf } from '~/locale'; import ValidationSegment, { i18n, -} from '~/pipeline_editor/components/header/validation_segment.vue'; -import getAppStatus from '~/pipeline_editor/graphql/queries/client/app_status.query.graphql'; +} from '~/ci/pipeline_editor/components/header/validation_segment.vue'; +import getAppStatus from '~/ci/pipeline_editor/graphql/queries/client/app_status.query.graphql'; import { CI_CONFIG_STATUS_INVALID, EDITOR_APP_STATUS_EMPTY, @@ -17,7 +17,7 @@ import { EDITOR_APP_STATUS_LOADING, EDITOR_APP_STATUS_LINT_UNAVAILABLE, EDITOR_APP_STATUS_VALID, -} from '~/pipeline_editor/constants'; +} from '~/ci/pipeline_editor/constants'; import { mergeUnwrappedCiConfig, mockCiYml, diff --git a/spec/frontend/pipeline_editor/components/lint/ci_lint_results_spec.js b/spec/frontend/ci/pipeline_editor/components/lint/ci_lint_results_spec.js index 7f89eda4dff..d43bdec3a33 100644 --- a/spec/frontend/pipeline_editor/components/lint/ci_lint_results_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/lint/ci_lint_results_spec.js @@ -1,7 +1,7 @@ import { GlTableLite, GlLink } from '@gitlab/ui'; import { shallowMount, mount } from '@vue/test-utils'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; -import CiLintResults from '~/pipeline_editor/components/lint/ci_lint_results.vue'; +import CiLintResults from '~/ci/pipeline_editor/components/lint/ci_lint_results.vue'; import { mockJobs, mockErrors, mockWarnings } from '../../mock_data'; describe('CI Lint Results', () => { diff --git a/spec/frontend/pipeline_editor/components/lint/ci_lint_warnings_spec.js b/spec/frontend/ci/pipeline_editor/components/lint/ci_lint_warnings_spec.js index 36052a2e16a..b5e3ea06c2c 100644 --- a/spec/frontend/pipeline_editor/components/lint/ci_lint_warnings_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/lint/ci_lint_warnings_spec.js @@ -1,7 +1,7 @@ import { GlAlert, GlSprintf } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import { trimText } from 'helpers/text_helper'; -import CiLintWarnings from '~/pipeline_editor/components/lint/ci_lint_warnings.vue'; +import CiLintWarnings from '~/ci/pipeline_editor/components/lint/ci_lint_warnings.vue'; const warnings = ['warning 1', 'warning 2', 'warning 3']; diff --git a/spec/frontend/pipeline_editor/components/pipeline_editor_tabs_spec.js b/spec/frontend/ci/pipeline_editor/components/pipeline_editor_tabs_spec.js index 27707f8b01a..70310cbdb10 100644 --- a/spec/frontend/pipeline_editor/components/pipeline_editor_tabs_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/pipeline_editor_tabs_spec.js @@ -6,11 +6,11 @@ import VueApollo from 'vue-apollo'; import Vue, { nextTick } from 'vue'; import createMockApollo from 'helpers/mock_apollo_helper'; import setWindowLocation from 'helpers/set_window_location_helper'; -import CiConfigMergedPreview from '~/pipeline_editor/components/editor/ci_config_merged_preview.vue'; -import CiValidate from '~/pipeline_editor/components/validate/ci_validate.vue'; -import WalkthroughPopover from '~/pipeline_editor/components/popovers/walkthrough_popover.vue'; -import PipelineEditorTabs from '~/pipeline_editor/components/pipeline_editor_tabs.vue'; -import EditorTab from '~/pipeline_editor/components/ui/editor_tab.vue'; +import CiConfigMergedPreview from '~/ci/pipeline_editor/components/editor/ci_config_merged_preview.vue'; +import CiValidate from '~/ci/pipeline_editor/components/validate/ci_validate.vue'; +import WalkthroughPopover from '~/ci/pipeline_editor/components/popovers/walkthrough_popover.vue'; +import PipelineEditorTabs from '~/ci/pipeline_editor/components/pipeline_editor_tabs.vue'; +import EditorTab from '~/ci/pipeline_editor/components/ui/editor_tab.vue'; import { CREATE_TAB, EDITOR_APP_STATUS_EMPTY, @@ -20,9 +20,9 @@ import { TAB_QUERY_PARAM, VALIDATE_TAB, VALIDATE_TAB_BADGE_DISMISSED_KEY, -} from '~/pipeline_editor/constants'; +} from '~/ci/pipeline_editor/constants'; import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue'; -import getBlobContent from '~/pipeline_editor/graphql/queries/blob_content.query.graphql'; +import getBlobContent from '~/ci/pipeline_editor/graphql/queries/blob_content.query.graphql'; import { mockBlobContentQueryResponse, mockCiLintPath, diff --git a/spec/frontend/pipeline_editor/components/popovers/file_tree_popover_spec.js b/spec/frontend/ci/pipeline_editor/components/popovers/file_tree_popover_spec.js index 98ce3f6ea40..63ebfc0559d 100644 --- a/spec/frontend/pipeline_editor/components/popovers/file_tree_popover_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/popovers/file_tree_popover_spec.js @@ -1,8 +1,8 @@ import { nextTick } from 'vue'; import { GlLink, GlPopover, GlSprintf } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import FileTreePopover from '~/pipeline_editor/components/popovers/file_tree_popover.vue'; -import { FILE_TREE_POPOVER_DISMISSED_KEY } from '~/pipeline_editor/constants'; +import FileTreePopover from '~/ci/pipeline_editor/components/popovers/file_tree_popover.vue'; +import { FILE_TREE_POPOVER_DISMISSED_KEY } from '~/ci/pipeline_editor/constants'; import { mockIncludesHelpPagePath } from '../../mock_data'; describe('FileTreePopover component', () => { diff --git a/spec/frontend/pipeline_editor/components/popovers/validate_pipeline_popover_spec.js b/spec/frontend/ci/pipeline_editor/components/popovers/validate_pipeline_popover_spec.js index 97f785a71bc..cf0b974081e 100644 --- a/spec/frontend/pipeline_editor/components/popovers/validate_pipeline_popover_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/popovers/validate_pipeline_popover_spec.js @@ -1,7 +1,7 @@ import { GlLink, GlSprintf } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import ValidatePopover from '~/pipeline_editor/components/popovers/validate_pipeline_popover.vue'; -import { VALIDATE_TAB_FEEDBACK_URL } from '~/pipeline_editor/constants'; +import ValidatePopover from '~/ci/pipeline_editor/components/popovers/validate_pipeline_popover.vue'; +import { VALIDATE_TAB_FEEDBACK_URL } from '~/ci/pipeline_editor/constants'; import { mockSimulatePipelineHelpPagePath } from '../../mock_data'; describe('ValidatePopover component', () => { diff --git a/spec/frontend/pipeline_editor/components/popovers/walkthrough_popover_spec.js b/spec/frontend/ci/pipeline_editor/components/popovers/walkthrough_popover_spec.js index b86c82850c5..ca6033f2ff5 100644 --- a/spec/frontend/pipeline_editor/components/popovers/walkthrough_popover_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/popovers/walkthrough_popover_spec.js @@ -1,6 +1,6 @@ import { mount, shallowMount } from '@vue/test-utils'; import Vue from 'vue'; -import WalkthroughPopover from '~/pipeline_editor/components/popovers/walkthrough_popover.vue'; +import WalkthroughPopover from '~/ci/pipeline_editor/components/popovers/walkthrough_popover.vue'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; Vue.config.ignoredElements = ['gl-emoji']; diff --git a/spec/frontend/pipeline_editor/components/ui/confirm_unsaved_changes_dialog_spec.js b/spec/frontend/ci/pipeline_editor/components/ui/confirm_unsaved_changes_dialog_spec.js index 44fda2812d8..b22c98e5544 100644 --- a/spec/frontend/pipeline_editor/components/ui/confirm_unsaved_changes_dialog_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/ui/confirm_unsaved_changes_dialog_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import ConfirmDialog from '~/pipeline_editor/components/ui/confirm_unsaved_changes_dialog.vue'; +import ConfirmDialog from '~/ci/pipeline_editor/components/ui/confirm_unsaved_changes_dialog.vue'; describe('pipeline_editor/components/ui/confirm_unsaved_changes_dialog', () => { let beforeUnloadEvent; diff --git a/spec/frontend/pipeline_editor/components/ui/editor_tab_spec.js b/spec/frontend/ci/pipeline_editor/components/ui/editor_tab_spec.js index 24f27e8c5fb..a4e7abba7b0 100644 --- a/spec/frontend/pipeline_editor/components/ui/editor_tab_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/ui/editor_tab_spec.js @@ -1,7 +1,7 @@ import { GlAlert, GlBadge, GlTabs } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; import { nextTick } from 'vue'; -import EditorTab from '~/pipeline_editor/components/ui/editor_tab.vue'; +import EditorTab from '~/ci/pipeline_editor/components/ui/editor_tab.vue'; const mockContent1 = 'MOCK CONTENT 1'; const mockContent2 = 'MOCK CONTENT 2'; @@ -10,7 +10,7 @@ const MockSourceEditor = { template: '<div>EDITOR</div>', }; -describe('~/pipeline_editor/components/ui/editor_tab.vue', () => { +describe('~/ci/pipeline_editor/components/ui/editor_tab.vue', () => { let wrapper; let mockChildMounted = jest.fn(); diff --git a/spec/frontend/pipeline_editor/components/ui/pipeline_editor_empty_state_spec.js b/spec/frontend/ci/pipeline_editor/components/ui/pipeline_editor_empty_state_spec.js index c76c3460e99..3c68f74af43 100644 --- a/spec/frontend/pipeline_editor/components/ui/pipeline_editor_empty_state_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/ui/pipeline_editor_empty_state_spec.js @@ -1,7 +1,7 @@ import { GlButton, GlSprintf } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import PipelineEditorFileNav from '~/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue'; -import PipelineEditorEmptyState from '~/pipeline_editor/components/ui/pipeline_editor_empty_state.vue'; +import PipelineEditorFileNav from '~/ci/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue'; +import PipelineEditorEmptyState from '~/ci/pipeline_editor/components/ui/pipeline_editor_empty_state.vue'; describe('Pipeline editor empty state', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/ui/pipeline_editor_messages_spec.js b/spec/frontend/ci/pipeline_editor/components/ui/pipeline_editor_messages_spec.js index d9ecee31e83..fdb3be5c690 100644 --- a/spec/frontend/pipeline_editor/components/ui/pipeline_editor_messages_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/ui/pipeline_editor_messages_spec.js @@ -2,9 +2,9 @@ import { GlAlert } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import setWindowLocation from 'helpers/set_window_location_helper'; import { TEST_HOST } from 'helpers/test_constants'; -import CodeSnippetAlert from '~/pipeline_editor/components/code_snippet_alert/code_snippet_alert.vue'; -import { CODE_SNIPPET_SOURCES } from '~/pipeline_editor/components/code_snippet_alert/constants'; -import PipelineEditorMessages from '~/pipeline_editor/components/ui/pipeline_editor_messages.vue'; +import CodeSnippetAlert from '~/ci/pipeline_editor/components/code_snippet_alert/code_snippet_alert.vue'; +import { CODE_SNIPPET_SOURCES } from '~/ci/pipeline_editor/components/code_snippet_alert/constants'; +import PipelineEditorMessages from '~/ci/pipeline_editor/components/ui/pipeline_editor_messages.vue'; import { COMMIT_FAILURE, COMMIT_SUCCESS, @@ -13,7 +13,7 @@ import { DEFAULT_SUCCESS, LOAD_FAILURE_UNKNOWN, PIPELINE_FAILURE, -} from '~/pipeline_editor/constants'; +} from '~/ci/pipeline_editor/constants'; beforeEach(() => { setWindowLocation(TEST_HOST); diff --git a/spec/frontend/pipeline_editor/components/validate/ci_validate_spec.js b/spec/frontend/ci/pipeline_editor/components/validate/ci_validate_spec.js index 6e5b3125e75..ae25142b455 100644 --- a/spec/frontend/pipeline_editor/components/validate/ci_validate_spec.js +++ b/spec/frontend/ci/pipeline_editor/components/validate/ci_validate_spec.js @@ -5,19 +5,19 @@ import VueApollo from 'vue-apollo'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import createMockApollo from 'helpers/mock_apollo_helper'; -import CiLintResults from '~/pipeline_editor/components/lint/ci_lint_results.vue'; -import CiValidate, { i18n } from '~/pipeline_editor/components/validate/ci_validate.vue'; -import ValidatePipelinePopover from '~/pipeline_editor/components/popovers/validate_pipeline_popover.vue'; -import getBlobContent from '~/pipeline_editor/graphql/queries/blob_content.query.graphql'; -import lintCIMutation from '~/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql'; -import { pipelineEditorTrackingOptions } from '~/pipeline_editor/constants'; +import CiLintResults from '~/ci/pipeline_editor/components/lint/ci_lint_results.vue'; +import CiValidate, { i18n } from '~/ci/pipeline_editor/components/validate/ci_validate.vue'; +import ValidatePipelinePopover from '~/ci/pipeline_editor/components/popovers/validate_pipeline_popover.vue'; +import getBlobContent from '~/ci/pipeline_editor/graphql/queries/blob_content.query.graphql'; +import lintCIMutation from '~/ci/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql'; +import { pipelineEditorTrackingOptions } from '~/ci/pipeline_editor/constants'; import { mockBlobContentQueryResponse, mockCiLintPath, mockCiYml, mockSimulatePipelineHelpPagePath, } from '../../mock_data'; -import { mockLintDataError, mockLintDataValid } from '../../../ci/ci_lint/mock_data'; +import { mockLintDataError, mockLintDataValid } from '../../../ci_lint/mock_data'; const localVue = createLocalVue(); localVue.use(VueApollo); diff --git a/spec/frontend/pipeline_editor/graphql/__snapshots__/resolvers_spec.js.snap b/spec/frontend/ci/pipeline_editor/graphql/__snapshots__/resolvers_spec.js.snap index ee5a3cb288f..75a1354fd29 100644 --- a/spec/frontend/pipeline_editor/graphql/__snapshots__/resolvers_spec.js.snap +++ b/spec/frontend/ci/pipeline_editor/graphql/__snapshots__/resolvers_spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`~/pipeline_editor/graphql/resolvers Mutation lintCI lint data is as expected 1`] = ` +exports[`~/ci/pipeline_editor/graphql/resolvers Mutation lintCI lint data is as expected 1`] = ` Object { "__typename": "CiLintContent", "errors": Array [], diff --git a/spec/frontend/pipeline_editor/graphql/resolvers_spec.js b/spec/frontend/ci/pipeline_editor/graphql/resolvers_spec.js index 76ae96c623a..e54c72a758f 100644 --- a/spec/frontend/pipeline_editor/graphql/resolvers_spec.js +++ b/spec/frontend/ci/pipeline_editor/graphql/resolvers_spec.js @@ -1,7 +1,7 @@ import MockAdapter from 'axios-mock-adapter'; import axios from '~/lib/utils/axios_utils'; import httpStatus from '~/lib/utils/http_status'; -import { resolvers } from '~/pipeline_editor/graphql/resolvers'; +import { resolvers } from '~/ci/pipeline_editor/graphql/resolvers'; import { mockLintResponse } from '../mock_data'; jest.mock('~/api', () => { @@ -10,7 +10,7 @@ jest.mock('~/api', () => { }; }); -describe('~/pipeline_editor/graphql/resolvers', () => { +describe('~/ci/pipeline_editor/graphql/resolvers', () => { describe('Mutation', () => { describe('lintCI', () => { let mock; diff --git a/spec/frontend/pipeline_editor/mock_data.js b/spec/frontend/ci/pipeline_editor/mock_data.js index 2ea580b7b53..176dc24f169 100644 --- a/spec/frontend/pipeline_editor/mock_data.js +++ b/spec/frontend/ci/pipeline_editor/mock_data.js @@ -1,4 +1,4 @@ -import { CI_CONFIG_STATUS_INVALID, CI_CONFIG_STATUS_VALID } from '~/pipeline_editor/constants'; +import { CI_CONFIG_STATUS_INVALID, CI_CONFIG_STATUS_VALID } from '~/ci/pipeline_editor/constants'; import { unwrapStagesWithNeeds } from '~/pipelines/components/unwrapping_utils'; export const mockProjectNamespace = 'user1'; @@ -119,7 +119,7 @@ export const mockIncludes = [ ]; // Mock result of the graphql query at: -// app/assets/javascripts/pipeline_editor/graphql/queries/ci_config.graphql +// app/assets/javascripts/ci/pipeline_editor/graphql/queries/ci_config.graphql export const mockCiConfigQueryResponse = { data: { ciConfig: { diff --git a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js b/spec/frontend/ci/pipeline_editor/pipeline_editor_app_spec.js index 9fe1536d3f5..2246d0bbf7e 100644 --- a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js +++ b/spec/frontend/ci/pipeline_editor/pipeline_editor_app_spec.js @@ -6,30 +6,30 @@ import setWindowLocation from 'helpers/set_window_location_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { objectToQuery, redirectTo } from '~/lib/utils/url_utility'; -import { resolvers } from '~/pipeline_editor/graphql/resolvers'; -import PipelineEditorTabs from '~/pipeline_editor/components/pipeline_editor_tabs.vue'; -import PipelineEditorEmptyState from '~/pipeline_editor/components/ui/pipeline_editor_empty_state.vue'; -import PipelineEditorMessages from '~/pipeline_editor/components/ui/pipeline_editor_messages.vue'; -import PipelineEditorHeader from '~/pipeline_editor/components/header/pipeline_editor_header.vue'; +import { resolvers } from '~/ci/pipeline_editor/graphql/resolvers'; +import PipelineEditorTabs from '~/ci/pipeline_editor/components/pipeline_editor_tabs.vue'; +import PipelineEditorEmptyState from '~/ci/pipeline_editor/components/ui/pipeline_editor_empty_state.vue'; +import PipelineEditorMessages from '~/ci/pipeline_editor/components/ui/pipeline_editor_messages.vue'; +import PipelineEditorHeader from '~/ci/pipeline_editor/components/header/pipeline_editor_header.vue'; import ValidationSegment, { i18n as validationSegmenti18n, -} from '~/pipeline_editor/components/header/validation_segment.vue'; +} from '~/ci/pipeline_editor/components/header/validation_segment.vue'; import { COMMIT_SUCCESS, COMMIT_SUCCESS_WITH_REDIRECT, COMMIT_FAILURE, EDITOR_APP_STATUS_LOADING, -} from '~/pipeline_editor/constants'; -import getBlobContent from '~/pipeline_editor/graphql/queries/blob_content.query.graphql'; -import getCiConfigData from '~/pipeline_editor/graphql/queries/ci_config.query.graphql'; -import getTemplate from '~/pipeline_editor/graphql/queries/get_starter_template.query.graphql'; -import getLatestCommitShaQuery from '~/pipeline_editor/graphql/queries/latest_commit_sha.query.graphql'; -import getPipelineQuery from '~/pipeline_editor/graphql/queries/pipeline.query.graphql'; -import getCurrentBranch from '~/pipeline_editor/graphql/queries/client/current_branch.query.graphql'; -import getAppStatus from '~/pipeline_editor/graphql/queries/client/app_status.query.graphql'; - -import PipelineEditorApp from '~/pipeline_editor/pipeline_editor_app.vue'; -import PipelineEditorHome from '~/pipeline_editor/pipeline_editor_home.vue'; +} from '~/ci/pipeline_editor/constants'; +import getBlobContent from '~/ci/pipeline_editor/graphql/queries/blob_content.query.graphql'; +import getCiConfigData from '~/ci/pipeline_editor/graphql/queries/ci_config.query.graphql'; +import getTemplate from '~/ci/pipeline_editor/graphql/queries/get_starter_template.query.graphql'; +import getLatestCommitShaQuery from '~/ci/pipeline_editor/graphql/queries/latest_commit_sha.query.graphql'; +import getPipelineQuery from '~/ci/pipeline_editor/graphql/queries/pipeline.query.graphql'; +import getCurrentBranch from '~/ci/pipeline_editor/graphql/queries/client/current_branch.query.graphql'; +import getAppStatus from '~/ci/pipeline_editor/graphql/queries/client/app_status.query.graphql'; + +import PipelineEditorApp from '~/ci/pipeline_editor/pipeline_editor_app.vue'; +import PipelineEditorHome from '~/ci/pipeline_editor/pipeline_editor_home.vue'; import { mockCiConfigPath, diff --git a/spec/frontend/pipeline_editor/pipeline_editor_home_spec.js b/spec/frontend/ci/pipeline_editor/pipeline_editor_home_spec.js index 2b06660c4b3..621e015e825 100644 --- a/spec/frontend/pipeline_editor/pipeline_editor_home_spec.js +++ b/spec/frontend/ci/pipeline_editor/pipeline_editor_home_spec.js @@ -3,14 +3,14 @@ import { nextTick } from 'vue'; import { GlButton, GlDrawer, GlModal } from '@gitlab/ui'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import setWindowLocation from 'helpers/set_window_location_helper'; -import CiEditorHeader from '~/pipeline_editor/components/editor/ci_editor_header.vue'; -import CommitSection from '~/pipeline_editor/components/commit/commit_section.vue'; -import PipelineEditorDrawer from '~/pipeline_editor/components/drawer/pipeline_editor_drawer.vue'; -import PipelineEditorFileNav from '~/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue'; -import PipelineEditorFileTree from '~/pipeline_editor/components/file_tree/container.vue'; -import BranchSwitcher from '~/pipeline_editor/components/file_nav/branch_switcher.vue'; -import PipelineEditorHeader from '~/pipeline_editor/components/header/pipeline_editor_header.vue'; -import PipelineEditorTabs from '~/pipeline_editor/components/pipeline_editor_tabs.vue'; +import CiEditorHeader from '~/ci/pipeline_editor/components/editor/ci_editor_header.vue'; +import CommitSection from '~/ci/pipeline_editor/components/commit/commit_section.vue'; +import PipelineEditorDrawer from '~/ci/pipeline_editor/components/drawer/pipeline_editor_drawer.vue'; +import PipelineEditorFileNav from '~/ci/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue'; +import PipelineEditorFileTree from '~/ci/pipeline_editor/components/file_tree/container.vue'; +import BranchSwitcher from '~/ci/pipeline_editor/components/file_nav/branch_switcher.vue'; +import PipelineEditorHeader from '~/ci/pipeline_editor/components/header/pipeline_editor_header.vue'; +import PipelineEditorTabs from '~/ci/pipeline_editor/components/pipeline_editor_tabs.vue'; import { CREATE_TAB, FILE_TREE_DISPLAY_KEY, @@ -18,8 +18,8 @@ import { MERGED_TAB, TABS_INDEX, VISUALIZE_TAB, -} from '~/pipeline_editor/constants'; -import PipelineEditorHome from '~/pipeline_editor/pipeline_editor_home.vue'; +} from '~/ci/pipeline_editor/constants'; +import PipelineEditorHome from '~/ci/pipeline_editor/pipeline_editor_home.vue'; import { mockLintResponse, mockCiYml } from './mock_data'; diff --git a/spec/frontend/ide/services/index_spec.js b/spec/frontend/ide/services/index_spec.js index 0fab828dfb3..5847e8e1518 100644 --- a/spec/frontend/ide/services/index_spec.js +++ b/spec/frontend/ide/services/index_spec.js @@ -6,7 +6,7 @@ import dismissUserCallout from '~/graphql_shared/mutations/dismiss_user_callout. import services from '~/ide/services'; import { query, mutate } from '~/ide/services/gql'; import { escapeFileUrl } from '~/lib/utils/url_utility'; -import ciConfig from '~/pipeline_editor/graphql/queries/ci_config.query.graphql'; +import ciConfig from '~/ci/pipeline_editor/graphql/queries/ci_config.query.graphql'; import { projectData } from '../mock_data'; jest.mock('~/api'); diff --git a/spec/frontend/incidents_settings/components/incidents_settings_service_spec.js b/spec/frontend/incidents_settings/components/incidents_settings_service_spec.js index 1b0253480e0..08c407cc4b4 100644 --- a/spec/frontend/incidents_settings/components/incidents_settings_service_spec.js +++ b/spec/frontend/incidents_settings/components/incidents_settings_service_spec.js @@ -1,5 +1,5 @@ import AxiosMockAdapter from 'axios-mock-adapter'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { ERROR_MSG } from '~/incidents_settings/constants'; import IncidentsSettingsService from '~/incidents_settings/incidents_settings_service'; import axios from '~/lib/utils/axios_utils'; @@ -37,7 +37,7 @@ describe('IncidentsSettingsService', () => { mock.onPatch().reply(httpStatusCodes.BAD_REQUEST); return service.updateSettings({}).then(() => { - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledWith({ message: expect.stringContaining(ERROR_MSG), }); }); diff --git a/spec/frontend/issues/list/components/issues_list_app_spec.js b/spec/frontend/issues/list/components/issues_list_app_spec.js index f5624923b46..b820b7d02bc 100644 --- a/spec/frontend/issues/list/components/issues_list_app_spec.js +++ b/spec/frontend/issues/list/components/issues_list_app_spec.js @@ -21,7 +21,7 @@ import { setSortPreferenceMutationResponseWithErrors, urlParams, } from 'jest/issues/list/mock_data'; -import { createAlert, FLASH_TYPES } from '~/flash'; +import { createAlert, VARIANT_INFO } from '~/flash'; import { convertToGraphQLId, getIdFromGraphQLId } from '~/graphql_shared/utils'; import CsvImportExportButtons from '~/issuable/components/csv_import_export_buttons.vue'; import IssuableByEmail from '~/issuable/components/issuable_by_email.vue'; @@ -402,7 +402,7 @@ describe('CE IssuesListApp component', () => { it('shows an alert to tell the user that manual reordering is disabled', () => { expect(createAlert).toHaveBeenCalledWith({ message: IssuesListApp.i18n.issueRepositioningMessage, - type: FLASH_TYPES.NOTICE, + variant: VARIANT_INFO, }); }); }); @@ -442,7 +442,7 @@ describe('CE IssuesListApp component', () => { it('shows an alert to tell the user they must be signed in to search', () => { expect(createAlert).toHaveBeenCalledWith({ message: IssuesListApp.i18n.anonymousSearchingMessage, - type: FLASH_TYPES.NOTICE, + variant: VARIANT_INFO, }); }); }); @@ -833,7 +833,7 @@ describe('CE IssuesListApp component', () => { it('shows an alert to tell the user that manual reordering is disabled', () => { expect(createAlert).toHaveBeenCalledWith({ message: IssuesListApp.i18n.issueRepositioningMessage, - type: FLASH_TYPES.NOTICE, + variant: VARIANT_INFO, }); }); }); @@ -920,7 +920,7 @@ describe('CE IssuesListApp component', () => { it('shows an alert to tell the user they must be signed in to search', () => { expect(createAlert).toHaveBeenCalledWith({ message: IssuesListApp.i18n.anonymousSearchingMessage, - type: FLASH_TYPES.NOTICE, + variant: VARIANT_INFO, }); }); }); diff --git a/spec/frontend/issues/related_merge_requests/store/actions_spec.js b/spec/frontend/issues/related_merge_requests/store/actions_spec.js index 4327fac15d4..d3ec6c3bc9d 100644 --- a/spec/frontend/issues/related_merge_requests/store/actions_spec.js +++ b/spec/frontend/issues/related_merge_requests/store/actions_spec.js @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import axios from '~/lib/utils/axios_utils'; import * as actions from '~/issues/related_merge_requests/store/actions'; import * as types from '~/issues/related_merge_requests/store/mutation_types'; @@ -95,8 +95,8 @@ describe('RelatedMergeRequest store actions', () => { [], [{ type: 'requestData' }, { type: 'receiveDataError' }], ); - expect(createFlash).toHaveBeenCalledTimes(1); - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledTimes(1); + expect(createAlert).toHaveBeenCalledWith({ message: expect.stringMatching('Something went wrong'), }); }); diff --git a/spec/frontend/issues/show/components/app_spec.js b/spec/frontend/issues/show/components/app_spec.js index 3d027e2084c..f0e8affe4ce 100644 --- a/spec/frontend/issues/show/components/app_spec.js +++ b/spec/frontend/issues/show/components/app_spec.js @@ -6,6 +6,7 @@ import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import '~/behaviors/markdown/render_gfm'; +import { createAlert } from '~/flash'; import { IssuableStatus, IssuableStatusText, IssuableType } from '~/issues/constants'; import IssuableApp from '~/issues/show/components/app.vue'; import DescriptionComponent from '~/issues/show/components/description.vue'; @@ -26,8 +27,9 @@ import { zoomMeetingUrl, } from '../mock_data/mock_data'; -jest.mock('~/lib/utils/url_utility'); +jest.mock('~/flash'); jest.mock('~/issues/show/event_hub'); +jest.mock('~/lib/utils/url_utility'); const REALTIME_REQUEST_STACK = [initialRequest, secondRequest]; @@ -270,9 +272,7 @@ describe('Issuable output', () => { await wrapper.vm.updateIssuable(); expect(eventHub.$emit).not.toHaveBeenCalledWith('close.form'); - expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe( - `Error updating issue`, - ); + expect(createAlert).toHaveBeenCalledWith({ message: `Error updating issue` }); }); it('returns the correct error message for issuableType', async () => { @@ -282,9 +282,7 @@ describe('Issuable output', () => { await nextTick(); await wrapper.vm.updateIssuable(); expect(eventHub.$emit).not.toHaveBeenCalledWith('close.form'); - expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe( - `Error updating merge request`, - ); + expect(createAlert).toHaveBeenCalledWith({ message: `Error updating merge request` }); }); it('shows error message from backend if exists', async () => { @@ -294,9 +292,9 @@ describe('Issuable output', () => { .mockRejectedValue({ response: { data: { errors: [msg] } } }); await wrapper.vm.updateIssuable(); - expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe( - `${wrapper.vm.defaultErrorMessage}. ${msg}`, - ); + expect(createAlert).toHaveBeenCalledWith({ + message: `${wrapper.vm.defaultErrorMessage}. ${msg}`, + }); }); }); }); @@ -354,9 +352,7 @@ describe('Issuable output', () => { .reply(() => Promise.reject(new Error('something went wrong'))); return wrapper.vm.requestTemplatesAndShowForm().then(() => { - expect(document.querySelector('.flash-container .flash-text').textContent).toContain( - 'Error updating issue', - ); + expect(createAlert).toHaveBeenCalledWith({ message: 'Error updating issue' }); expect(formSpy).toHaveBeenCalledWith(); }); @@ -402,9 +398,9 @@ describe('Issuable output', () => { wrapper.setProps({ issuableType: 'merge request' }); return wrapper.vm.updateStoreState().then(() => { - expect(document.querySelector('.flash-container .flash-text').innerText.trim()).toBe( - `Error updating ${wrapper.vm.issuableType}`, - ); + expect(createAlert).toHaveBeenCalledWith({ + message: `Error updating ${wrapper.vm.issuableType}`, + }); }); }); }); diff --git a/spec/frontend/issues/show/components/description_spec.js b/spec/frontend/issues/show/components/description_spec.js index 9d9abce887b..e777d6f4b21 100644 --- a/spec/frontend/issues/show/components/description_spec.js +++ b/spec/frontend/issues/show/components/description_spec.js @@ -12,7 +12,7 @@ import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import Description from '~/issues/show/components/description.vue'; import { updateHistory } from '~/lib/utils/url_utility'; import workItemQuery from '~/work_items/graphql/work_item.query.graphql'; @@ -370,7 +370,7 @@ describe('Description component', () => { await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith( + expect(createAlert).toHaveBeenCalledWith( expect.objectContaining({ message: 'Something went wrong when creating task. Please try again.', }), diff --git a/spec/frontend/issues/show/components/header_actions_spec.js b/spec/frontend/issues/show/components/header_actions_spec.js index dc2b3c6fc48..50ad04c88cf 100644 --- a/spec/frontend/issues/show/components/header_actions_spec.js +++ b/spec/frontend/issues/show/components/header_actions_spec.js @@ -3,7 +3,7 @@ import { GlButton, GlDropdownItem, GlLink, GlModal } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Vuex from 'vuex'; import { mockTracking } from 'helpers/tracking_helper'; -import createFlash, { FLASH_TYPES } from '~/flash'; +import { createAlert, VARIANT_SUCCESS } from '~/flash'; import { IssuableStatus, IssueType } from '~/issues/constants'; import DeleteIssueModal from '~/issues/show/components/delete_issue_modal.vue'; import HeaderActions from '~/issues/show/components/header_actions.vue'; @@ -284,9 +284,9 @@ describe('HeaderActions component', () => { }); it('shows a success message and tells the user they are being redirected', () => { - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledWith({ message: 'The issue was successfully promoted to an epic. Redirecting to epic...', - type: FLASH_TYPES.SUCCESS, + variant: VARIANT_SUCCESS, }); }); @@ -309,7 +309,7 @@ describe('HeaderActions component', () => { }); it('shows an error message', () => { - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledWith({ message: HeaderActions.i18n.promoteErrorMessage, }); }); diff --git a/spec/frontend/pipelines/components/pipelines_list/empty_state/pipelines_ci_templates_spec.js b/spec/frontend/pipelines/components/pipelines_list/empty_state/pipelines_ci_templates_spec.js index b537c81da3f..f255e0d857f 100644 --- a/spec/frontend/pipelines/components/pipelines_list/empty_state/pipelines_ci_templates_spec.js +++ b/spec/frontend/pipelines/components/pipelines_list/empty_state/pipelines_ci_templates_spec.js @@ -13,7 +13,7 @@ import { RUNNERS_DOCUMENTATION_LINK_CLICKED_EVENT, RUNNERS_SETTINGS_BUTTON_CLICKED_EVENT, I18N, -} from '~/pipeline_editor/constants'; +} from '~/ci/pipeline_editor/constants'; const pipelineEditorPath = '/-/ci/editor'; const ciRunnerSettingsPath = '/-/settings/ci_cd'; diff --git a/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js b/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js index d9199f3b0f7..df10742fd93 100644 --- a/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js +++ b/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js @@ -1,7 +1,7 @@ import { GlAlert } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import { setHTMLFixture } from 'helpers/fixtures'; -import { CI_CONFIG_STATUS_VALID } from '~/pipeline_editor/constants'; +import { CI_CONFIG_STATUS_VALID } from '~/ci/pipeline_editor/constants'; import LinksInner from '~/pipelines/components/graph_shared/links_inner.vue'; import LinksLayer from '~/pipelines/components/graph_shared/links_layer.vue'; import JobPill from '~/pipelines/components/pipeline_graph/job_pill.vue'; diff --git a/spec/frontend/sidebar/components/move/move_issues_button_spec.js b/spec/frontend/sidebar/components/move/move_issues_button_spec.js index 7431686a3f4..999340da27c 100644 --- a/spec/frontend/sidebar/components/move/move_issues_button_spec.js +++ b/spec/frontend/sidebar/components/move/move_issues_button_spec.js @@ -6,7 +6,7 @@ import { GlAlert } from '@gitlab/ui'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { useMockLocationHelper } from 'helpers/mock_window_location_helper'; -import createFlash from '~/flash'; +import { createAlert } from '~/flash'; import { logError } from '~/lib/logger'; import IssuableMoveDropdown from '~/sidebar/components/move/issuable_move_dropdown.vue'; import issuableEventHub from '~/issues/list/eventhub'; @@ -389,7 +389,7 @@ describe('MoveIssuesButton', () => { await waitForPromises(); expect(logError).not.toHaveBeenCalled(); - expect(createFlash).not.toHaveBeenCalled(); + expect(createAlert).not.toHaveBeenCalled(); }); it('does not create flashes or logs errors when only tasks are selected', async () => { @@ -399,7 +399,7 @@ describe('MoveIssuesButton', () => { await waitForPromises(); expect(logError).not.toHaveBeenCalled(); - expect(createFlash).not.toHaveBeenCalled(); + expect(createAlert).not.toHaveBeenCalled(); }); it('does not create flashes or logs errors when only test cases are selected', async () => { @@ -409,7 +409,7 @@ describe('MoveIssuesButton', () => { await waitForPromises(); expect(logError).not.toHaveBeenCalled(); - expect(createFlash).not.toHaveBeenCalled(); + expect(createAlert).not.toHaveBeenCalled(); }); it('does not create flashes or logs errors when only tasks and test cases are selected', async () => { @@ -419,7 +419,7 @@ describe('MoveIssuesButton', () => { await waitForPromises(); expect(logError).not.toHaveBeenCalled(); - expect(createFlash).not.toHaveBeenCalled(); + expect(createAlert).not.toHaveBeenCalled(); }); it('does not create flashes or logs errors when issues are moved without errors', async () => { @@ -432,7 +432,7 @@ describe('MoveIssuesButton', () => { await waitForPromises(); expect(logError).not.toHaveBeenCalled(); - expect(createFlash).not.toHaveBeenCalled(); + expect(createAlert).not.toHaveBeenCalled(); }); it('creates a flash and logs errors when a mutation returns errors', async () => { @@ -456,8 +456,8 @@ describe('MoveIssuesButton', () => { ); // Only one flash is created even if multiple errors are reported - expect(createFlash).toHaveBeenCalledTimes(1); - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledTimes(1); + expect(createAlert).toHaveBeenCalledWith({ message: 'There was an error while moving the issues.', }); }); @@ -469,8 +469,8 @@ describe('MoveIssuesButton', () => { await waitForPromises(); expect(logError).not.toHaveBeenCalled(); - expect(createFlash).toHaveBeenCalledTimes(1); - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledTimes(1); + expect(createAlert).toHaveBeenCalledWith({ message: 'There was an error while moving the issues.', }); }); diff --git a/spec/graphql/resolvers/environments/nested_environments_resolver_spec.rb b/spec/graphql/resolvers/environments/nested_environments_resolver_spec.rb new file mode 100644 index 00000000000..07197b1838f --- /dev/null +++ b/spec/graphql/resolvers/environments/nested_environments_resolver_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Resolvers::Environments::NestedEnvironmentsResolver, feature_category: :continuous_delivery do + include GraphqlHelpers + include Gitlab::Graphql::Laziness + + let_it_be(:project) { create(:project, :repository, :private) } + let_it_be(:environment) { create(:environment, project: project, name: 'test') } + let_it_be(:environment2) { create(:environment, project: project, name: 'folder1/test') } + let_it_be(:environment3) { create(:environment, project: project, name: 'folder1/test2') } + let_it_be(:environment4) { create(:environment, project: project, name: 'folder2/test') } + + let_it_be(:developer) { create(:user).tap { |u| project.add_developer(u) } } + + let(:current_user) { developer } + + describe '#resolve' do + it 'finds the nested environments when status matches' do + expect(resolve_nested_environments(status: :created).to_a.pluck(:name, :size)) + .to match_array([ + ['test', 1], + ['folder1', 2], + ['folder2', 1] + ]) + end + + it 'finds the nested environments when searching by name' do + expect(resolve_nested_environments(search: 'folder2').to_a.pluck(:name, :size)) + .to match_array([ + ['folder2', 1] + ]) + end + + it 'finds the nested environments when name matches exactly' do + expect(resolve_nested_environments(name: 'test').to_a.pluck(:name, :size)) + .to match_array([ + ['test', 1] + ]) + end + end + + def resolve_nested_environments(args = {}, context = { current_user: current_user }) + resolve(described_class, obj: project, ctx: context, args: args) + end +end diff --git a/spec/lib/gitlab/memory/watchdog/monitor/rss_memory_limit_spec.rb b/spec/lib/gitlab/memory/watchdog/monitor/rss_memory_limit_spec.rb index fffe5d5ff00..4780b1eba53 100644 --- a/spec/lib/gitlab/memory/watchdog/monitor/rss_memory_limit_spec.rb +++ b/spec/lib/gitlab/memory/watchdog/monitor/rss_memory_limit_spec.rb @@ -4,6 +4,7 @@ require 'fast_spec_helper' require 'support/shared_examples/lib/gitlab/memory/watchdog/monitor_result_shared_examples' RSpec.describe Gitlab::Memory::Watchdog::Monitor::RssMemoryLimit do + let(:max_rss_limit_gauge) { instance_double(::Prometheus::Client::Gauge) } let(:memory_limit_bytes) { 2_097_152_000 } let(:worker_memory_bytes) { 1_048_576_000 } @@ -12,9 +13,21 @@ RSpec.describe Gitlab::Memory::Watchdog::Monitor::RssMemoryLimit do end before do + allow(Gitlab::Metrics).to receive(:gauge) + .with(:gitlab_memwd_max_memory_limit, anything) + .and_return(max_rss_limit_gauge) + allow(max_rss_limit_gauge).to receive(:set) allow(Gitlab::Metrics::System).to receive(:memory_usage_rss).and_return({ total: worker_memory_bytes }) end + describe '#initialize' do + it 'sets the max rss limit gauge' do + expect(max_rss_limit_gauge).to receive(:set).with({}, memory_limit_bytes) + + monitor + end + end + describe '#call' do context 'when process exceeds threshold' do let(:worker_memory_bytes) { memory_limit_bytes + 1 } diff --git a/spec/models/ci/build_metadata_spec.rb b/spec/models/ci/build_metadata_spec.rb index 9f733d3ab4b..8bf3af44be6 100644 --- a/spec/models/ci/build_metadata_spec.rb +++ b/spec/models/ci/build_metadata_spec.rb @@ -198,6 +198,29 @@ RSpec.describe Ci::BuildMetadata do end end + describe '#enable_debug_trace!' do + subject { metadata.enable_debug_trace! } + + context 'when debug_trace_enabled is false' do + it 'sets debug_trace_enabled to true' do + subject + + expect(metadata.debug_trace_enabled).to eq(true) + end + end + + context 'when debug_trace_enabled is true' do + before do + metadata.update!(debug_trace_enabled: true) + end + + it 'does not set debug_trace_enabled to true', :aggregate_failures do + expect(described_class).not_to receive(:save!) + expect(metadata.debug_trace_enabled).to eq(true) + end + end + end + describe 'partitioning' do context 'with job' do let(:status) { build(:commit_status, partition_id: 123) } diff --git a/spec/models/ci/build_runner_session_spec.rb b/spec/models/ci/build_runner_session_spec.rb index 8dfe854511c..5e1a489ed8b 100644 --- a/spec/models/ci/build_runner_session_spec.rb +++ b/spec/models/ci/build_runner_session_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::BuildRunnerSession, model: true do +RSpec.describe Ci::BuildRunnerSession, model: true, feature_category: :continuous_integration do let!(:build) { create(:ci_build, :with_runner_session) } let(:url) { 'https://new.example.com' } @@ -174,4 +174,20 @@ RSpec.describe Ci::BuildRunnerSession, model: true do end end end + + describe 'partitioning' do + include Ci::PartitioningHelpers + + let(:new_pipeline) { create(:ci_pipeline) } + let(:new_build) { create(:ci_build, pipeline: new_pipeline) } + let(:build_runner_session) { create(:ci_build_runner_session, build: new_build) } + + before do + stub_current_partition_id + end + + it 'assigns the same partition id as the one that build has' do + expect(build_runner_session.partition_id).to eq(ci_testing_partition_id) + end + end end diff --git a/spec/models/work_items/parent_link_spec.rb b/spec/models/work_items/parent_link_spec.rb index 070b2eef86a..ee0e4535bd1 100644 --- a/spec/models/work_items/parent_link_spec.rb +++ b/spec/models/work_items/parent_link_spec.rb @@ -2,7 +2,9 @@ require 'spec_helper' -RSpec.describe WorkItems::ParentLink do +RSpec.describe WorkItems::ParentLink, feature_category: :portfolio_management do + let_it_be(:project) { create(:project) } + describe 'associations' do it { is_expected.to belong_to(:work_item) } it { is_expected.to belong_to(:work_item_parent).class_name('WorkItem') } @@ -16,7 +18,6 @@ RSpec.describe WorkItems::ParentLink do it { is_expected.to validate_uniqueness_of(:work_item) } describe 'hierarchy' do - let_it_be(:project) { create(:project) } let_it_be(:issue) { build(:work_item, project: project) } let_it_be(:incident) { build(:work_item, :incident, project: project) } let_it_be(:task1) { build(:work_item, :task, project: project) } @@ -30,18 +31,62 @@ RSpec.describe WorkItems::ParentLink do expect(build(:parent_link, work_item: task1, work_item_parent: incident)).to be_valid end - it 'is not valid if child is not task' do - link = build(:parent_link, work_item: issue) + shared_examples_for 'checks valid types' do + it 'validates if child can be added to the parent' do + parent_type = WorkItems::Type.default_by_type(parent_type_sym) + child_type = WorkItems::Type.default_by_type(child_type_sym) + parent = build(:work_item, issue_type: parent_type_sym, work_item_type: parent_type, project: project) + child = build(:work_item, issue_type: child_type_sym, work_item_type: child_type, project: project) + link = build(:parent_link, work_item: child, work_item_parent: parent) - expect(link).not_to be_valid - expect(link.errors[:work_item]).to include('only Task can be assigned as a child in hierarchy.') + expect(link.valid?).to eq(is_valid) + end end - it 'is not valid if parent is task' do - link = build(:parent_link, work_item_parent: task1) + context 'when assigning to various parent types' do + using RSpec::Parameterized::TableSyntax - expect(link).not_to be_valid - expect(link.errors[:work_item_parent]).to include('only Issue and Incident can be parent of Task.') + where(:parent_type_sym, :child_type_sym, :is_valid) do + :issue | :task | true + :incident | :task | true + :task | :issue | false + :issue | :issue | false + :objective | :objective | true + :objective | :key_result | true + :key_result | :objective | false + :key_result | :key_result | false + :objective | :issue | false + :task | :objective | false + end + + with_them do + it_behaves_like 'checks valid types' + end + end + + context 'when hierarchy_db_restrictions is disabled' do + before do + stub_feature_flags(hierarchy_db_restrictions: false) + end + + using RSpec::Parameterized::TableSyntax + + where(:parent_type_sym, :child_type_sym, :is_valid) do + :issue | :task | true + :incident | :task | true + :task | :issue | false + :issue | :issue | false + :objective | :objective | false + :objective | :key_result | false + :key_result | :objective | false + :key_result | :key_result | false + :objective | :issue | false + :task | :objective | false + end + + with_them do + it_behaves_like 'checks valid types' + end end it 'is not valid if parent is in other project' do @@ -97,7 +142,6 @@ RSpec.describe WorkItems::ParentLink do end context 'with confidential work items' do - let_it_be(:project) { create(:project) } let_it_be(:confidential_child) { create(:work_item, :task, confidential: true, project: project) } let_it_be(:putlic_child) { create(:work_item, :task, project: project) } let_it_be(:confidential_parent) { create(:work_item, confidential: true, project: project) } diff --git a/spec/requests/api/graphql/mutations/work_items/create_spec.rb b/spec/requests/api/graphql/mutations/work_items/create_spec.rb index be3917316c3..090345ca038 100644 --- a/spec/requests/api/graphql/mutations/work_items/create_spec.rb +++ b/spec/requests/api/graphql/mutations/work_items/create_spec.rb @@ -123,7 +123,7 @@ RSpec.describe 'Create a work item' do post_graphql_mutation(mutation, current_user: current_user) expect(mutation_response['errors']) - .to contain_exactly(/cannot be added: only Issue and Incident can be parent of Task./) + .to contain_exactly(/cannot be added: is not allowed to add this type of parent/) expect(mutation_response['workItem']).to be_nil end end diff --git a/spec/requests/api/graphql/mutations/work_items/update_spec.rb b/spec/requests/api/graphql/mutations/work_items/update_spec.rb index 96736457f26..b5f5ca383f3 100644 --- a/spec/requests/api/graphql/mutations/work_items/update_spec.rb +++ b/spec/requests/api/graphql/mutations/work_items/update_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Update a work item' do +RSpec.describe 'Update a work item', feature_category: :project_management do include GraphqlHelpers let_it_be(:group) { create(:group) } @@ -339,7 +339,7 @@ RSpec.describe 'Update a work item' do let_it_be(:invalid_parent) { create(:work_item, :task, project: project) } context 'when parent work item type is invalid' do - let(:error) { "#{work_item.to_reference} cannot be added: only Issue and Incident can be parent of Task." } + let(:error) { "#{work_item.to_reference} cannot be added: is not allowed to add this type of parent" } let(:input) do { 'hierarchyWidget' => { 'parentId' => invalid_parent.to_global_id.to_s }, 'title' => 'new title' } end @@ -450,7 +450,7 @@ RSpec.describe 'Update a work item' do let(:input) { { 'hierarchyWidget' => { 'childrenIds' => children_ids } } } let(:error) do - "#{invalid_child.to_reference} cannot be added: only Task can be assigned as a child in hierarchy." + "#{invalid_child.to_reference} cannot be added: is not allowed to add this type of parent" end context 'when child work item type is invalid' do diff --git a/spec/requests/api/graphql/project/environments_spec.rb b/spec/requests/api/graphql/project/environments_spec.rb index a86edde2ef3..eb59c9a2931 100644 --- a/spec/requests/api/graphql/project/environments_spec.rb +++ b/spec/requests/api/graphql/project/environments_spec.rb @@ -184,4 +184,81 @@ RSpec.describe 'Project Environments query' do expect(multi).not_to exceed_query_limit(baseline) end end + + describe 'nested environments' do + let_it_be(:testing1) { create(:environment, name: 'testing/one', project: project) } + let_it_be(:testing2) { create(:environment, name: 'testing/two', project: project) } + + context 'with query' do + let(:query) do + %( + query { + project(fullPath: "#{project.full_path}") { + nestedEnvironments { + nodes { + name + size + environment { + name + path + } + } + } + } + } + ) + end + + it 'can fetch nested environments' do + subject + + nested_envs = graphql_data.dig('project', 'nestedEnvironments', 'nodes') + expect(nested_envs.count).to be(3) + expect(nested_envs.pluck('name')).to match_array(%w[production staging testing]) + expect(nested_envs.pluck('size')).to match_array([1, 1, 2]) + expect(nested_envs[0].dig('environment', 'name')).to eq(production.name) + end + + context 'when user is guest' do + let(:user) { create(:user).tap { |u| project.add_guest(u) } } + + it 'returns nothing' do + subject + + nested_envs = graphql_data.dig('project', 'nestedEnvironments', 'nodes') + + expect(nested_envs).to be_nil + end + end + end + + context 'when using pagination' do + let(:query) do + %( + query { + project(fullPath: "#{project.full_path}") { + nestedEnvironments(first: 1) { + nodes { + name + } + pageInfo { + hasPreviousPage + startCursor + endCursor + hasNextPage + } + } + } + } + ) + end + + it 'supports pagination' do + subject + nested_envs = graphql_data.dig('project', 'nestedEnvironments') + expect(nested_envs['nodes'].count).to eq(1) + expect(nested_envs.dig('pageInfo', 'hasNextPage')).to be_truthy + end + end + end end diff --git a/spec/serializers/ci/group_variable_entity_spec.rb b/spec/serializers/ci/group_variable_entity_spec.rb index 9b64e263992..42c4e940421 100644 --- a/spec/serializers/ci/group_variable_entity_spec.rb +++ b/spec/serializers/ci/group_variable_entity_spec.rb @@ -3,14 +3,16 @@ require 'spec_helper' RSpec.describe Ci::GroupVariableEntity do - let(:variable) { create(:ci_group_variable) } + let(:variable) { build(:ci_group_variable) } let(:entity) { described_class.new(variable) } describe '#as_json' do subject { entity.as_json } it 'contains required fields' do - expect(subject).to include(:id, :key, :value, :protected, :variable_type, :environment_scope) + expect(subject.keys).to contain_exactly( + :id, :key, :value, :protected, :variable_type, :environment_scope, :raw, :masked + ) end end end diff --git a/spec/serializers/ci/variable_entity_spec.rb b/spec/serializers/ci/variable_entity_spec.rb index 38da0b16bbd..96111604028 100644 --- a/spec/serializers/ci/variable_entity_spec.rb +++ b/spec/serializers/ci/variable_entity_spec.rb @@ -3,14 +3,16 @@ require 'spec_helper' RSpec.describe Ci::VariableEntity do - let(:variable) { create(:ci_variable) } + let(:variable) { build(:ci_variable) } let(:entity) { described_class.new(variable) } describe '#as_json' do subject { entity.as_json } it 'contains required fields' do - expect(subject).to include(:id, :key, :value, :protected, :environment_scope, :variable_type) + expect(subject.keys).to contain_exactly( + :id, :key, :value, :protected, :environment_scope, :variable_type, :raw, :masked + ) end end end diff --git a/spec/services/ci/append_build_trace_service_spec.rb b/spec/services/ci/append_build_trace_service_spec.rb index 36061bc3596..20f7967d1f1 100644 --- a/spec/services/ci/append_build_trace_service_spec.rb +++ b/spec/services/ci/append_build_trace_service_spec.rb @@ -79,17 +79,33 @@ RSpec.describe Ci::AppendBuildTraceService do context 'when debug_trace param is provided' do let(:metadata) { Ci::BuildMetadata.find_by(build_id: build) } + let(:stream_size) { 192.kilobytes } + let(:body_data) { 'x' * stream_size } + let(:content_range) { "#{body_start}-#{stream_size}" } - it 'changes the build metadata debug_trace value' do - stream_size = 192.kilobytes - body_data = 'x' * stream_size - content_range = "0-#{stream_size}" + context 'when sending the first trace' do + let(:body_start) { 0 } + + it 'updates build metadata debug_trace_enabled' do + described_class + .new(build, content_range: content_range, debug_trace: true) + .execute(body_data) + + expect(metadata.debug_trace_enabled).to be(true) + end + end + + context 'when sending the second trace' do + let(:body_start) { 1 } - described_class - .new(build, content_range: content_range, debug_trace: true) - .execute(body_data) + it 'does not update build metadata debug_trace_enabled', :aggregate_failures do + query_recorder = ActiveRecord::QueryRecorder.new do + described_class.new(build, content_range: content_range, debug_trace: true).execute(body_data) + end - expect(metadata.debug_trace_enabled).to be(true) + expect(metadata.debug_trace_enabled).to be(false) + expect(query_recorder.log).not_to include(/p_ci_builds_metadata/) + end end end end diff --git a/spec/services/work_items/create_and_link_service_spec.rb b/spec/services/work_items/create_and_link_service_spec.rb index e259a22d388..00372d460e1 100644 --- a/spec/services/work_items/create_and_link_service_spec.rb +++ b/spec/services/work_items/create_and_link_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WorkItems::CreateAndLinkService do +RSpec.describe WorkItems::CreateAndLinkService, feature_category: :portfolio_management do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } let_it_be(:user) { create(:user) } @@ -94,7 +94,7 @@ RSpec.describe WorkItems::CreateAndLinkService do end it 'returns a link creation error message' do - expect(service_result.errors).to contain_exactly(/only Issue and Incident can be parent of Task./) + expect(service_result.errors).to contain_exactly(/is not allowed to add this type of parent/) end end end diff --git a/spec/services/work_items/create_service_spec.rb b/spec/services/work_items/create_service_spec.rb index 1bd7e15db67..a952486ee64 100644 --- a/spec/services/work_items/create_service_spec.rb +++ b/spec/services/work_items/create_service_spec.rb @@ -159,7 +159,7 @@ RSpec.describe WorkItems::CreateService do { title: 'Awesome work_item', description: 'please fix', - work_item_type: create(:work_item_type, :task) + work_item_type: WorkItems::Type.default_by_type(:task) } end @@ -176,7 +176,7 @@ RSpec.describe WorkItems::CreateService do let_it_be(:parent) { create(:work_item, :task, project: project) } it_behaves_like 'fails creating work item and returns errors' do - let(:error_message) { 'only Issue and Incident can be parent of Task.' } + let(:error_message) { 'is not allowed to add this type of parent' } end end end diff --git a/spec/services/work_items/parent_links/create_service_spec.rb b/spec/services/work_items/parent_links/create_service_spec.rb index 0ba41373544..2f2e830845a 100644 --- a/spec/services/work_items/parent_links/create_service_spec.rb +++ b/spec/services/work_items/parent_links/create_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WorkItems::ParentLinks::CreateService do +RSpec.describe WorkItems::ParentLinks::CreateService, feature_category: :portfolio_management do describe '#execute' do let_it_be(:user) { create(:user) } let_it_be(:guest) { create(:user) } @@ -117,7 +117,7 @@ RSpec.describe WorkItems::ParentLinks::CreateService do end it 'returns error status' do - error = "#{issue.to_reference} cannot be added: only Task can be assigned as a child in hierarchy.. " \ + error = "#{issue.to_reference} cannot be added: is not allowed to add this type of parent. " \ "#{other_project_task.to_reference} cannot be added: parent must be in the same project as child." is_expected.to eq(service_error(error, http_status: 422)) @@ -139,7 +139,7 @@ RSpec.describe WorkItems::ParentLinks::CreateService do let(:params) { { target_issuable: task1 } } it 'returns error status' do - error = "#{task1.to_reference} cannot be added: only Issue and Incident can be parent of Task." + error = "#{task1.to_reference} cannot be added: is not allowed to add this type of parent" is_expected.to eq(service_error(error, http_status: 422)) end diff --git a/spec/services/work_items/update_service_spec.rb b/spec/services/work_items/update_service_spec.rb index 68efb4c220b..87665bcad2c 100644 --- a/spec/services/work_items/update_service_spec.rb +++ b/spec/services/work_items/update_service_spec.rb @@ -284,7 +284,7 @@ RSpec.describe WorkItems::UpdateService do it 'returns error status' do expect(subject[:status]).to be(:error) expect(subject[:message]) - .to match("#{child_work_item.to_reference} cannot be added: only Task can be assigned as a child in hierarchy.") + .to match("#{child_work_item.to_reference} cannot be added: is not allowed to add this type of parent") end it 'does not update work item attributes' do diff --git a/spec/services/work_items/widgets/hierarchy_service/update_service_spec.rb b/spec/services/work_items/widgets/hierarchy_service/update_service_spec.rb index 1b8c4c5f15f..5a5bb8a1674 100644 --- a/spec/services/work_items/widgets/hierarchy_service/update_service_spec.rb +++ b/spec/services/work_items/widgets/hierarchy_service/update_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe WorkItems::Widgets::HierarchyService::UpdateService do +RSpec.describe WorkItems::Widgets::HierarchyService::UpdateService, feature_category: :portfolio_management do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project) } @@ -81,7 +81,7 @@ RSpec.describe WorkItems::Widgets::HierarchyService::UpdateService do it_behaves_like 'raises a WidgetError' do let(:message) do - "#{child_issue.to_reference} cannot be added: only Task can be assigned as a child in hierarchy." + "#{child_issue.to_reference} cannot be added: is not allowed to add this type of parent" end end end @@ -136,7 +136,7 @@ RSpec.describe WorkItems::Widgets::HierarchyService::UpdateService do it_behaves_like 'raises a WidgetError' do let(:message) do - "#{work_item.to_reference} cannot be added: only Issue and Incident can be parent of Task." + "#{work_item.to_reference} cannot be added: is not allowed to add this type of parent" end end end diff --git a/spec/support/db_cleaner.rb b/spec/support/db_cleaner.rb index 6c5de61c6de..588fe466a42 100644 --- a/spec/support/db_cleaner.rb +++ b/spec/support/db_cleaner.rb @@ -12,7 +12,7 @@ module DbCleaner end def deletion_except_tables - ['work_item_types'] + %w[work_item_types work_item_hierarchy_restrictions] end def setup_database_cleaner diff --git a/spec/support/helpers/migrations_helpers/work_item_types_helper.rb b/spec/support/helpers/migrations_helpers/work_item_types_helper.rb index b05caf265ee..40f84486537 100644 --- a/spec/support/helpers/migrations_helpers/work_item_types_helper.rb +++ b/spec/support/helpers/migrations_helpers/work_item_types_helper.rb @@ -2,26 +2,9 @@ module MigrationHelpers module WorkItemTypesHelper - DEFAULT_WORK_ITEM_TYPES = { - issue: { name: 'Issue', icon_name: 'issue-type-issue', enum_value: 0 }, - incident: { name: 'Incident', icon_name: 'issue-type-incident', enum_value: 1 }, - test_case: { name: 'Test Case', icon_name: 'issue-type-test-case', enum_value: 2 }, - requirement: { name: 'Requirement', icon_name: 'issue-type-requirements', enum_value: 3 }, - task: { name: 'Task', icon_name: 'issue-type-task', enum_value: 4 } - }.freeze - def reset_work_item_types - work_item_types_table.delete_all - - DEFAULT_WORK_ITEM_TYPES.each do |type, attributes| - work_item_types_table.create!(base_type: attributes[:enum_value], **attributes.slice(:name, :icon_name)) - end - end - - private - - def work_item_types_table - table(:work_item_types) + Gitlab::DatabaseImporters::WorkItems::BaseTypeImporter.upsert_types + Gitlab::DatabaseImporters::WorkItems::HierarchyRestrictionsImporter.upsert_restrictions end end end diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index eceb29e0667..4f85eef31fa 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -376,6 +376,7 @@ module TestEnv def seed_db Gitlab::DatabaseImporters::WorkItems::BaseTypeImporter.upsert_types + Gitlab::DatabaseImporters::WorkItems::HierarchyRestrictionsImporter.upsert_restrictions end private diff --git a/spec/support/shared_examples/controllers/destroy_hook_shared_examples.rb b/spec/support/shared_examples/controllers/destroy_hook_shared_examples.rb index 710aa333dec..420973b6882 100644 --- a/spec/support/shared_examples/controllers/destroy_hook_shared_examples.rb +++ b/spec/support/shared_examples/controllers/destroy_hook_shared_examples.rb @@ -9,7 +9,7 @@ RSpec.shared_examples 'Web hook destroyer' do delete :destroy, params: params expect(response).to have_gitlab_http_status(:found) - expect(flash[:notice]).to eq("#{hook.model_name.human} was deleted") + expect(flash[:notice]).to eq('Webhook was deleted') end it 'displays a message about async delete', :aggregate_failures do @@ -20,7 +20,7 @@ RSpec.shared_examples 'Web hook destroyer' do delete :destroy, params: params expect(response).to have_gitlab_http_status(:found) - expect(flash[:notice]).to eq("#{hook.model_name.human} was scheduled for deletion") + expect(flash[:notice]).to eq('Webhook was scheduled for deletion') end it 'displays an error if deletion failed', :aggregate_failures do diff --git a/spec/support/shared_examples/controllers/variables_shared_examples.rb b/spec/support/shared_examples/controllers/variables_shared_examples.rb index 34632993cf0..d979683cce7 100644 --- a/spec/support/shared_examples/controllers/variables_shared_examples.rb +++ b/spec/support/shared_examples/controllers/variables_shared_examples.rb @@ -19,13 +19,15 @@ RSpec.shared_examples 'PATCH #update updates variables' do { id: variable.id, key: variable.key, secret_value: variable.value, - protected: variable.protected?.to_s } + protected: variable.protected?.to_s, + raw: (!variable.raw?).to_s } end let(:new_variable_attributes) do { key: 'new_key', secret_value: 'dummy_value', - protected: 'false' } + protected: 'false', + raw: 'true' } end let(:variables_scope) { owner.variables } @@ -86,7 +88,13 @@ RSpec.shared_examples 'PATCH #update updates variables' do end it 'updates the existing variable' do - expect { subject }.to change { variable.reload.value }.to('other_value') + old_raw = variable.raw + + subject + + variable.reload + expect(variable.value).to eq('other_value') + expect(variable.raw?).not_to be(old_raw) end it 'creates the new variable' do diff --git a/spec/support/shared_examples/work_item_hierarchy_restrictions_importer.rb b/spec/support/shared_examples/work_item_hierarchy_restrictions_importer.rb index a1bccb7b7a3..b75aa27b2b7 100644 --- a/spec/support/shared_examples/work_item_hierarchy_restrictions_importer.rb +++ b/spec/support/shared_examples/work_item_hierarchy_restrictions_importer.rb @@ -7,7 +7,13 @@ RSpec.shared_examples 'work item hierarchy restrictions importer' do end end - it_behaves_like 'adds restrictions' + context 'when restrictions are missing' do + before do + WorkItems::HierarchyRestriction.delete_all + end + + it_behaves_like 'adds restrictions' + end context 'when base types are missing' do before do |