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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-05 12:12:23 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-05 12:12:23 +0300
commite0c90aab261896abcf93f3806d965790dbd03408 (patch)
tree72524feb8405807c5122cf788976fa6fd09fae3f
parent7e254c1556243adc62436a0b929fbeff7e8daf52 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue13
-rw-r--r--app/views/layouts/nav/_breadcrumbs.html.haml2
-rw-r--r--config/feature_flags/development/linear_group_plans_preloaded_ancestor_scopes.yml (renamed from config/feature_flags/development/track_epic_boards_activity.yml)12
-rw-r--r--doc/administration/feature_flags.md7
-rw-r--r--doc/raketasks/backup_restore.md8
-rw-r--r--doc/user/application_security/sast/index.md4
-rw-r--r--lib/api/helm_packages.rb7
-rw-r--r--lib/gitlab/regex.rb2
-rw-r--r--lib/gitlab/usage/metric_definition.rb7
-rw-r--r--lib/gitlab/usage_data_counters/known_events/epic_board_events.yml3
-rw-r--r--qa/Gemfile2
-rw-r--r--qa/Gemfile.lock10
-rw-r--r--qa/qa/page/component/snippet.rb11
-rw-r--r--qa/qa/resource/project_snippet.rb2
-rw-r--r--qa/qa/resource/snippet.rb6
-rw-r--r--qa/qa/runtime/allure_report.rb32
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb20
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb24
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb16
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb16
-rw-r--r--qa/spec/specs/allure_report_spec.rb6
-rw-r--r--spec/lib/gitlab/regex_spec.rb12
-rw-r--r--spec/lib/gitlab/usage/metric_definition_spec.rb31
-rw-r--r--spec/lib/gitlab/usage_data_metrics_spec.rb2
-rw-r--r--spec/requests/api/helm_packages_spec.rb18
25 files changed, 191 insertions, 82 deletions
diff --git a/app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue b/app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue
index 095d1854c8b..8aeff9257a5 100644
--- a/app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue
+++ b/app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue
@@ -1,6 +1,12 @@
<script>
import '~/commons/bootstrap';
-import { GlIcon, GlTooltip, GlTooltipDirective, GlButton } from '@gitlab/ui';
+import {
+ GlIcon,
+ GlTooltip,
+ GlTooltipDirective,
+ GlButton,
+ GlSafeHtmlDirective as SafeHtml,
+} from '@gitlab/ui';
import IssueDueDate from '~/boards/components/issue_due_date.vue';
import { sprintf } from '~/locale';
import relatedIssuableMixin from '../../mixins/related_issuable_mixin';
@@ -22,6 +28,7 @@ export default {
},
directives: {
GlTooltip: GlTooltipDirective,
+ SafeHtml,
},
mixins: [relatedIssuableMixin],
props: {
@@ -84,7 +91,7 @@ export default {
/>
</div>
<gl-tooltip :target="() => $refs.iconElementXL">
- <span v-html="stateTitle /* eslint-disable-line vue/no-v-html */"></span>
+ <span v-safe-html="stateTitle"></span>
</gl-tooltip>
<gl-icon
v-if="confidential"
@@ -110,7 +117,7 @@ export default {
class="item-path-area item-path-id d-flex align-items-center mr-2 mt-2 mt-xl-0 ml-xl-2"
>
<gl-tooltip :target="() => this.$refs.iconElement">
- <span v-html="stateTitle /* eslint-disable-line vue/no-v-html */"></span>
+ <span v-safe-html="stateTitle"></span>
</gl-tooltip>
<span v-gl-tooltip :title="itemPath" class="path-id-text d-inline-block">{{
itemPath
diff --git a/app/views/layouts/nav/_breadcrumbs.html.haml b/app/views/layouts/nav/_breadcrumbs.html.haml
index c111714f552..3678ec748f7 100644
--- a/app/views/layouts/nav/_breadcrumbs.html.haml
+++ b/app/views/layouts/nav/_breadcrumbs.html.haml
@@ -19,7 +19,7 @@
= render "layouts/nav/breadcrumbs/collapsed_dropdown", location: :after
- unless @skip_current_level_breadcrumb
%li
- %h2.breadcrumbs-sub-title
+ %h2.breadcrumbs-sub-title{ data: { qa_selector: 'breadcrumb_sub_title_content' } }
= link_to @breadcrumb_title, breadcrumb_title_link
%script{ type: 'application/ld+json' }
:plain
diff --git a/config/feature_flags/development/track_epic_boards_activity.yml b/config/feature_flags/development/linear_group_plans_preloaded_ancestor_scopes.yml
index df48cc5a854..d45b8d71a20 100644
--- a/config/feature_flags/development/track_epic_boards_activity.yml
+++ b/config/feature_flags/development/linear_group_plans_preloaded_ancestor_scopes.yml
@@ -1,8 +1,8 @@
---
-name: track_epic_boards_activity
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60357
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/338038
-milestone: '13.12'
+name: linear_group_plans_preloaded_ancestor_scopes
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70685
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/341349
+milestone: '14.4'
type: development
-group: group::product planning
-default_enabled: true
+group: group::access
+default_enabled: false
diff --git a/doc/administration/feature_flags.md b/doc/administration/feature_flags.md
index 575fa9eb229..f2067e7a2d1 100644
--- a/doc/administration/feature_flags.md
+++ b/doc/administration/feature_flags.md
@@ -1,8 +1,7 @@
---
-stage: none
-group: Development
-info: "See the Technical Writers assigned to Development Guidelines: https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments-to-development-guidelines"
-type: reference
+stage: Enablement
+group: Distribution
+info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
description: "GitLab administrator: enable and disable GitLab features deployed behind feature flags"
---
diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md
index 765a7de2cf8..be3893d68f0 100644
--- a/doc/raketasks/backup_restore.md
+++ b/doc/raketasks/backup_restore.md
@@ -61,7 +61,7 @@ including:
- Container Registry images
- GitLab Pages content
- Snippets
-- Group wikis **(PREMIUM)**
+- [Group wikis](../user/project/wiki/index.md#group-wikis)
Backups do not include:
@@ -1172,7 +1172,7 @@ For manually backing up the Git repository data on disk, there are multiple poss
Git repositories must be copied in a consistent way. They should not be copied during concurrent write
operations, as this can lead to inconsistencies or corruption issues. For more details,
-[issue 270422](https://gitlab.com/gitlab-org/gitlab/-/issues/270422 "Provide documentation on preferred method of migrating Gitaly servers")
+[issue #270422](https://gitlab.com/gitlab-org/gitlab/-/issues/270422 "Provide documentation on preferred method of migrating Gitaly servers")
has a longer discussion explaining the potential problems.
To prevent writes to the Git repository data, there are two possible approaches:
@@ -1517,7 +1517,7 @@ err.message="unknown error"
This issue is caused by the restore running as the unprivileged user `git`,
which is unable to assign the correct ownership to the registry files during
-the restore process ([issue 62759](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/62759 "Incorrect permissions on registry filesystem after restore")).
+the restore process ([issue #62759](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/62759 "Incorrect permissions on registry filesystem after restore")).
To get your registry working again:
@@ -1548,7 +1548,7 @@ If this happens, examine the following:
- If NFS is being used, check if the mount option `timeout` is set. The
default is `600`, and changing this to smaller values results in this error.
-### `gitaly-backup` for repository backup and restore **(FREE SELF)**
+### `gitaly-backup` for repository backup and restore
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/333034) in GitLab 14.2.
> - [Deployed behind a feature flag](../user/feature_flags.md), enabled by default.
diff --git a/doc/user/application_security/sast/index.md b/doc/user/application_security/sast/index.md
index d713ee0d5bc..abd00b3f555 100644
--- a/doc/user/application_security/sast/index.md
+++ b/doc/user/application_security/sast/index.md
@@ -540,10 +540,6 @@ all [custom variables](../../../ci/variables/index.md#custom-cicd-variables) are
to the underlying SAST analyzer images if
[the SAST vendored template](#configuration) is used.
-WARNING:
-Variables having names starting with these prefixes are **not** propagated to the SAST Docker container and/or
-analyzer containers: `DOCKER_`, `CI`, `GITLAB_`, `FF_`, `HOME`, `PWD`, `OLDPWD`, `PATH`, `SHLVL`, `HOSTNAME`.
-
### Experimental features
You can receive early access to experimental features. Experimental features might be added,
diff --git a/lib/api/helm_packages.rb b/lib/api/helm_packages.rb
index 8a7e84c9f87..4278d17e003 100644
--- a/lib/api/helm_packages.rb
+++ b/lib/api/helm_packages.rb
@@ -11,7 +11,8 @@ module API
feature_category :package_registry
PACKAGE_FILENAME = 'package.tgz'
- FILE_NAME_REQUIREMENTS = {
+ HELM_REQUIREMENTS = {
+ channel: API::NO_SLASH_URL_PART_REGEX,
file_name: API::NO_SLASH_URL_PART_REGEX
}.freeze
@@ -33,7 +34,7 @@ module API
requires :id, type: String, desc: 'The ID or full path of a project'
end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
- namespace ':id/packages/helm' do
+ namespace ':id/packages/helm', requirements: HELM_REQUIREMENTS do
desc 'Download a chart index' do
detail 'This feature was introduced in GitLab 14.0'
end
@@ -58,7 +59,7 @@ module API
requires :channel, type: String, desc: 'Helm channel', regexp: Gitlab::Regex.helm_channel_regex
requires :file_name, type: String, desc: 'Helm package file name'
end
- get ":channel/charts/:file_name.tgz", requirements: FILE_NAME_REQUIREMENTS do
+ get ":channel/charts/:file_name.tgz" do
authorize_read_package!(authorized_user_project)
package_file = Packages::Helm::PackageFilesFinder.new(authorized_user_project, params[:channel], file_name: "#{params[:file_name]}.tgz").most_recent!
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 6331aced604..6321b71a587 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -131,7 +131,7 @@ module Gitlab
end
def helm_channel_regex
- @helm_channel_regex ||= %r{\A[-\.\_a-zA-Z0-9]+\z}.freeze
+ @helm_channel_regex ||= %r{\A([a-zA-Z0-9](\.|-|_)?){1,63}(?<!\.|-|_)\z}.freeze
end
def helm_package_regex
diff --git a/lib/gitlab/usage/metric_definition.rb b/lib/gitlab/usage/metric_definition.rb
index db0cb4c6326..6e5196ecdbd 100644
--- a/lib/gitlab/usage/metric_definition.rb
+++ b/lib/gitlab/usage/metric_definition.rb
@@ -6,6 +6,7 @@ module Gitlab
METRIC_SCHEMA_PATH = Rails.root.join('config', 'metrics', 'schema.json')
BASE_REPO_PATH = 'https://gitlab.com/gitlab-org/gitlab/-/blob/master'
SKIP_VALIDATION_STATUSES = %w[deprecated removed].to_set.freeze
+ AVAILABLE_STATUSES = %w[active data_available implemented deprecated].freeze
InvalidError = Class.new(RuntimeError)
@@ -59,6 +60,10 @@ module Gitlab
attributes[:data_category]&.downcase!
end
+ def available?
+ AVAILABLE_STATUSES.include?(attributes[:status])
+ end
+
alias_method :to_dictionary, :to_h
class << self
@@ -76,7 +81,7 @@ module Gitlab
end
def with_instrumentation_class
- all.select { |definition| definition.attributes[:instrumentation_class].present? }
+ all.select { |definition| definition.attributes[:instrumentation_class].present? && definition.available? }
end
def schemer
diff --git a/lib/gitlab/usage_data_counters/known_events/epic_board_events.yml b/lib/gitlab/usage_data_counters/known_events/epic_board_events.yml
index 281db441829..3879c561cc4 100644
--- a/lib/gitlab/usage_data_counters/known_events/epic_board_events.yml
+++ b/lib/gitlab/usage_data_counters/known_events/epic_board_events.yml
@@ -7,16 +7,13 @@
category: epic_boards_usage
redis_slot: project_management
aggregation: daily
- feature_flag: track_epic_boards_activity
- name: g_project_management_users_viewing_epic_boards
category: epic_boards_usage
redis_slot: project_management
aggregation: daily
- feature_flag: track_epic_boards_activity
- name: g_project_management_users_updating_epic_board_names
category: epic_boards_usage
redis_slot: project_management
aggregation: daily
- feature_flag: track_epic_boards_activity
diff --git a/qa/Gemfile b/qa/Gemfile
index aae3c81bd83..493e7de1e76 100644
--- a/qa/Gemfile
+++ b/qa/Gemfile
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
gem 'gitlab-qa', require: 'gitlab/qa'
gem 'activesupport', '~> 6.1.3.2' # This should stay in sync with the root's Gemfile
-gem 'allure-rspec', '~> 2.14.5'
+gem 'allure-rspec', '~> 2.15.0'
gem 'capybara', '~> 3.35.0'
gem 'capybara-screenshot', '~> 1.0.23'
gem 'rake', '~> 12.3.3'
diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock
index f105274b3ac..ede0fbe00de 100644
--- a/qa/Gemfile.lock
+++ b/qa/Gemfile.lock
@@ -19,10 +19,10 @@ GEM
rack-test (>= 1.1.0, < 2.0)
rest-client (>= 2.0.2, < 3.0)
rspec (~> 3.8)
- allure-rspec (2.14.5)
- allure-ruby-commons (= 2.14.5)
+ allure-rspec (2.15.0)
+ allure-ruby-commons (= 2.15.0)
rspec-core (>= 3.8, < 4)
- allure-ruby-commons (2.14.5)
+ allure-ruby-commons (2.15.0)
mime-types (>= 3.3, < 4)
oj (>= 3.10, < 4)
require_all (>= 2, < 4)
@@ -136,7 +136,7 @@ GEM
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
- oj (3.13.2)
+ oj (3.13.8)
parallel (1.19.2)
parallel_tests (2.29.0)
parallel
@@ -241,7 +241,7 @@ PLATFORMS
DEPENDENCIES
activesupport (~> 6.1.3.2)
airborne (~> 0.3.4)
- allure-rspec (~> 2.14.5)
+ allure-rspec (~> 2.15.0)
capybara (~> 3.35.0)
capybara-screenshot (~> 1.0.23)
chemlab (~> 0.9)
diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb
index 73f41e0aa51..ad264bd6d56 100644
--- a/qa/qa/page/component/snippet.rb
+++ b/qa/qa/page/component/snippet.rb
@@ -79,6 +79,11 @@ module QA
element :default_actions_container
element :copy_contents_button
end
+
+ base.view 'app/views/layouts/nav/_breadcrumbs.html.haml' do
+ element :breadcrumb_links_content
+ element :breadcrumb_sub_title_content
+ end
end
def has_snippet_title?(snippet_title)
@@ -249,6 +254,12 @@ module QA
raise ElementNotFound, "Comment did not appear as expected"
end
end
+
+ def snippet_id
+ within_element(:breadcrumb_links_content) do
+ find_element(:breadcrumb_sub_title_content).text.delete_prefix('$')
+ end
+ end
end
end
end
diff --git a/qa/qa/resource/project_snippet.rb b/qa/qa/resource/project_snippet.rb
index 9ab4612d117..9a22966efdb 100644
--- a/qa/qa/resource/project_snippet.rb
+++ b/qa/qa/resource/project_snippet.rb
@@ -30,6 +30,8 @@ module QA
new_snippet.click_create_snippet_button
end
+
+ @id = Page::Project::Snippet::Show.perform(&:snippet_id)
end
def api_get_path
diff --git a/qa/qa/resource/snippet.rb b/qa/qa/resource/snippet.rb
index a94ae02b8fd..a79e8c7de6b 100644
--- a/qa/qa/resource/snippet.rb
+++ b/qa/qa/resource/snippet.rb
@@ -22,6 +22,10 @@ module QA
end
def fabricate!
+ Page::Main::Menu.perform do |menu|
+ menu.go_to_menu_dropdown_option(:snippets_link)
+ end
+
Page::Dashboard::Snippet::Index.perform(&:go_to_new_snippet_page)
Page::Dashboard::Snippet::New.perform do |new_page|
@@ -38,6 +42,8 @@ module QA
end
new_page.click_create_snippet_button
end
+
+ @id = Page::Dashboard::Snippet::Show.perform(&:snippet_id)
end
def fabricate_via_api!
diff --git a/qa/qa/runtime/allure_report.rb b/qa/qa/runtime/allure_report.rb
index 5b0456dc607..5f628050f3b 100644
--- a/qa/qa/runtime/allure_report.rb
+++ b/qa/qa/runtime/allure_report.rb
@@ -5,6 +5,8 @@ require 'active_support/core_ext/enumerable'
module QA
module Runtime
class AllureReport
+ extend QA::Support::API
+
class << self
# Configure allure reports
#
@@ -77,27 +79,21 @@ module QA
end
end
- # Custom environment info hash
+ # Gitlab version and revision information
#
# @return [Hash]
def environment_info
- %w[
- CI_COMMIT_SHA
- CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
- CI_MERGE_REQUEST_IID
- TOP_UPSTREAM_SOURCE_SHA
- TOP_UPSTREAM_MERGE_REQUEST_IID
- DEPLOY_VERSION
- GITLAB_VERSION
- GITLAB_SHELL_VERSION
- GITLAB_ELASTICSEARCH_INDEXER_VERSION
- GITLAB_KAS_VERSION
- GITLAB_WORKHORSE_VERSION
- GITLAB_PAGES_VERSION
- GITALY_SERVER_VERSION
- QA_IMAGE
- QA_BROWSER
- ].index_with { |val| ENV[val] }.compact_blank
+ lambda do
+ return {} unless Env.admin_personal_access_token || Env.personal_access_token
+
+ client = Env.admin_personal_access_token ? API::Client.as_admin : API::Client.new
+ response = get(API::Request.new(client, '/version').url)
+
+ JSON.parse(response.body, symbolize_names: true)
+ rescue StandardError, ArgumentError => e
+ Logger.error("Failed to attach version info to allure report: #{e}")
+ {}
+ end
end
end
end
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
index 1080d8ab849..300fd6a1be2 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb
@@ -3,13 +3,7 @@
module QA
RSpec.describe 'Create' do # convert back to a smoke test once proved to be stable
describe 'Personal snippet creation' do
- it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1357' do
- Flow::Login.sign_in
-
- Page::Main::Menu.perform do |menu|
- menu.go_to_menu_dropdown_option(:snippets_link)
- end
-
+ let(:snippet) do
Resource::Snippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Snippet title'
snippet.description = 'Snippet description'
@@ -17,6 +11,18 @@ module QA
snippet.file_name = 'ruby_file.rb'
snippet.file_content = 'File.read("test.txt").split(/\n/)'
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1357' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Snippet title')
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
index 525fc5799a9..a32ee472150 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb
@@ -3,17 +3,11 @@
module QA
RSpec.describe 'Create' do
describe 'Multiple file snippet' do
- it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1654' do
- Flow::Login.sign_in
-
- Page::Main::Menu.perform do |menu|
- menu.go_to_menu_dropdown_option(:snippets_link)
- end
-
+ let(:snippet) do
Resource::Snippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Personal snippet with multiple files'
snippet.description = 'Snippet description'
- snippet.visibility = 'Public'
+ snippet.visibility = 'Private'
snippet.file_name = 'First file name'
snippet.file_content = 'First file content'
@@ -22,11 +16,23 @@ module QA
files.append(name: 'Third file name', content: 'Third file content')
end
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1654' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Personal snippet with multiple files')
expect(snippet).to have_snippet_description('Snippet description')
- expect(snippet).to have_visibility_type(/public/i)
+ expect(snippet).to have_visibility_type(/private/i)
expect(snippet).to have_file_name('First file name', 1)
expect(snippet).to have_file_content('First file content', 1)
expect(snippet).to have_file_name('Second file name', 2)
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
index e4c2488e8df..1967273ca17 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
@@ -3,9 +3,7 @@
module QA
RSpec.describe 'Create' do # to be converted to a smoke test once proved to be stable
describe 'Project snippet creation' do
- it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1358' do
- Flow::Login.sign_in
-
+ let(:snippet) do
Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Project snippet'
snippet.description = ' '
@@ -13,6 +11,18 @@ module QA
snippet.file_name = 'markdown_file.md'
snippet.file_content = "### Snippet heading\n\n[Gitlab link](https://gitlab.com/)"
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1358' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Project snippet')
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
index 3298989cc12..ae71be26a38 100644
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
@@ -3,9 +3,7 @@
module QA
RSpec.describe 'Create' do
describe 'Multiple file snippet' do
- it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1648' do
- Flow::Login.sign_in
-
+ let(:snippet) do
Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet|
snippet.title = 'Project snippet with multiple files'
snippet.description = 'Snippet description'
@@ -20,6 +18,18 @@ module QA
end
end
end
+ end
+
+ before do
+ Flow::Login.sign_in
+ end
+
+ after do
+ snippet.remove_via_api!
+ end
+
+ it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1648' do
+ snippet.visit!
Page::Dashboard::Snippet::Show.perform do |snippet|
aggregate_failures 'file content verification' do
diff --git a/qa/spec/specs/allure_report_spec.rb b/qa/spec/specs/allure_report_spec.rb
index 34116ca6cbd..03bf77039cc 100644
--- a/qa/spec/specs/allure_report_spec.rb
+++ b/qa/spec/specs/allure_report_spec.rb
@@ -45,14 +45,18 @@ describe QA::Runtime::AllureReport do
let(:png_file) { 'png-file' }
let(:html_file) { 'html-file' }
let(:ci_job) { 'ee:relative 5' }
+ let(:versions) { { version: '14', revision: '6ced31db947' } }
before do
stub_env('CI', 'true')
stub_env('CI_JOB_NAME', ci_job)
+ stub_env('GITLAB_QA_ADMIN_ACCESS_TOKEN', 'token')
allow(Allure).to receive(:add_attachment)
allow(File).to receive(:open).with(png_path) { png_file }
allow(File).to receive(:open).with(html_path) { html_file }
+ allow(RestClient::Request).to receive(:execute) { double('response', code: 200, body: versions.to_json) }
+ allow(QA::Runtime::Scenario).to receive(:method_missing).with(:gitlab_address).and_return('gitlab.com')
described_class.configure!
end
@@ -61,7 +65,7 @@ describe QA::Runtime::AllureReport do
aggregate_failures do
expect(allure_config.results_directory).to eq('tmp/allure-results')
expect(allure_config.clean_results_directory).to eq(true)
- expect(allure_config.environment_properties).to be_a_kind_of(Hash)
+ expect(allure_config.environment_properties.call).to eq(versions)
expect(allure_config.environment).to eq('ee:relative')
end
end
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
index b47f8520514..daf7dac36a3 100644
--- a/spec/lib/gitlab/regex_spec.rb
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -653,13 +653,23 @@ RSpec.describe Gitlab::Regex do
it { is_expected.to match('release') }
it { is_expected.to match('my-repo') }
- it { is_expected.to match('my-repo42') }
+ it { is_expected.to match('My-Re_po') }
+ it { is_expected.to match('my_repo42') }
+ it { is_expected.to match('1.2.3') }
+ it { is_expected.to match('v1.2.3-beta-12') }
# Do not allow empty
it { is_expected.not_to match('') }
# Do not allow Unicode
it { is_expected.not_to match('hé') }
+
+ it { is_expected.not_to match('.1.23') }
+ it { is_expected.not_to match('1..23') }
+ it { is_expected.not_to match('1.2.3.') }
+ it { is_expected.not_to match('1..2.3.') }
+ it { is_expected.not_to match('1/../2.3.') }
+ it { is_expected.not_to match('1/..%2F2.3.') }
end
describe '.helm_package_regex' do
diff --git a/spec/lib/gitlab/usage/metric_definition_spec.rb b/spec/lib/gitlab/usage/metric_definition_spec.rb
index 6406c0b5458..522f69062fb 100644
--- a/spec/lib/gitlab/usage/metric_definition_spec.rb
+++ b/spec/lib/gitlab/usage/metric_definition_spec.rb
@@ -49,6 +49,37 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
expect { described_class.definitions }.not_to raise_error
end
+ describe '#with_instrumentation_class' do
+ let(:metric_status) { 'active' }
+ let(:all_definitions) do
+ metrics_definitions = [
+ { key_path: 'metric1', instrumentation_class: 'RedisHLLMetric', status: 'data_available' },
+ { key_path: 'metric2', instrumentation_class: 'RedisHLLMetric', status: 'implemented' },
+ { key_path: 'metric3', instrumentation_class: 'RedisHLLMetric', status: 'deprecated' },
+ { key_path: 'metric4', instrumentation_class: 'RedisHLLMetric', status: metric_status },
+ { key_path: 'metric5', status: 'active' },
+ { key_path: 'metric_missing_status' }
+ ]
+ metrics_definitions.map { |definition| described_class.new(definition[:key_path], definition.symbolize_keys) }
+ end
+
+ before do
+ allow(described_class).to receive(:all).and_return(all_definitions)
+ end
+
+ it 'includes definitions with instrumentation_class' do
+ expect(described_class.with_instrumentation_class.count).to eq(4)
+ end
+
+ context 'with removed metric' do
+ let(:metric_status) { 'removed' }
+
+ it 'excludes removed definitions' do
+ expect(described_class.with_instrumentation_class.count).to eq(3)
+ end
+ end
+ end
+
describe '#key' do
subject { definition.key }
diff --git a/spec/lib/gitlab/usage_data_metrics_spec.rb b/spec/lib/gitlab/usage_data_metrics_spec.rb
index e0063194f9b..ee0cfb1407e 100644
--- a/spec/lib/gitlab/usage_data_metrics_spec.rb
+++ b/spec/lib/gitlab/usage_data_metrics_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe Gitlab::UsageDataMetrics do
let(:metric_files_key_paths) do
Gitlab::Usage::MetricDefinition
.definitions
- .select { |k, v| v.attributes[:data_source] == 'redis_hll' && v.key_path.starts_with?('redis_hll_counters') }
+ .select { |k, v| v.attributes[:data_source] == 'redis_hll' && v.key_path.starts_with?('redis_hll_counters') && v.available? }
.keys
.sort
end
diff --git a/spec/requests/api/helm_packages_spec.rb b/spec/requests/api/helm_packages_spec.rb
index 3236857c5fc..5212e225351 100644
--- a/spec/requests/api/helm_packages_spec.rb
+++ b/spec/requests/api/helm_packages_spec.rb
@@ -18,11 +18,11 @@ RSpec.describe API::HelmPackages do
let_it_be(:other_package) { create(:npm_package, project: project) }
describe 'GET /api/v4/projects/:id/packages/helm/:channel/index.yaml' do
- let(:url) { "/projects/#{project_id}/packages/helm/stable/index.yaml" }
+ let(:project_id) { project.id }
+ let(:channel) { 'stable' }
+ let(:url) { "/projects/#{project_id}/packages/helm/#{channel}/index.yaml" }
context 'with a project id' do
- let(:project_id) { project.id }
-
it_behaves_like 'handling helm chart index requests'
end
@@ -31,6 +31,18 @@ RSpec.describe API::HelmPackages do
it_behaves_like 'handling helm chart index requests'
end
+
+ context 'with dot in channel' do
+ let(:channel) { 'with.dot' }
+
+ subject { get api(url) }
+
+ before do
+ project.update!(visibility: 'public')
+ end
+
+ it_behaves_like 'returning response status', :success
+ end
end
describe 'GET /api/v4/projects/:id/packages/helm/:channel/charts/:file_name.tgz' do