Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-10-03 21:09:57 +00:00
parent d83bbccfcd
commit b8fcc8edb4
81 changed files with 629 additions and 478 deletions

View File

@ -1839,11 +1839,6 @@
- when: manual
allow_failure: true
.setup:rules:gitlab_git_test:
rules:
- <<: *if-default-refs
changes: *code-backstage-patterns
.setup:rules:no-ee-check:
rules:
- <<: *if-not-foss

View File

@ -43,14 +43,6 @@ dont-interrupt-me:
script:
- echo "This jobs makes sure this pipeline won't be interrupted! See https://docs.gitlab.com/ee/ci/yaml/#interruptible."
gitlab_git_test:
extends:
- .minimal-job
- .setup:rules:gitlab_git_test
stage: test
script:
- spec/support/prepare-gitlab-git-test-for-commit --check-for-changes
no-ee-check:
extends:
- .minimal-job

View File

@ -82,6 +82,7 @@ _Consider adding links to check for Sentry errors, Production logs for 5xx, 302s
### Preparation before global rollout
- [ ] Set a milestone to the rollout issue to signal for enabling and removing the feature flag when it is stable.
- [ ] Check if the feature flag change needs to be accompanied with a
[change management issue](https://about.gitlab.com/handbook/engineering/infrastructure/change-management/#feature-flags-and-the-change-management-process).
Cross link the issue here if it does.
@ -167,5 +168,11 @@ You can either [create a follow-up issue for Feature Flag Cleanup](https://gitla
/chatops run feature set <feature-flag-name> false
```
/label ~"feature flag" ~"type::feature" ~"feature::addition"
<!-- A feature flag can also be used for rolling out a bug fix or a maintenance work.
In this scenario, labels must be related to it, for example; ~"type::feature", ~"type::bug" or ~"type::maintenance".
Please use /copy_metadata to copy the labels from the issue you're rolling out. -->
/label ~group::
/label ~"feature flag"
/assign me
/due in 1 month

View File

@ -45,7 +45,6 @@ AllCops:
- 'file_hooks/**/*'
- 'workhorse/**/*'
- 'shared/packages/**/*'
- 'spec/support/*.git/**/*' # e.g. spec/support/gitlab-git-test.git
- 'db/ci_migrate/*.rb' # since the `db/ci_migrate` is a symlinked to `db/migrate`
# Use absolute path to avoid orphan directories with changed workspace root.
CacheRootDirectory: <%= Dir.getwd %>/tmp

View File

@ -1176,7 +1176,6 @@ Style/IfUnlessModifier:
- 'spec/support/helpers/lets_encrypt_helpers.rb'
- 'spec/support/helpers/live_debugger.rb'
- 'spec/support/helpers/modal_helpers.rb'
- 'spec/support/helpers/seed_helper.rb'
- 'spec/support/helpers/stub_gitlab_calls.rb'
- 'spec/support/helpers/stubbed_feature.rb'
- 'spec/support/helpers/test_env.rb'

View File

@ -1154,7 +1154,6 @@ Style/PercentLiteralDelimiters:
- 'spec/support/helpers/login_helpers.rb'
- 'spec/support/helpers/prometheus_helpers.rb'
- 'spec/support/helpers/repo_helpers.rb'
- 'spec/support/helpers/seed_helper.rb'
- 'spec/support/helpers/seed_repo.rb'
- 'spec/support/helpers/test_env.rb'
- 'spec/support/helpers/usage_data_helpers.rb'

View File

@ -329,7 +329,6 @@ Style/StringConcatenation:
- 'spec/support/shared_examples/models/wiki_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/hooks_shared_examples.rb'
- 'spec/support/shared_examples/requests/snippet_shared_examples.rb'
- 'spec/support/unpack-gitlab-git-test'
- 'spec/tooling/lib/tooling/kubernetes_client_spec.rb'
- 'spec/uploaders/job_artifact_uploader_spec.rb'
- 'spec/validators/addressable_url_validator_spec.rb'

View File

@ -150,7 +150,12 @@ export default {
<template>
<content-editor-provider :content-editor="contentEditor">
<div>
<editor-state-observer @docUpdate="notifyChange" @focus="focus" @blur="blur" />
<editor-state-observer
@docUpdate="notifyChange"
@focus="focus"
@blur="blur"
@keydown="$emit('keydown', $event)"
/>
<content-editor-alert />
<div
data-testid="content-editor"

View File

@ -1,6 +1,6 @@
<script>
import { debounce } from 'lodash';
import { ALERT_EVENT } from '../constants';
import { ALERT_EVENT, KEYDOWN_EVENT } from '../constants';
export const tiptapToComponentMap = {
update: 'docUpdate',
@ -10,7 +10,7 @@ export const tiptapToComponentMap = {
blur: 'blur',
};
export const eventHubEvents = [ALERT_EVENT];
export const eventHubEvents = [ALERT_EVENT, KEYDOWN_EVENT];
const getComponentEventName = (tiptapEventName) => tiptapToComponentMap[tiptapEventName];

View File

@ -42,10 +42,8 @@ export const TEXT_STYLE_DROPDOWN_ITEMS = [
},
];
export const LOADING_CONTENT_EVENT = 'loading';
export const LOADING_SUCCESS_EVENT = 'loadingSuccess';
export const LOADING_ERROR_EVENT = 'loadingError';
export const ALERT_EVENT = 'alert';
export const KEYDOWN_EVENT = 'keydown';
export const PARSE_HTML_PRIORITY_LOWEST = 1;
export const PARSE_HTML_PRIORITY_DEFAULT = 50;

View File

@ -0,0 +1,38 @@
import { Extension } from '@tiptap/core';
import { Plugin, PluginKey } from 'prosemirror-state';
import { KEYDOWN_EVENT } from '../constants';
/**
* This extension bubbles up the keydown event, captured by ProseMirror in the
* contenteditale element, to the presentation layer implemented in vue.
*
* The purpose of this mechanism is allowing clients of the
* content editor to attach keyboard shortcuts for behavior outside
* of the Content Editors boundaries, i.e. submitting a form to save changes.
*/
export default Extension.create({
name: 'keyboardShortcut',
addOptions() {
return {
eventHub: null,
};
},
addProseMirrorPlugins() {
return [
new Plugin({
key: new PluginKey('keyboardShortcut'),
props: {
handleKeyDown: (_, event) => {
const {
options: { eventHub },
} = this;
eventHub.$emit(KEYDOWN_EVENT, event);
return false;
},
},
}),
];
},
});

View File

@ -18,6 +18,7 @@ import Diagram from '../extensions/diagram';
import Document from '../extensions/document';
import Dropcursor from '../extensions/dropcursor';
import Emoji from '../extensions/emoji';
import ExternalKeydownHandler from '../extensions/external_keydown_handler';
import Figure from '../extensions/figure';
import FigureCaption from '../extensions/figure_caption';
import FootnoteDefinition from '../extensions/footnote_definition';
@ -122,6 +123,7 @@ export const createContentEditor = ({
Image,
InlineDiff,
Italic,
ExternalKeydownHandler.configure({ eventHub }),
Link,
ListItem,
Loading,

View File

@ -264,12 +264,17 @@ export default {
trackContentEditorLoaded() {
this.track(CONTENT_EDITOR_LOADED_ACTION);
},
submitFormWithShortcut() {
this.$refs.form.submit();
},
},
};
</script>
<template>
<gl-form
ref="form"
:action="formAction"
method="post"
class="wiki-form common-note-form gl-mt-3 js-quick-submit"
@ -345,6 +350,8 @@ export default {
form-field-name="wiki[content]"
@contentEditor="notifyContentEditorActive"
@markdownField="notifyContentEditorInactive"
@keydown.ctrl.enter="submitFormShortcut"
@keydown.meta.enter="submitFormShortcut"
/>
<div class="form-text gl-text-gray-600">
<gl-sprintf

View File

@ -176,6 +176,7 @@ export default {
:aria-label="formFieldAriaLabel"
:placeholder="formFieldPlaceholder"
@input="updateMarkdownFromMarkdownField"
@keydown="$emit('keydown', $event)"
>
</textarea>
</template>
@ -190,6 +191,7 @@ export default {
@loading="disableSwitchEditingControl"
@loadingSuccess="enableSwitchEditingControl"
@loadingError="enableSwitchEditingControl"
@keydown="$emit('keydown', $event)"
/>
<input
:id="formFieldId"

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
module Packages
module Rpm
class RepositoryFile < ApplicationRecord
include EachBatch
include UpdateProjectStatistics
include FileStoreMounter
include Packages::Installable
INSTALLABLE_STATUSES = [:default].freeze
enum status: { default: 0, pending_destruction: 1, processing: 2, error: 3 }
belongs_to :project, inverse_of: :repository_files
validates :project, presence: true
validates :file, presence: true
validates :file_name, presence: true
mount_file_store_uploader Packages::Rpm::RepositoryFileUploader
update_project_statistics project_statistics_name: :packages_size
end
end
end

View File

@ -236,6 +236,9 @@ class Project < ApplicationRecord
# Packages
has_many :packages, class_name: 'Packages::Package'
has_many :package_files, through: :packages, class_name: 'Packages::PackageFile'
# repository_files must be destroyed by ruby code in order to properly remove carrierwave uploads
has_many :repository_files, inverse_of: :project, class_name: 'Packages::Rpm::RepositoryFile',
dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
# debian_distributions and associated component_files must be destroyed by ruby code in order to properly remove carrierwave uploads
has_many :debian_distributions, class_name: 'Packages::Debian::ProjectDistribution', dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_one :packages_cleanup_policy, class_name: 'Packages::Cleanup::Policy', inverse_of: :project

View File

@ -0,0 +1,33 @@
# frozen_string_literal: true
module Packages
module Rpm
class RepositoryFileUploader < GitlabUploader
include ObjectStorage::Concern
storage_options Gitlab.config.packages
after :store, :schedule_background_upload
alias_method :upload, :model
def filename
model.file_name
end
def store_dir
dynamic_segment
end
private
def dynamic_segment
raise ObjectNotReadyError, 'Repository file model not ready' unless model.id
Gitlab::HashedPath.new(
'projects', model.project_id, 'rpm', 'repository_files', model.id,
root_hash: model.project_id
)
end
end
end
end

View File

@ -11,7 +11,7 @@
.gl-new-dropdown-inner
.gl-new-dropdown-contents
%ul
- if !@merge_request.merged? && current_user && moved_mr_sidebar_enabled?
- if current_user && moved_mr_sidebar_enabled?
%li.gl-new-dropdown-item.js-sidebar-subscriptions-entry-point
%li.gl-new-dropdown-divider
%hr.dropdown-divider

View File

@ -0,0 +1,24 @@
---
data_category: optional
key_path: redis_hll_counters.quickactions.i_quickactions_assign_multiple_monthly
description: Count of MAU using the `/assign @user1 @user2` quick action
product_section: dev
product_stage: plan
product_group: project_management
product_category: issue_tracking
value_type: number
status: active
time_frame: 28d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- i_quickactions_assign_multiple
distribution:
- ce
- ee
tier:
- premium
- ultimate
performance_indicator_type: []
milestone: "<13.9"

View File

@ -43,6 +43,7 @@ options:
- i_quickactions_parent_epic
- i_quickactions_promote
- i_quickactions_publish
- i_quickactions_ready
- i_quickactions_reassign
- i_quickactions_reassign_reviewer
- i_quickactions_rebase

View File

@ -0,0 +1,25 @@
---
key_path: redis_hll_counters.project_management.i_quickactions_ready_monthly
description: Count of MAU using the `/ready` quick action
product_section: dev
product_stage: plan
product_group: project_management
product_category: issue_tracking
value_type: number
data_source: redis_hll
status: active
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97115"
time_frame: 28d
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- i_quickactions_ready
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View File

@ -0,0 +1,24 @@
---
data_category: optional
key_path: redis_hll_counters.quickactions.i_quickactions_assign_multiple_weekly
description: Count of WAU using the `/assign @user1 @user2` quick action
product_section: dev
product_stage: plan
product_group: project_management
product_category: issue_tracking
value_type: number
status: active
time_frame: 7d
data_source: redis_hll
instrumentation_class: RedisHLLMetric
options:
events:
- i_quickactions_assign_multiple
distribution:
- ce
- ee
tier:
- premium
- ultimate
performance_indicator_type: []
milestone: "<13.9"

View File

@ -43,6 +43,7 @@ options:
- i_quickactions_parent_epic
- i_quickactions_promote
- i_quickactions_publish
- i_quickactions_ready
- i_quickactions_reassign
- i_quickactions_reassign_reviewer
- i_quickactions_rebase

View File

@ -0,0 +1,25 @@
---
key_path: redis_hll_counters.project_management.i_quickactions_ready_weekly
description: Count of WAU using the `/ready` quick action
product_section: dev
product_stage: plan
product_group: project_management
product_category: issue_tracking
value_type: number
data_source: redis_hll
status: active
milestone: "15.4"
introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97115"
time_frame: 7d
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- i_quickactions_ready
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View File

@ -0,0 +1,9 @@
---
table_name: packages_rpm_repository_files
classes:
- Packages::RPM::RepositoryFile
feature_categories:
- package_registry
description: Package registry file links and file metadata for RPM packages
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97484
milestone: '15.5'

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
class CreatePackagesRpmRepositoryFile < Gitlab::Database::Migration[2.0]
enable_lock_retries!
def up
create_table :packages_rpm_repository_files do |t|
t.timestamps_with_timezone
t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }, type: :bigint
t.integer :file_store, default: 1
t.integer :status, default: 0, null: false, limit: 2
t.integer :size
t.binary :file_md5
t.binary :file_sha1
t.binary :file_sha256
t.text :file, null: false, limit: 255
t.text :file_name, null: false, limit: 255
end
end
def down
drop_table :packages_rpm_repository_files
end
end

View File

@ -0,0 +1 @@
9cb59a045dd09fc956683e976d127f8f2346b2b26c25eeeadc4b0ef838fa1d02

View File

@ -18947,6 +18947,32 @@ CREATE TABLE packages_rpm_metadata (
CONSTRAINT check_c3e2fc2e89 CHECK ((char_length(release) <= 128))
);
CREATE TABLE packages_rpm_repository_files (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
project_id bigint NOT NULL,
file_store integer DEFAULT 1,
status smallint DEFAULT 0 NOT NULL,
size integer,
file_md5 bytea,
file_sha1 bytea,
file_sha256 bytea,
file text NOT NULL,
file_name text NOT NULL,
CONSTRAINT check_a9fef187f5 CHECK ((char_length(file) <= 255)),
CONSTRAINT check_b6b721b275 CHECK ((char_length(file_name) <= 255))
);
CREATE SEQUENCE packages_rpm_repository_files_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE packages_rpm_repository_files_id_seq OWNED BY packages_rpm_repository_files.id;
CREATE TABLE packages_rubygems_metadata (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
@ -23862,6 +23888,8 @@ ALTER TABLE ONLY packages_package_files ALTER COLUMN id SET DEFAULT nextval('pac
ALTER TABLE ONLY packages_packages ALTER COLUMN id SET DEFAULT nextval('packages_packages_id_seq'::regclass);
ALTER TABLE ONLY packages_rpm_repository_files ALTER COLUMN id SET DEFAULT nextval('packages_rpm_repository_files_id_seq'::regclass);
ALTER TABLE ONLY packages_tags ALTER COLUMN id SET DEFAULT nextval('packages_tags_id_seq'::regclass);
ALTER TABLE ONLY pages_deployment_states ALTER COLUMN pages_deployment_id SET DEFAULT nextval('pages_deployment_states_pages_deployment_id_seq'::regclass);
@ -25998,6 +26026,9 @@ ALTER TABLE ONLY packages_pypi_metadata
ALTER TABLE ONLY packages_rpm_metadata
ADD CONSTRAINT packages_rpm_metadata_pkey PRIMARY KEY (package_id);
ALTER TABLE ONLY packages_rpm_repository_files
ADD CONSTRAINT packages_rpm_repository_files_pkey PRIMARY KEY (id);
ALTER TABLE ONLY packages_rubygems_metadata
ADD CONSTRAINT packages_rubygems_metadata_pkey PRIMARY KEY (package_id);
@ -29706,6 +29737,8 @@ CREATE INDEX index_packages_project_id_name_partial_for_nuget ON packages_packag
CREATE INDEX index_packages_rpm_metadata_on_package_id ON packages_rpm_metadata USING btree (package_id);
CREATE INDEX index_packages_rpm_repository_files_on_project_id ON packages_rpm_repository_files USING btree (project_id);
CREATE INDEX index_packages_tags_on_package_id ON packages_tags USING btree (package_id);
CREATE INDEX index_packages_tags_on_package_id_and_updated_at ON packages_tags USING btree (package_id, updated_at DESC);
@ -34582,6 +34615,9 @@ ALTER TABLE ONLY geo_hashed_storage_attachments_events
ALTER TABLE ONLY ml_candidate_params
ADD CONSTRAINT fk_rails_d4a51d1185 FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id);
ALTER TABLE ONLY packages_rpm_repository_files
ADD CONSTRAINT fk_rails_d545cfaed2 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY packages_rpm_metadata
ADD CONSTRAINT fk_rails_d79f02264b FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;

View File

@ -206,7 +206,7 @@ The cost factors for jobs running on shared runners on GitLab.com are:
- `0.008` for public forks of public projects in the [GitLab for Open Source program](../../subscriptions/index.md#gitlab-for-open-source). For every 125 minutes of job execution time,
you use 1 CI/CD minute.
- `1` for other public projects, after October 1, 2022 (previously `0.04`).
For every 25 minutes of job execution time, you use 1 CI/CD minute.
For every 1 minute of job execution time, you use 1 CI/CD minute.
- Calculated differently for [community contributions to GitLab projects](#cost-factor-for-community-contributions-to-gitlab-projects).
The cost factors on self-managed instances are:

View File

@ -390,6 +390,7 @@ packages_nuget_dependency_link_metadata: :gitlab_main
packages_nuget_metadata: :gitlab_main
packages_package_file_build_infos: :gitlab_main
packages_package_files: :gitlab_main
packages_rpm_repository_files: :gitlab_main
packages_packages: :gitlab_main
packages_pypi_metadata: :gitlab_main
packages_rubygems_metadata: :gitlab_main

View File

@ -26,7 +26,6 @@ module Gitlab
ide_edit
incident_management
pipeline_authoring
quickactions
].freeze
CATEGORIES_COLLECTED_FROM_METRICS_DEFINITIONS = %w[
@ -41,6 +40,7 @@ module Gitlab
issues_edit
kubernetes_agent
pipeline_authoring
quickactions
search
secure
snippets

View File

@ -1,4 +1,8 @@
---
- name: i_quickactions_assign_multiple
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_approve
category: quickactions
redis_slot: quickactions
@ -11,10 +15,6 @@
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_assign_multiple
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_assign_self
category: quickactions
redis_slot: quickactions
@ -31,18 +31,6 @@
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_child_epic
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_clear_weight
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_clear_health_status
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_clone
category: quickactions
redis_slot: quickactions
@ -83,18 +71,10 @@
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_epic
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_estimate
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_iteration
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_label
category: quickactions
redis_slot: quickactions
@ -115,14 +95,6 @@
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_parent_epic
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_promote
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_promote_to_incident
category: quickactions
redis_slot: quickactions
@ -131,14 +103,6 @@
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_page
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_publish
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_ready
category: quickactions
redis_slot: quickactions
@ -163,34 +127,18 @@
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_child_epic
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_due_date
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_epic
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_estimate
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_iteration
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_milestone
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_parent_epic
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_remove_time_spent
category: quickactions
redis_slot: quickactions
@ -275,14 +223,6 @@
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_weight
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_health_status
category: quickactions
redis_slot: quickactions
aggregation: weekly
- name: i_quickactions_wip
category: quickactions
redis_slot: quickactions

View File

@ -53,7 +53,7 @@
"@gitlab/at.js": "1.5.7",
"@gitlab/favicon-overlay": "2.0.0",
"@gitlab/svgs": "3.4.0",
"@gitlab/ui": "43.20.0",
"@gitlab/ui": "43.21.0",
"@gitlab/visual-review-tools": "1.7.3",
"@gitlab/web-ide": "0.0.1-dev-20220815034418",
"@rails/actioncable": "6.1.4-7",
@ -105,7 +105,7 @@
"codesandbox-api": "0.0.23",
"compression-webpack-plugin": "^5.0.2",
"copy-webpack-plugin": "^6.4.1",
"core-js": "^3.25.2",
"core-js": "^3.25.4",
"cron-validator": "^1.1.1",
"cronstrue": "^1.122.0",
"cropper": "^2.3.0",

View File

@ -52,12 +52,13 @@ module QA
sleep_and_reload_if_needed(sleep_interval, reload_page)
attempts += 1
end
rescue StandardError, RSpec::Expectations::ExpectationNotMetError
rescue StandardError, RSpec::Expectations::ExpectationNotMetError => e
raise unless retry_on_exception
attempts += 1
raise unless remaining_attempts?(attempts, max_attempts) && remaining_time?(start, max_duration)
QA::Runtime::Logger.debug("Retry block rescued following error: #{e}, trying again...")
sleep_and_reload_if_needed(sleep_interval, reload_page)
retry
end

View File

@ -0,0 +1,33 @@
# frozen_string_literal: true
FactoryBot.define do
factory :rpm_repository_file, class: 'Packages::Rpm::RepositoryFile' do
project
file_name { 'repomd.xml' }
file_sha1 { 'efae869b4e95d54796a46481f3a211d6a88d0323' }
file_md5 { 'ddf8a75330c896a8d7709e75f8b5982a' }
size { 3127.kilobytes }
status { :default }
transient do
file_metadatum_trait { :xml }
end
transient do
file_fixture { 'spec/fixtures/packages/rpm/repodata/repomd.xml' }
end
after(:build) do |package_file, evaluator|
package_file.file = fixture_file_upload(evaluator.file_fixture)
end
trait(:object_storage) do
file_store { Packages::Rpm::RepositoryFileUploader::Store::REMOTE }
end
trait :pending_destruction do
status { :pending_destruction }
end
end
end

View File

@ -0,0 +1,27 @@
<repomd xmlns="http://gitlab.com/api/v4/projects/1/packages/rpm/repodata/repomd.xml" xmlns:rpm="http://gitlab.com/api/v4/projects/1/packages/rpm/repodata/repomd.xml">
<revision>1644602779</revision>
<data type="filelists">
<checksum type="sha256">6503673de76312406ff8ecb06d9733c32b546a65abae4d4170d9b51fb75bf253</checksum>
<open-checksum type="sha256">7652c7496daa2507f08675a5b4f59a5428aaba72997400ae3d5e7bab8e3d9cc1</open-checksum>
<location href="repodata/6503673de76312406ff8ecb06d9733c32b546a65abae4d4170d9b51fb75bf253-filelists.xml"/>
<timestamp>1644602784</timestamp>
<size>1144067</size>
<open-size>25734004</open-size>
</data>
<data type="primary">
<checksum type="sha256">80279a863b6236e60c3e63036b8a9a25e3764dfb3121292b91e9f583af9e7b7e</checksum>
<open-checksum type="sha256">f852f3bb39f89520434d97f6913716dc448077ad49f2e5200327367f98a89d55</open-checksum>
<location href="repodata/80279a863b6236e60c3e63036b8a9a25e3764dfb3121292b91e9f583af9e7b7e-primary.xml"/>
<timestamp>1644602784</timestamp>
<size>66996</size>
<open-size>1008586</open-size>
</data>
<data type="other">
<checksum type="sha256">34408890500ec72c0f181542a91f7ff9320d2ef32c8e613540a5b9e1b8763e02</checksum>
<open-checksum type="sha256">acac5033036264cd26100713b014242471ade45487c28c7793466a84af512624</open-checksum>
<location href="repodata/34408890500ec72c0f181542a91f7ff9320d2ef32c8e613540a5b9e1b8763e02-other.xml"/>
<timestamp>1644602784</timestamp>
<size>43329</size>
<open-size>730393</open-size>
</data>
</repomd>

View File

@ -13,6 +13,7 @@ import MediaBubbleMenu from '~/content_editor/components/bubble_menus/media_bubb
import TopToolbar from '~/content_editor/components/top_toolbar.vue';
import LoadingIndicator from '~/content_editor/components/loading_indicator.vue';
import waitForPromises from 'helpers/wait_for_promises';
import { KEYDOWN_EVENT } from '~/content_editor/constants';
jest.mock('~/emoji');
@ -222,6 +223,17 @@ describe('ContentEditor', () => {
});
});
describe('when editorStateObserver emits keydown event', () => {
it('bubbles up event', () => {
const event = new Event('keydown');
createWrapper();
findEditorStateObserver().vm.$emit(KEYDOWN_EVENT, event);
expect(wrapper.emitted(KEYDOWN_EVENT)).toEqual([[event]]);
});
});
it.each`
name | component
${'formatting'} | ${FormattingBubbleMenu}

View File

@ -4,7 +4,7 @@ import EditorStateObserver, {
tiptapToComponentMap,
} from '~/content_editor/components/editor_state_observer.vue';
import eventHubFactory from '~/helpers/event_hub_factory';
import { ALERT_EVENT } from '~/content_editor/constants';
import { ALERT_EVENT, KEYDOWN_EVENT } from '~/content_editor/constants';
import { createTestEditor } from '../test_utils';
describe('content_editor/components/editor_state_observer', () => {
@ -14,6 +14,7 @@ describe('content_editor/components/editor_state_observer', () => {
let onSelectionUpdateListener;
let onTransactionListener;
let onAlertListener;
let onKeydownListener;
let eventHub;
const buildEditor = () => {
@ -30,6 +31,7 @@ describe('content_editor/components/editor_state_observer', () => {
selectionUpdate: onSelectionUpdateListener,
transaction: onTransactionListener,
[ALERT_EVENT]: onAlertListener,
[KEYDOWN_EVENT]: onKeydownListener,
},
});
};
@ -39,6 +41,7 @@ describe('content_editor/components/editor_state_observer', () => {
onSelectionUpdateListener = jest.fn();
onTransactionListener = jest.fn();
onAlertListener = jest.fn();
onKeydownListener = jest.fn();
buildEditor();
});
@ -67,8 +70,9 @@ describe('content_editor/components/editor_state_observer', () => {
});
it.each`
event | listener
${ALERT_EVENT} | ${() => onAlertListener}
event | listener
${ALERT_EVENT} | ${() => onAlertListener}
${KEYDOWN_EVENT} | ${() => onKeydownListener}
`('listens to $event event in the eventBus object', ({ event, listener }) => {
const args = {};
@ -97,6 +101,7 @@ describe('content_editor/components/editor_state_observer', () => {
it.each`
event
${ALERT_EVENT}
${KEYDOWN_EVENT}
`('removes $event event hook from eventHub', ({ event }) => {
jest.spyOn(eventHub, '$off');
jest.spyOn(eventHub, '$on');

View File

@ -147,6 +147,14 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
});
});
it('bubbles up keydown event', async () => {
buildWrapper();
await findTextarea().trigger('keydown');
expect(wrapper.emitted('keydown')).toHaveLength(1);
});
describe(`when segmented control triggers input event with ${EDITING_MODE_CONTENT_EDITOR} value`, () => {
beforeEach(() => {
buildWrapper();
@ -212,6 +220,14 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
expect(wrapper.emitted('input')).toEqual([[newValue]]);
});
it('bubbles up keydown event', () => {
const event = new Event('keydown');
findContentEditor().vm.$emit('keydown', event);
expect(wrapper.emitted('keydown')).toEqual([[event]]);
});
describe(`when segmented control triggers input event with ${EDITING_MODE_MARKDOWN_FIELD} value`, () => {
beforeEach(() => {
findSegmentedControl().vm.$emit('input', EDITING_MODE_MARKDOWN_FIELD);

View File

@ -12,13 +12,16 @@ describe('content_editor', () => {
let wrapper;
let renderMarkdown;
const buildWrapper = ({ markdown = '' } = {}) => {
const buildWrapper = ({ markdown = '', listeners = {} } = {}) => {
wrapper = mountExtended(ContentEditor, {
propsData: {
renderMarkdown,
uploadsPath: '/',
markdown,
},
listeners: {
...listeners,
},
});
};
@ -35,6 +38,10 @@ describe('content_editor', () => {
renderMarkdown = jest.fn();
});
afterEach(() => {
wrapper.destroy();
});
describe('when loading initial content', () => {
describe('when the initial content is empty', () => {
it('still hides the loading indicator', async () => {
@ -169,4 +176,16 @@ This reference tag is a mix of letters and numbers [^footnote].
});
});
});
it('bubbles up the keydown event captured by ProseMirror', async () => {
const keydownHandler = jest.fn();
buildWrapper({ listeners: { keydown: keydownHandler } });
await waitUntilContentIsLoaded();
wrapper.find('[contenteditable]').trigger('keydown', {});
expect(wrapper.emitted('keydown')).toHaveLength(1);
});
});

View File

@ -192,6 +192,6 @@ RSpec.describe Gitlab::BareRepositoryImport::Importer do
cmd = %W(#{Gitlab.config.git.bin_path} clone --bare #{source_project} #{repo_path})
system(git_env, *cmd, chdir: SEED_STORAGE_PATH, out: '/dev/null', err: '/dev/null')
system(git_env, *cmd, chdir: base_dir, out: '/dev/null', err: '/dev/null')
end
end

View File

@ -55,7 +55,7 @@ RSpec.describe ::Gitlab::BareRepositoryImport::Repository do
context 'hashed storage' do
let(:hashed_path) { "@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b" }
let(:root_path) { TestEnv.repos_path }
let(:root_path) { Gitlab::GitalyClient::StorageSettings.allow_disk_access { TestEnv.repos_path } }
let(:repo_path) { File.join(root_path, "#{hashed_path}.git") }
let(:wiki_path) { File.join(root_path, "#{hashed_path}.wiki.git") }
let(:raw_repository) { Gitlab::Git::Repository.new('default', "#{hashed_path}.git", nil, nil) }

View File

@ -98,7 +98,9 @@ RSpec.describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespa
it 'moves a project for a namespace' do
create(:project, :repository, :legacy_storage, namespace: namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'bye-group', 'hello-project.git')
expected_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, 'bye-group', 'hello-project.git')
end
subject.move_repositories(namespace, 'hello-group', 'bye-group')
@ -109,7 +111,9 @@ RSpec.describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespa
child_namespace = create(:group, name: 'sub-group', parent: namespace)
create(:project, :repository, :legacy_storage, namespace: child_namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'hello-group', 'renamed-sub-group', 'hello-project.git')
expected_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, 'hello-group', 'renamed-sub-group', 'hello-project.git')
end
subject.move_repositories(child_namespace, 'hello-group/sub-group', 'hello-group/renamed-sub-group')
@ -119,7 +123,9 @@ RSpec.describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespa
it 'moves a parent namespace with subdirectories' do
child_namespace = create(:group, name: 'sub-group', parent: namespace)
create(:project, :repository, :legacy_storage, namespace: child_namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'renamed-group', 'sub-group', 'hello-project.git')
expected_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, 'renamed-group', 'sub-group', 'hello-project.git')
end
subject.move_repositories(child_namespace, 'hello-group', 'renamed-group')
@ -170,7 +176,9 @@ RSpec.describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespa
describe '#rename_namespace_dependencies' do
it "moves the repository for a project in the namespace" do
create(:project, :repository, :legacy_storage, namespace: namespace, path: "the-path-project")
expected_repo = File.join(TestEnv.repos_path, "the-path0", "the-path-project.git")
expected_repo = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, "the-path0", "the-path-project.git")
end
subject.rename_namespace_dependencies(namespace, 'the-path', 'the-path0')
@ -268,7 +276,9 @@ RSpec.describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespa
project.create_repository
subject.rename_namespace(namespace)
expected_path = File.join(TestEnv.repos_path, 'the-path', 'a-project.git')
expected_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, 'the-path', 'a-project.git')
end
expect(subject).to receive(:rename_namespace_dependencies)
.with(

View File

@ -126,7 +126,9 @@ RSpec.describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProject
let(:project) { create(:project, :repository, :legacy_storage, path: 'the-path', namespace: known_parent) }
it 'moves the repository for a project' do
expected_path = File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git')
expected_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git')
end
subject.move_repository(project, 'known-parent/the-path', 'known-parent/new-repo')
@ -155,7 +157,9 @@ RSpec.describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProject
project.create_repository
subject.rename_project(project)
expected_path = File.join(TestEnv.repos_path, 'known-parent', 'the-path.git')
expected_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, 'known-parent', 'the-path.git')
end
expect(subject).to receive(:move_project_folders)
.with(

View File

@ -668,11 +668,11 @@ RSpec.describe Gitlab::Git::Repository do
expect_any_instance_of(Gitlab::GitalyClient::RemoteService)
.to receive(:find_remote_root_ref).and_call_original
expect(repository.find_remote_root_ref(SeedHelper::GITLAB_GIT_TEST_REPO_URL)).to eq 'master'
expect(repository.find_remote_root_ref(TestEnv.factory_repo_path.to_s)).to eq 'master'
end
it 'returns UTF-8' do
expect(repository.find_remote_root_ref(SeedHelper::GITLAB_GIT_TEST_REPO_URL)).to be_utf8
expect(repository.find_remote_root_ref(TestEnv.factory_repo_path.to_s)).to be_utf8
end
it 'returns nil when remote name is nil' do
@ -690,7 +690,7 @@ RSpec.describe Gitlab::Git::Repository do
end
it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RemoteService, :find_remote_root_ref do
subject { repository.find_remote_root_ref(SeedHelper::GITLAB_GIT_TEST_REPO_URL) }
subject { repository.find_remote_root_ref(TestEnv.factory_repo_path.to_s) }
end
end

View File

@ -213,7 +213,8 @@ RSpec.describe Gitlab::Git::RuggedImpl::UseRugged do
end
def create_gitaly_metadata_file
File.open(File.join(SEED_STORAGE_PATH, '.gitaly-metadata'), 'w+') do |f|
metadata_filename = File.join(TestEnv.repos_path, '.gitaly-metadata')
File.open(metadata_filename, 'w+') do |f|
gitaly_metadata = {
"gitaly_filesystem_id" => SecureRandom.uuid
}

View File

@ -308,7 +308,7 @@ RSpec.describe Gitlab::GitalyClient::RepositoryService do
end
describe '#replicate' do
let(:source_repository) { Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '', 'group/project') }
let(:source_repository) { Gitlab::Git::Repository.new('default', 'repo/path', '', 'group/project') }
it 'sends a replicate_repository message' do
expect_any_instance_of(Gitaly::RepositoryService::Stub)

View File

@ -571,6 +571,7 @@ project:
- project_registry
- packages
- package_files
- repository_files
- packages_cleanup_policy
- alerting_setting
- project_setting

View File

@ -5,8 +5,8 @@ RSpec.describe Gitlab::X509::Tag do
subject(:signature) { described_class.new(project.repository, tag).signature }
describe '#signature' do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '', 'group/project') }
let(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:repository) { project.repository.raw }
describe 'signed tag' do
let(:tag) { project.repository.find_tag('v1.1.1') }

View File

@ -25,6 +25,7 @@ RSpec.describe 'factories' do
[:issue_customer_relations_contact, :for_contact],
[:issue_customer_relations_contact, :for_issue],
[:package_file, :object_storage],
[:rpm_repository_file, :object_storage],
[:pages_domain, :without_certificate],
[:pages_domain, :without_key],
[:pages_domain, :with_missing_chain],

View File

@ -1036,7 +1036,9 @@ RSpec.describe Namespace do
let(:pages_dir) { File.join(TestEnv.pages_path) }
def expect_project_directories_at(namespace_path, with_pages: true)
expected_repository_path = File.join(TestEnv.repos_path, namespace_path, 'the-project.git')
expected_repository_path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, namespace_path, 'the-project.git')
end
expected_upload_path = File.join(uploads_dir, namespace_path, 'the-project')
expected_pages_path = File.join(pages_dir, namespace_path, 'the-project')
@ -1046,15 +1048,19 @@ RSpec.describe Namespace do
end
before do
FileUtils.mkdir_p(File.join(TestEnv.repos_path, "#{project.full_path}.git"))
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
FileUtils.mkdir_p(File.join(TestEnv.repos_path, "#{project.full_path}.git"))
end
FileUtils.mkdir_p(File.join(uploads_dir, project.full_path))
FileUtils.mkdir_p(File.join(pages_dir, project.full_path))
end
after do
FileUtils.remove_entry(File.join(TestEnv.repos_path, parent.full_path), true)
FileUtils.remove_entry(File.join(TestEnv.repos_path, new_parent.full_path), true)
FileUtils.remove_entry(File.join(TestEnv.repos_path, child.full_path), true)
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
FileUtils.remove_entry(File.join(TestEnv.repos_path, parent.full_path), true)
FileUtils.remove_entry(File.join(TestEnv.repos_path, new_parent.full_path), true)
FileUtils.remove_entry(File.join(TestEnv.repos_path, child.full_path), true)
end
FileUtils.remove_entry(File.join(uploads_dir, project.full_path), true)
FileUtils.remove_entry(pages_dir, true)
end

View File

@ -0,0 +1,44 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Packages::Rpm::RepositoryFile, type: :model do
using RSpec::Parameterized::TableSyntax
let_it_be(:repository_file) { create(:rpm_repository_file) }
it_behaves_like 'having unique enum values'
describe 'relationships' do
it { is_expected.to belong_to(:project) }
end
describe 'validations' do
it { is_expected.to validate_presence_of(:project) }
end
context 'when updating project statistics' do
context 'when the package file has an explicit size' do
it_behaves_like 'UpdateProjectStatistics' do
subject { build(:rpm_repository_file, size: 42) }
end
end
context 'when the package file does not have a size' do
it_behaves_like 'UpdateProjectStatistics' do
subject { build(:rpm_repository_file, size: nil) }
end
end
end
context 'with status scopes' do
let_it_be(:pending_destruction_repository_package_file) do
create(:rpm_repository_file, :pending_destruction)
end
describe '.with_status' do
subject { described_class.with_status(:pending_destruction) }
it { is_expected.to contain_exactly(pending_destruction_repository_package_file) }
end
end
end

View File

@ -26,9 +26,14 @@ RSpec.describe PoolRepository do
describe '#unlink_repository' do
let(:pool) { create(:pool_repository, :ready) }
let(:repository_path) { File.join(TestEnv.repos_path, pool.source_project.repository.relative_path) }
let(:alternates_file) { File.join(repository_path, 'objects', 'info', 'alternates') }
let(:repository_path) do
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, pool.source_project.repository.relative_path)
end
end
before do
pool.link_repository(pool.source_project.repository)
end

View File

@ -1,165 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# # generate-seed-repo-rb
#
# This script generates the seed_repo.rb file used by lib/gitlab/git
# tests. The seed_repo.rb file needs to be updated anytime there is a
# Git push to https://gitlab.com/gitlab-org/gitlab-git-test.
#
# Usage:
#
# ./spec/support/generate-seed-repo-rb > spec/support/helpers/seed_repo.rb
#
#
require 'erb'
require 'tempfile'
SOURCE = File.expand_path('gitlab-git-test.git', __dir__)
SCRIPT_NAME = 'generate-seed-repo-rb'
REPO_NAME = 'gitlab-git-test.git'
def main
Dir.mktmpdir do |dir|
unless system(*%W[git clone --bare #{SOURCE} #{REPO_NAME}], chdir: dir)
abort "git clone failed"
end
repo = File.join(dir, REPO_NAME)
erb = ERB.new(DATA.read)
erb.run(binding)
end
end
def capture!(cmd, dir)
output = IO.popen(cmd, 'r', chdir: dir) { |io| io.read }
raise "command failed with #{$?}: #{cmd.join(' ')}" unless $?.success?
output.chomp
end
main
__END__
# This file is generated by <%= SCRIPT_NAME %>. Do not edit this file manually.
#
# Seed repo:
<%= capture!(%w{git log --format=#\ %H\ %s}, repo) %>
module SeedRepo
module BigCommit
ID = "913c66a37b4a45b9769037c55c2d238bd0942d2e".freeze
PARENT_ID = "cfe32cf61b73a0d5e9f13e774abde7ff789b1660".freeze
MESSAGE = "Files, encoding and much more".freeze
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze
FILES_COUNT = 2
end
module Commit
ID = "570e7b2abdd848b95f2f578043fc23bd6f6fd24d".freeze
PARENT_ID = "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9".freeze
MESSAGE = "Change some files\n\nSigned-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>\n".freeze
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze
FILES = ["files/ruby/popen.rb", "files/ruby/regex.rb"].freeze
FILES_COUNT = 2
C_FILE_PATH = "files/ruby".freeze
C_FILES = ["popen.rb", "regex.rb", "version_info.rb"].freeze
BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n}.freeze
BLOB_FILE_PATH = "app/views/keys/show.html.haml".freeze
end
module EmptyCommit
ID = "b0e52af38d7ea43cf41d8a6f2471351ac036d6c9".freeze
PARENT_ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze
MESSAGE = "Empty commit".freeze
AUTHOR_FULL_NAME = "Rémy Coutable".freeze
FILES = [].freeze
FILES_COUNT = FILES.count
end
module EncodingCommit
ID = "40f4a7a617393735a95a0bb67b08385bc1e7c66d".freeze
PARENT_ID = "66028349a123e695b589e09a36634d976edcc5e8".freeze
MESSAGE = "Add ISO-8859-encoded file".freeze
AUTHOR_FULL_NAME = "Stan Hu".freeze
FILES = ["encoding/iso8859.txt"].freeze
FILES_COUNT = FILES.count
end
module FirstCommit
ID = "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863".freeze
PARENT_ID = nil
MESSAGE = "Initial commit".freeze
AUTHOR_FULL_NAME = "Dmitriy Zaporozhets".freeze
FILES = ["LICENSE", ".gitignore", "README.md"].freeze
FILES_COUNT = 3
end
module LastCommit
ID = <%= capture!(%w[git show -s --format=%H HEAD], repo).inspect %>.freeze
PARENT_ID = <%= capture!(%w[git show -s --format=%P HEAD], repo).split.last.inspect %>.freeze
MESSAGE = <%= capture!(%w[git show -s --format=%s HEAD], repo).inspect %>.freeze
AUTHOR_FULL_NAME = <%= capture!(%w[git show -s --format=%an HEAD], repo).inspect %>.freeze
FILES = <%=
parents = capture!(%w[git show -s --format=%P HEAD], repo).split
merge_base = parents.size > 1 ? capture!(%w[git merge-base] + parents, repo) : parents.first
capture!( %W[git diff --name-only #{merge_base}..HEAD --], repo).split("\n").inspect
%>.freeze
FILES_COUNT = FILES.count
end
module Repo
HEAD = "master".freeze
BRANCHES = %w[
<%= capture!(%W[git for-each-ref --format=#{' ' * 3}%(refname:strip=2) refs/heads/], repo) %>
].freeze
TAGS = %w[
<%= capture!(%W[git for-each-ref --format=#{' ' * 3}%(refname:strip=2) refs/tags/], repo) %>
].freeze
end
module RubyBlob
ID = "7e3e39ebb9b2bf433b4ad17313770fbe4051649c".freeze
NAME = "popen.rb".freeze
CONTENT = <<-eos.freeze
require 'fileutils'
require 'open3'
module Popen
extend self
def popen(cmd, path=nil)
unless cmd.is_a?(Array)
raise RuntimeError, "System commands must be given as an array of strings"
end
path ||= Dir.pwd
vars = {
"PWD" => path
}
options = {
chdir: path
}
unless File.directory?(path)
FileUtils.mkdir_p(path)
end
@cmd_output = ""
@cmd_status = 0
Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
@cmd_output << stdout.read
@cmd_output << stderr.read
@cmd_status = wait_thr.value.exitstatus
end
return @cmd_output, @cmd_status
end
end
eos
end
end

View File

@ -1 +0,0 @@
ref: refs/heads/master

View File

@ -1,16 +0,0 @@
# Gitlab::Git test repository
This repository is used by (some of) the tests in spec/lib/gitlab/git.
Do not add new large files to this repository. Otherwise we needlessly
inflate the size of the gitlab-ce repository.
## How to make changes to this repository
- (if needed) clone `https://gitlab.com/gitlab-org/gitlab-foss.git` to your local machine
- clone `gitlab-ce/spec/support/gitlab-git-test.git` locally (i.e. clone from your hard drive, not from the internet)
- make changes in your local clone of gitlab-git-test
- run `git push` which will push to your local source `gitlab-ce/spec/support/gitlab-git-test.git`
- in gitlab-ce: run `spec/support/prepare-gitlab-git-test-for-commit`
- in gitlab-ce: `git add spec/support/helpers/seed_repo.rb spec/support/gitlab-git-test.git`
- commit your changes in gitlab-ce

View File

@ -1,7 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = true
precomposeunicode = true
[remote "origin"]
url = https://gitlab.com/gitlab-org/gitlab-git-test.git

View File

@ -1,2 +0,0 @@
x•OËn1 䜯ð 9&O ¡ž¹"õnoYD6ÕýÒª?Ðã¼ì™Òj<C392>;<3B>w»¾ªÂQ £õGrN˜(ÆHPrAÇr<>RÌ7¯ºtpâ²Mì#MœÂ”c´ê…NrsI­
Ž“%Þú½­páÒ>Û«²®pzüÀ<C3BC>¯¹?Y¥Õ3X<33>äBBÌ°GB4ƒ ûpÿ?k®ÔvÛžúy<E2809A>~Wø])[‡¥Áa<þ“ÍCP_

View File

@ -1,2 +0,0 @@
x¥ŽK
Â0Eg<15>NIÒ|ADtè*^ mZ qGîÄ<C3AE>Y×àð8—×ZK©ý®7"ÈFcÒ%oH¢D²Ü9rZÛLÎs“MJ2Œ™=±ÑÒAå…CmeFg²·V<C2B7>¨xI9øH2†¯þXÜJ…ár»pÅ6‡Ï;NÔà8•zˆ?<3F>?>ß+–ù×z¡¹WÆ<57>BÞ ÎÙf·Ç}«þßb¡N@K\SYîì •iSC

View File

@ -1,20 +0,0 @@
# pack-refs with: peeled fully-peeled sorted
0b4bc9a49b562e85de7cc9e834518ea6828729b9 refs/heads/feature
12d65c8dd2b2676fa3ac47d955accc085a37a9c1 refs/heads/fix
6473c90867124755509e100d0d35ebdc85a0b6ae refs/heads/fix-blob-path
58fa1a3af4de73ea83fe25a1ef1db8e0c56f67e5 refs/heads/fix-existing-submodule-dir
40f4a7a617393735a95a0bb67b08385bc1e7c66d refs/heads/fix-mode
9abd6a8c113a2dd76df3fdb3d58a8cec6db75f8d refs/heads/gitattributes
46e1395e609395de004cacd4b142865ab0e52a29 refs/heads/gitattributes-updated
4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6 refs/heads/master
5937ac0a7beb003549fc5fd26fc247adbce4a52e refs/heads/merge-test
9596bc54a6f0c0c98248fe97077eb5ccf48a98d0 refs/heads/missing-gitmodules
4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6 refs/heads/Ääh-test-utf-8
f4e6814c3e4e7a0de82a9e7cd20c626cc963a2f8 refs/tags/v1.0.0
^6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9
8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b refs/tags/v1.1.0
^5937ac0a7beb003549fc5fd26fc247adbce4a52e
10d64eed7760f2811ee2d64b44f1f7d3b364f17b refs/tags/v1.2.0
^eb49186cfa5c4338011f5f590fac11bd66c5c631
2ac1f24e253e08135507d0830508febaaccf02ee refs/tags/v1.2.1
^fa1b1e6c004a68b7d8763b86455da9e6b23e36d6

View File

@ -2,7 +2,9 @@
module GitHelpers
def rugged_repo(repository)
path = File.join(TestEnv.repos_path, repository.disk_path + '.git')
path = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
File.join(TestEnv.repos_path, repository.disk_path + '.git')
end
Rugged::Repository.new(path)
end

View File

@ -1,67 +0,0 @@
# frozen_string_literal: true
require_relative 'test_env'
# This file is specific to specs in spec/lib/gitlab/git/
SEED_STORAGE_PATH = Gitlab::GitalyClient::StorageSettings.allow_disk_access { TestEnv.repos_path }
TEST_REPO_PATH = 'gitlab-git-test.git'
TEST_NORMAL_REPO_PATH = 'not-bare-repo.git'
TEST_MUTABLE_REPO_PATH = 'mutable-repo.git'
TEST_BROKEN_REPO_PATH = 'broken-repo.git'
module SeedHelper
GITLAB_GIT_TEST_REPO_URL = File.expand_path('../gitlab-git-test.git', __dir__)
def ensure_seeds
if File.exist?(SEED_STORAGE_PATH)
FileUtils.rm_r(SEED_STORAGE_PATH)
end
FileUtils.mkdir_p(SEED_STORAGE_PATH)
create_bare_seeds
create_normal_seeds
create_mutable_seeds
create_broken_seeds
end
def create_bare_seeds
system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{GITLAB_GIT_TEST_REPO_URL}),
chdir: SEED_STORAGE_PATH,
out: '/dev/null',
err: '/dev/null')
end
def create_normal_seeds
system(git_env, *%W(#{Gitlab.config.git.bin_path} clone #{TEST_REPO_PATH} #{TEST_NORMAL_REPO_PATH}),
chdir: SEED_STORAGE_PATH,
out: '/dev/null',
err: '/dev/null')
end
def create_mutable_seeds
system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{TEST_REPO_PATH} #{TEST_MUTABLE_REPO_PATH}),
chdir: SEED_STORAGE_PATH,
out: '/dev/null',
err: '/dev/null')
mutable_repo_full_path = File.join(SEED_STORAGE_PATH, TEST_MUTABLE_REPO_PATH)
system(git_env, *%W(#{Gitlab.config.git.bin_path} branch -t feature origin/feature),
chdir: mutable_repo_full_path, out: '/dev/null', err: '/dev/null')
system(git_env, *%W(#{Gitlab.config.git.bin_path} remote add expendable #{GITLAB_GIT_TEST_REPO_URL}),
chdir: mutable_repo_full_path, out: '/dev/null', err: '/dev/null')
end
def create_broken_seeds
system(git_env, *%W(#{Gitlab.config.git.bin_path} clone --bare #{TEST_REPO_PATH} #{TEST_BROKEN_REPO_PATH}),
chdir: SEED_STORAGE_PATH,
out: '/dev/null',
err: '/dev/null')
refs_path = File.join(SEED_STORAGE_PATH, TEST_BROKEN_REPO_PATH, 'refs')
FileUtils.rm_r(refs_path)
end
end

View File

@ -81,7 +81,7 @@ module StubConfiguration
messages['default'] ||= Gitlab.config.repositories.storages.default
messages.each do |storage_name, storage_hash|
if !storage_hash.key?('path') || storage_hash['path'] == Gitlab::GitalyClient::StorageSettings::Deprecated
storage_hash['path'] = TestEnv.repos_path
storage_hash['path'] = Gitlab::GitalyClient::StorageSettings.allow_disk_access { TestEnv.repos_path }
end
messages[storage_name] = Gitlab::GitalyClient::StorageSettings.new(storage_hash.to_h)

View File

@ -81,6 +81,12 @@ module StubObjectStorage
**params)
end
def stub_rpm_repository_file_object_storage(**params)
stub_object_storage_uploader(config: Gitlab.config.packages.object_store,
uploader: ::Packages::Rpm::RepositoryFileUploader,
**params)
end
def stub_composer_cache_object_storage(**params)
stub_object_storage_uploader(config: Gitlab.config.packages.object_store,
uploader: ::Packages::Composer::CacheUploader,

View File

@ -348,6 +348,14 @@ module TestEnv
Capybara.current_session.visit '/'
end
def factory_repo_path
@factory_repo_path ||= Rails.root.join('tmp', 'tests', factory_repo_name)
end
def forked_repo_path
@forked_repo_path ||= Rails.root.join('tmp', 'tests', forked_repo_name)
end
def factory_repo_bundle_path
"#{factory_repo_path}.bundle"
end
@ -377,18 +385,10 @@ module TestEnv
]
end
def factory_repo_path
@factory_repo_path ||= Rails.root.join('tmp', 'tests', factory_repo_name)
end
def factory_repo_name
'gitlab-test'
end
def forked_repo_path
@forked_repo_path ||= Rails.root.join('tmp', 'tests', forked_repo_name)
end
def forked_repo_name
'gitlab-test-fork'
end

View File

@ -1,18 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
abort unless [
system('spec/support/generate-seed-repo-rb', out: 'spec/support/helpers/seed_repo.rb'),
system('spec/support/unpack-gitlab-git-test')
].all?
exit if ARGV.first != '--check-for-changes'
git_status = IO.popen(%w[git status --porcelain], &:read)
abort unless $?.success?
puts git_status
if git_status.lines.grep(%r{^.. spec/support/gitlab-git-test.git}).any?
abort "error: detected changes in gitlab-git-test.git"
end

View File

@ -862,7 +862,7 @@ RSpec.shared_examples 'wiki model' do
end
describe '#create_wiki_repository' do
let(:head_path) { Rails.root.join(TestEnv.repos_path, "#{wiki.disk_path}.git", 'HEAD') }
let(:head_path) { Gitlab::GitalyClient::StorageSettings.allow_disk_access { Rails.root.join(TestEnv.repos_path, "#{wiki.disk_path}.git", 'HEAD') } }
let(:default_branch) { 'foo' }
before do

View File

@ -1,40 +0,0 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'fileutils'
REPO = 'spec/support/gitlab-git-test.git'
PACK_DIR = REPO + '/objects/pack'
GIT = %W[git --git-dir=#{REPO}].freeze
BASE_PACK = 'pack-691247af2a6acb0b63b73ac0cb90540e93614043'
def main
unpack
# We want to store the refs in a packed-refs file because if we don't
# they can get mangled by filesystems.
abort unless system(*GIT, *%w[pack-refs --all])
abort unless system(*GIT, 'fsck')
end
# We don't want contributors to commit new pack files because those
# create unnecessary churn.
def unpack
pack_files = Dir[File.join(PACK_DIR, '*')].reject do |pack|
pack.start_with?(File.join(PACK_DIR, BASE_PACK))
end
return if pack_files.empty?
pack_files.each do |pack|
unless pack.end_with?('.pack')
FileUtils.rm(pack)
next
end
File.open(pack, 'rb') do |open_pack|
File.unlink(pack)
abort unless system(*GIT, 'unpack-objects', in: open_pack)
end
end
end
main

View File

@ -0,0 +1,45 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Packages::Rpm::RepositoryFileUploader do
let_it_be(:repository_file) { create(:rpm_repository_file) }
let(:uploader) { described_class.new(repository_file, :file) }
let(:path) { Gitlab.config.packages.storage_path }
subject { uploader }
it_behaves_like 'builds correct paths',
store_dir: %r[^\h{2}/\h{2}/\h{64}/projects/\d+/rpm/repository_files/\d+$],
cache_dir: %r{/packages/tmp/cache},
work_dir: %r{/packages/tmp/work}
context 'when object store is remote' do
before do
stub_rpm_repository_file_object_storage
end
include_context 'with storage', described_class::Store::REMOTE
it_behaves_like 'builds correct paths',
store_dir: %r[^\h{2}/\h{2}/\h{64}/projects/\d+/rpm/repository_files/\d+$]
end
describe 'remote file' do
let(:repository_file) { create(:rpm_repository_file, :object_storage) }
context 'with object storage enabled' do
before do
stub_rpm_repository_file_object_storage
end
it 'can store file remotely' do
allow(ObjectStorage::BackgroundMoveWorker).to receive(:perform_async)
repository_file
expect(repository_file.file_store).to eq(described_class::Store::REMOTE)
expect(repository_file.file.path).not_to be_blank
end
end
end
end

View File

@ -0,0 +1,34 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'projects/merge_requests/_close_reopen_draft_report_toggle.html.haml' do
let_it_be(:merge_request) { create(:merge_request, state: :merged) }
before do
assign(:merge_request, merge_request)
assign(:project, merge_request.target_project)
allow(view).to receive(:moved_mr_sidebar_enabled?).and_return(true)
end
describe 'notifcations toggle' do
context 'when mr merged and logged in' do
it 'is present' do
allow(view).to receive(:current_user).and_return(merge_request.author)
render
expect(rendered).to have_css('li', class: 'js-sidebar-subscriptions-entry-point')
end
end
context 'when mr merged and not logged in' do
it 'is not present' do
render
expect(rendered).not_to have_css('li', class: 'js-sidebar-subscriptions-entry-point')
end
end
end
end

View File

@ -115,7 +115,9 @@ RSpec.describe RepositoryForkWorker do
context 'project ID, storage and repo paths passed' do
def perform!
subject.perform(forked_project.id, TestEnv.repos_path, project.disk_path)
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
subject.perform(forked_project.id, TestEnv.repos_path, project.disk_path)
end
end
it_behaves_like 'RepositoryForkWorker performing'

View File

@ -1074,10 +1074,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.4.0.tgz#cfc8319e259e5914ad0f48ee0ab6e0eec75d03da"
integrity sha512-myCYbjViOI2k6oHGRqL1iKaMKbYvPqWL6tYZ07QkUKziVz5kYjECWk5c0Qp6yu9NsFAMWuow5PkR3oFTGBHmbg==
"@gitlab/ui@43.20.0":
version "43.20.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-43.20.0.tgz#f57b0ea8b01317a383695061f185acb7c92447d9"
integrity sha512-ck1gXmWTh6vNSpz9QzCt9Lv9Twvj+BRGkiNexICOB3j9Y6UZbTdBKANu1eiGZnM+kh0v2z3H3Cbo3f95hwywqA==
"@gitlab/ui@43.21.0":
version "43.21.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-43.21.0.tgz#189094170c7ff0545685eaed3a4c4c55ead915e3"
integrity sha512-jKuZ3AGFfAA5UEOXxGaSxb2NHplLTcRJbbR+bl6/9ggGhoyGPhgl74WzX87ejDNVooY4vvWGGRzGJhN1NgDM+w==
dependencies:
"@popperjs/core" "^2.11.2"
bootstrap-vue "2.20.1"
@ -3802,10 +3802,10 @@ core-js-pure@^3.0.0:
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813"
integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==
core-js@^3.25.2:
version "3.25.2"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.25.2.tgz#2d3670c1455432b53fa780300a6fc1bd8304932c"
integrity sha512-YB4IAT1bjEfxTJ1XYy11hJAKskO+qmhuDBM8/guIfMz4JvdsAQAqvyb97zXX7JgSrfPLG5mRGFWJwJD39ruq2A==
core-js@^3.25.4:
version "3.25.4"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.25.4.tgz#76f6bc330a79aafbaf77e9645293351ea5d09b5b"
integrity sha512-JDLxg61lFPFYQ7U0HKoyKwVUV63VbbVTb/K73Yf+k4Mf4ZBZxCjfyrWZjTk1ZM7ZrgFSqhSIOmuzYAxG2f/reQ==
core-util-is@~1.0.0:
version "1.0.3"