Skip JS "pages" folder when detecting feature tests
Context
This MR, in addition to !113495 (merged), would fix this ~"master-broken::test-selection-gap".
Here's how tooling/lib/tooling/mappings/js_to_system_specs_mappings.rb
currently works to add feature specs to run in predictive pipelines (all done in the detect-tests
CI job):
- It picks the first folder of the changed files under
app/assets/javascripts/
. For instance,app/assets/javascripts/admin/broadcast_messages/edit.js
->admin
- It uses this
admin
keyword to select any feature spec with the keywordadmin
in it.
The problem
We have a lot of code under the pages folder: app/assets/javascripts/pages
, and we don't have a lot of feature specs with pages
in it. instead, we should use the folder right after the pages
folder to detect more meaningful feature specs (I was inspired by this conversation).
What does this MR do?
We now pick the second folder if the changed file is under app/assets/javascripts/pages
.
A note on performance
This change, and generally all of the recent changes in detect-tests, are decreasing selective pipelines speed in favor of accuracy (i.e. it's better to have something working that's slower, rather than a system that is fast, but creates broken master incidents).
It might be necessary, once the master-brokentest-selection-gap are occurring less and less often, to focus on speeding things up.
For example, we could detect less feature specs based on additional filtering (e.g. rely on folders down the folder hierarchy, or the filename).
How to set up and validate locally
Before
Input
{
rm -rf related-specs.out && touch related-specs.out
cat > changed_files.in <<FILE
app/assets/javascripts/pages/projects/index.js
FILE
./tooling/bin/js_to_system_specs_mappings changed_files.in related-specs.out && cat related-specs.out
}
Output
All feature specs containing the word pages
will be selected (20 files):
Click to expand
spec/features/clusters/cluster_detail_page_spec.rb
spec/features/error_pages_spec.rb
spec/features/groups/group_page_with_external_authorization_service_spec.rb
spec/features/groups/new_group_page_spec.rb
spec/features/groups/user_browse_projects_group_page_spec.rb
spec/features/help_pages_spec.rb
spec/features/merge_request/user_sees_page_metadata_spec.rb
spec/features/profiles/user_visits_profile_account_page_spec.rb
spec/features/profiles/user_visits_profile_preferences_page_spec.rb
spec/features/profiles/user_visits_profile_ssh_keys_page_spec.rb
spec/features/projects/artifacts/user_views_project_artifacts_page_spec.rb
spec/features/projects/classification_label_on_project_pages_spec.rb
spec/features/projects/confluence/user_views_confluence_page_spec.rb
spec/features/projects/pages/user_adds_domain_spec.rb
spec/features/projects/pages/user_configures_pages_pipeline_spec.rb
spec/features/projects/pages/user_edits_lets_encrypt_settings_spec.rb
spec/features/projects/pages/user_edits_settings_spec.rb
spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb
spec/features/search/user_searches_for_wiki_pages_spec.rb
spec/features/users/user_browses_projects_on_user_page_spec.rb
After
Input
{
rm -rf related-specs.out && touch related-specs.out
cat > changed_files.in <<FILE
app/assets/javascripts/pages/projects/index.js
FILE
./tooling/bin/js_to_system_specs_mappings changed_files.in related-specs.out && cat related-specs.out
}
Output
All feature specs containing the word project
will be selected (290 files):
Click to expand
spec/features/admin/admin_projects_spec.rb
spec/features/admin/admin_sees_project_statistics_spec.rb
spec/features/admin/admin_sees_projects_statistics_spec.rb
spec/features/dashboard/archived_projects_spec.rb
spec/features/dashboard/project_member_activity_index_spec.rb
spec/features/dashboard/projects_spec.rb
spec/features/dashboard/user_filters_projects_spec.rb
spec/features/explore/user_explores_projects_spec.rb
spec/features/file_uploads/project_import_spec.rb
spec/features/frequently_visited_projects_and_groups_spec.rb
spec/features/groups/user_browse_projects_group_page_spec.rb
spec/features/ics/project_issues_spec.rb
spec/features/merge_request/user_sees_mr_from_deleted_forked_project_spec.rb
spec/features/merge_request/user_sees_notes_from_forked_project_spec.rb
spec/features/merge_request/user_sees_pipelines_from_forked_project_spec.rb
spec/features/merge_request/user_tries_to_access_private_project_info_through_new_mr_spec.rb
spec/features/project_group_variables_spec.rb
spec/features/project_variables_spec.rb
spec/features/projects_spec.rb
spec/features/projects/active_tabs_spec.rb
spec/features/projects/activity/rss_spec.rb
spec/features/projects/activity/user_sees_activity_spec.rb
spec/features/projects/activity/user_sees_design_activity_spec.rb
spec/features/projects/activity/user_sees_design_comment_spec.rb
spec/features/projects/activity/user_sees_private_activity_spec.rb
spec/features/projects/artifacts/file_spec.rb
spec/features/projects/artifacts/raw_spec.rb
spec/features/projects/artifacts/user_browses_artifacts_spec.rb
spec/features/projects/artifacts/user_downloads_artifacts_spec.rb
spec/features/projects/artifacts/user_views_project_artifacts_page_spec.rb
spec/features/projects/badges/coverage_spec.rb
spec/features/projects/badges/list_spec.rb
spec/features/projects/badges/pipeline_badge_spec.rb
spec/features/projects/blobs/blame_spec.rb
spec/features/projects/blobs/blob_line_permalink_updater_spec.rb
spec/features/projects/blobs/blob_show_spec.rb
spec/features/projects/blobs/edit_spec.rb
spec/features/projects/blobs/shortcuts_blob_spec.rb
spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb
spec/features/projects/blobs/user_views_pipeline_editor_button_spec.rb
spec/features/projects/branches_spec.rb
spec/features/projects/branches/download_buttons_spec.rb
spec/features/projects/branches/new_branch_ref_dropdown_spec.rb
spec/features/projects/branches/user_creates_branch_spec.rb
spec/features/projects/branches/user_deletes_branch_spec.rb
spec/features/projects/branches/user_views_branches_spec.rb
spec/features/projects/ci/editor_spec.rb
spec/features/projects/ci/lint_spec.rb
spec/features/projects/classification_label_on_project_pages_spec.rb
spec/features/projects/cluster_agents_spec.rb
spec/features/projects/clusters_spec.rb
spec/features/projects/clusters/gcp_spec.rb
spec/features/projects/clusters/user_spec.rb
spec/features/projects/commit/builds_spec.rb
spec/features/projects/commit/cherry_pick_spec.rb
spec/features/projects/commit/comments/user_adds_comment_spec.rb
spec/features/projects/commit/comments/user_deletes_comments_spec.rb
spec/features/projects/commit/comments/user_edits_comments_spec.rb
spec/features/projects/commit/diff_notes_spec.rb
spec/features/projects/commit/mini_pipeline_graph_spec.rb
spec/features/projects/commit/user_comments_on_commit_spec.rb
spec/features/projects/commit/user_reverts_commit_spec.rb
spec/features/projects/commit/user_views_user_status_on_commit_spec.rb
spec/features/projects/commits/multi_view_diff_spec.rb
spec/features/projects/commits/rss_spec.rb
spec/features/projects/commits/user_browses_commits_spec.rb
spec/features/projects/compare_spec.rb
spec/features/projects/confluence/user_views_confluence_page_spec.rb
spec/features/projects/container_registry_spec.rb
spec/features/projects/deploy_keys_spec.rb
spec/features/projects/diffs/diff_show_spec.rb
spec/features/projects/environments/environment_metrics_spec.rb
spec/features/projects/environments/environment_spec.rb
spec/features/projects/environments/environments_spec.rb
spec/features/projects/feature_flag_user_lists/user_deletes_feature_flag_user_list_spec.rb
spec/features/projects/feature_flag_user_lists/user_edits_feature_flag_user_list_spec.rb
spec/features/projects/feature_flag_user_lists/user_sees_feature_flag_user_list_details_spec.rb
spec/features/projects/feature_flags/user_creates_feature_flag_spec.rb
spec/features/projects/feature_flags/user_deletes_feature_flag_spec.rb
spec/features/projects/feature_flags/user_sees_feature_flag_list_spec.rb
spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb
spec/features/projects/features_visibility_spec.rb
spec/features/projects/files/dockerfile_dropdown_spec.rb
spec/features/projects/files/download_buttons_spec.rb
spec/features/projects/files/edit_file_soft_wrap_spec.rb
spec/features/projects/files/editing_a_file_spec.rb
spec/features/projects/files/files_sort_submodules_with_folders_spec.rb
spec/features/projects/files/find_file_keyboard_spec.rb
spec/features/projects/files/gitignore_dropdown_spec.rb
spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb
spec/features/projects/files/project_owner_creates_license_file_spec.rb
spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb
spec/features/projects/files/template_selector_menu_spec.rb
spec/features/projects/files/undo_template_spec.rb
spec/features/projects/files/user_browses_a_tree_with_a_folder_containing_only_a_folder_spec.rb
spec/features/projects/files/user_browses_files_spec.rb
spec/features/projects/files/user_browses_lfs_files_spec.rb
spec/features/projects/files/user_creates_directory_spec.rb
spec/features/projects/files/user_creates_files_spec.rb
spec/features/projects/files/user_deletes_files_spec.rb
spec/features/projects/files/user_edits_files_spec.rb
spec/features/projects/files/user_find_file_spec.rb
spec/features/projects/files/user_reads_pipeline_status_spec.rb
spec/features/projects/files/user_replaces_files_spec.rb
spec/features/projects/files/user_searches_for_files_spec.rb
spec/features/projects/files/user_uploads_files_spec.rb
spec/features/projects/fork_spec.rb
spec/features/projects/forks/fork_list_spec.rb
spec/features/projects/gfm_autocomplete_load_spec.rb
spec/features/projects/graph_spec.rb
spec/features/projects/hook_logs/user_reads_log_spec.rb
spec/features/projects/import_export/export_file_spec.rb
spec/features/projects/import_export/import_file_spec.rb
spec/features/projects/import_export/test_project_export.tar.gz
spec/features/projects/infrastructure_registry_spec.rb
spec/features/projects/integrations/apple_app_store_spec.rb
spec/features/projects/integrations/disable_triggers_spec.rb
spec/features/projects/integrations/google_play_spec.rb
spec/features/projects/integrations/project_integrations_spec.rb
spec/features/projects/integrations/user_activates_asana_spec.rb
spec/features/projects/integrations/user_activates_assembla_spec.rb
spec/features/projects/integrations/user_activates_atlassian_bamboo_ci_spec.rb
spec/features/projects/integrations/user_activates_emails_on_push_spec.rb
spec/features/projects/integrations/user_activates_irker_spec.rb
spec/features/projects/integrations/user_activates_issue_tracker_spec.rb
spec/features/projects/integrations/user_activates_jetbrains_teamcity_ci_spec.rb
spec/features/projects/integrations/user_activates_jira_spec.rb
spec/features/projects/integrations/user_activates_mattermost_slash_command_spec.rb
spec/features/projects/integrations/user_activates_packagist_spec.rb
spec/features/projects/integrations/user_activates_pivotaltracker_spec.rb
spec/features/projects/integrations/user_activates_prometheus_spec.rb
spec/features/projects/integrations/user_activates_pushover_spec.rb
spec/features/projects/integrations/user_activates_slack_notifications_spec.rb
spec/features/projects/integrations/user_activates_slack_slash_command_spec.rb
spec/features/projects/integrations/user_uses_inherited_settings_spec.rb
spec/features/projects/integrations/user_views_services_spec.rb
spec/features/projects/issuable_templates_spec.rb
spec/features/projects/issues/design_management/user_links_to_designs_in_issue_spec.rb
spec/features/projects/issues/design_management/user_paginates_designs_spec.rb
spec/features/projects/issues/design_management/user_permissions_upload_spec.rb
spec/features/projects/issues/design_management/user_uploads_designs_spec.rb
spec/features/projects/issues/design_management/user_views_design_images_spec.rb
spec/features/projects/issues/design_management/user_views_design_spec.rb
spec/features/projects/issues/design_management/user_views_designs_spec.rb
spec/features/projects/issues/design_management/user_views_designs_with_svg_xss_spec.rb
spec/features/projects/issues/email_participants_spec.rb
spec/features/projects/issues/viewing_issues_with_external_authorization_enabled_spec.rb
spec/features/projects/issues/viewing_relocated_issues_spec.rb
spec/features/projects/jobs_spec.rb
spec/features/projects/jobs/permissions_spec.rb
spec/features/projects/jobs/user_browses_job_spec.rb
spec/features/projects/jobs/user_browses_jobs_spec.rb
spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb
spec/features/projects/labels/issues_sorted_by_priority_spec.rb
spec/features/projects/labels/search_labels_spec.rb
spec/features/projects/labels/sort_labels_spec.rb
spec/features/projects/labels/subscription_spec.rb
spec/features/projects/labels/update_prioritization_spec.rb
spec/features/projects/labels/user_creates_labels_spec.rb
spec/features/projects/labels/user_edits_labels_spec.rb
spec/features/projects/labels/user_promotes_label_spec.rb
spec/features/projects/labels/user_removes_labels_spec.rb
spec/features/projects/labels/user_sees_breadcrumb_links_spec.rb
spec/features/projects/labels/user_sees_links_to_issuables_spec.rb
spec/features/projects/labels/user_views_labels_spec.rb
spec/features/projects/members/anonymous_user_sees_members_spec.rb
spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb
spec/features/projects/members/group_member_cannot_request_access_to_his_group_project_spec.rb
spec/features/projects/members/group_members_spec.rb
spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb
spec/features/projects/members/groups_with_access_list_spec.rb
spec/features/projects/members/manage_groups_spec.rb
spec/features/projects/members/manage_members_spec.rb
spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
spec/features/projects/members/master_manages_access_requests_spec.rb
spec/features/projects/members/member_cannot_request_access_to_his_project_spec.rb
spec/features/projects/members/member_leaves_project_spec.rb
spec/features/projects/members/owner_cannot_leave_project_spec.rb
spec/features/projects/members/owner_cannot_request_access_to_his_project_spec.rb
spec/features/projects/members/sorting_spec.rb
spec/features/projects/members/tabs_spec.rb
spec/features/projects/members/user_requests_access_spec.rb
spec/features/projects/merge_request_button_spec.rb
spec/features/projects/milestones/gfm_autocomplete_spec.rb
spec/features/projects/milestones/milestone_spec.rb
spec/features/projects/milestones/milestones_sorting_spec.rb
spec/features/projects/milestones/new_spec.rb
spec/features/projects/milestones/user_interacts_with_labels_spec.rb
spec/features/projects/navbar_spec.rb
spec/features/projects/network_graph_spec.rb
spec/features/projects/new_project_from_template_spec.rb
spec/features/projects/new_project_spec.rb
spec/features/projects/package_files_spec.rb
spec/features/projects/packages_spec.rb
spec/features/projects/pages/user_adds_domain_spec.rb
spec/features/projects/pages/user_configures_pages_pipeline_spec.rb
spec/features/projects/pages/user_edits_lets_encrypt_settings_spec.rb
spec/features/projects/pages/user_edits_settings_spec.rb
spec/features/projects/pipeline_schedules_spec.rb
spec/features/projects/pipelines/pipeline_spec.rb
spec/features/projects/pipelines/pipelines_spec.rb
spec/features/projects/raw/user_interacts_with_raw_endpoint_spec.rb
spec/features/projects/releases/user_creates_release_spec.rb
spec/features/projects/releases/user_views_edit_release_spec.rb
spec/features/projects/releases/user_views_release_spec.rb
spec/features/projects/releases/user_views_releases_spec.rb
spec/features/projects/remote_mirror_spec.rb
spec/features/projects/settings/access_tokens_spec.rb
spec/features/projects/settings/branch_names_settings_spec.rb
spec/features/projects/settings/branch_rules_settings_spec.rb
spec/features/projects/settings/external_authorization_service_settings_spec.rb
spec/features/projects/settings/forked_project_settings_spec.rb
spec/features/projects/settings/lfs_settings_spec.rb
spec/features/projects/settings/merge_requests_settings_spec.rb
spec/features/projects/settings/monitor_settings_spec.rb
spec/features/projects/settings/packages_settings_spec.rb
spec/features/projects/settings/pipelines_settings_spec.rb
spec/features/projects/settings/project_badges_spec.rb
spec/features/projects/settings/project_settings_spec.rb
spec/features/projects/settings/registry_settings_cleanup_tags_spec.rb
spec/features/projects/settings/registry_settings_spec.rb
spec/features/projects/settings/repository_settings_spec.rb
spec/features/projects/settings/secure_files_spec.rb
spec/features/projects/settings/service_desk_setting_spec.rb
spec/features/projects/settings/user_archives_project_spec.rb
spec/features/projects/settings/user_changes_avatar_spec.rb
spec/features/projects/settings/user_changes_default_branch_spec.rb
spec/features/projects/settings/user_interacts_with_deploy_keys_spec.rb
spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
spec/features/projects/settings/user_manages_project_members_spec.rb
spec/features/projects/settings/user_renames_a_project_spec.rb
spec/features/projects/settings/user_searches_in_settings_spec.rb
spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb
spec/features/projects/settings/user_tags_project_spec.rb
spec/features/projects/settings/user_transfers_a_project_spec.rb
spec/features/projects/settings/visibility_settings_spec.rb
spec/features/projects/settings/webhooks_settings_spec.rb
spec/features/projects/show/clone_button_spec.rb
spec/features/projects/show/download_buttons_spec.rb
spec/features/projects/show/no_password_spec.rb
spec/features/projects/show/redirects_spec.rb
spec/features/projects/show/rss_spec.rb
spec/features/projects/show/schema_markup_spec.rb
spec/features/projects/show/user_interacts_with_auto_devops_banner_spec.rb
spec/features/projects/show/user_interacts_with_stars_spec.rb
spec/features/projects/show/user_manages_notifications_spec.rb
spec/features/projects/show/user_sees_collaboration_links_spec.rb
spec/features/projects/show/user_sees_deletion_failure_message_spec.rb
spec/features/projects/show/user_sees_git_instructions_spec.rb
spec/features/projects/show/user_sees_last_commit_ci_status_spec.rb
spec/features/projects/show/user_sees_readme_spec.rb
spec/features/projects/show/user_sees_setup_shortcut_buttons_spec.rb
spec/features/projects/show/user_uploads_files_spec.rb
spec/features/projects/snippets/create_snippet_spec.rb
spec/features/projects/snippets/show_spec.rb
spec/features/projects/snippets/user_comments_on_snippet_spec.rb
spec/features/projects/snippets/user_deletes_snippet_spec.rb
spec/features/projects/snippets/user_updates_snippet_spec.rb
spec/features/projects/snippets/user_views_snippets_spec.rb
spec/features/projects/sourcegraph_csp_spec.rb
spec/features/projects/sub_group_issuables_spec.rb
spec/features/projects/tags/download_buttons_spec.rb
spec/features/projects/tags/user_edits_tags_spec.rb
spec/features/projects/tags/user_views_tag_spec.rb
spec/features/projects/tags/user_views_tags_spec.rb
spec/features/projects/terraform_spec.rb
spec/features/projects/tree/create_directory_spec.rb
spec/features/projects/tree/create_file_spec.rb
spec/features/projects/tree/rss_spec.rb
spec/features/projects/tree/tree_show_spec.rb
spec/features/projects/tree/upload_file_spec.rb
spec/features/projects/user_changes_project_visibility_spec.rb
spec/features/projects/user_creates_project_spec.rb
spec/features/projects/user_sees_sidebar_spec.rb
spec/features/projects/user_sees_user_popover_spec.rb
spec/features/projects/user_sorts_projects_spec.rb
spec/features/projects/user_uses_shortcuts_spec.rb
spec/features/projects/user_views_empty_project_spec.rb
spec/features/projects/view_on_env_spec.rb
spec/features/projects/wiki/user_views_wiki_empty_spec.rb
spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb
spec/features/projects/wikis_spec.rb
spec/features/search/user_searches_for_projects_spec.rb
spec/features/security/project/internal_access_spec.rb
spec/features/security/project/private_access_spec.rb
spec/features/security/project/public_access_spec.rb
spec/features/security/project/snippet/internal_access_spec.rb
spec/features/security/project/snippet/private_access_spec.rb
spec/features/security/project/snippet/public_access_spec.rb
spec/features/users/user_browses_projects_on_user_page_spec.rb
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #393364 (closed)