Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
335dc0be1f
commit
acda833a93
29 changed files with 76 additions and 52 deletions
|
@ -1273,9 +1273,9 @@ GEM
|
||||||
fugit (~> 1.1)
|
fugit (~> 1.1)
|
||||||
sidekiq (>= 4.2.1)
|
sidekiq (>= 4.2.1)
|
||||||
sigdump (0.2.4)
|
sigdump (0.2.4)
|
||||||
signet (0.14.0)
|
signet (0.17.0)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.8)
|
||||||
faraday (>= 0.17.3, < 2.0)
|
faraday (>= 0.17.5, < 3.a)
|
||||||
jwt (>= 1.5, < 3.0)
|
jwt (>= 1.5, < 3.0)
|
||||||
multi_json (~> 1.10)
|
multi_json (~> 1.10)
|
||||||
simple_po_parser (1.1.6)
|
simple_po_parser (1.1.6)
|
||||||
|
|
|
@ -235,7 +235,7 @@ export default {
|
||||||
:fields="fields"
|
:fields="fields"
|
||||||
fixed
|
fixed
|
||||||
stacked="md"
|
stacked="md"
|
||||||
class="qa-clusters-table gl-mb-4!"
|
class="gl-mb-4!"
|
||||||
data-testid="cluster_list_table"
|
data-testid="cluster_list_table"
|
||||||
>
|
>
|
||||||
<template #cell(name)="{ item }">
|
<template #cell(name)="{ item }">
|
||||||
|
|
|
@ -290,7 +290,6 @@ export default {
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<reply-placeholder
|
<reply-placeholder
|
||||||
v-if="!isFormVisible"
|
v-if="!isFormVisible"
|
||||||
class="qa-discussion-reply"
|
|
||||||
:placeholder-text="__('Reply…')"
|
:placeholder-text="__('Reply…')"
|
||||||
@focus="showForm"
|
@focus="showForm"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -372,7 +372,7 @@ export default {
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-show="hasDesigns"
|
v-show="hasDesigns"
|
||||||
class="qa-selector-toolbar gl-display-flex gl-align-items-center gl-my-2"
|
class="gl-display-flex gl-align-items-center gl-my-2"
|
||||||
data-testid="design-selector-toolbar"
|
data-testid="design-selector-toolbar"
|
||||||
>
|
>
|
||||||
<gl-button
|
<gl-button
|
||||||
|
|
|
@ -627,7 +627,7 @@ export default {
|
||||||
:title="model.name"
|
:title="model.name"
|
||||||
class="environment-name table-mobile-content"
|
class="environment-name table-mobile-content"
|
||||||
>
|
>
|
||||||
<a class="qa-environment-link" :href="environmentPath">
|
<a data-qa-selector="environment_link" :href="environmentPath">
|
||||||
<span v-if="model.size === 1">{{ model.name }}</span>
|
<span v-if="model.size === 1">{{ model.name }}</span>
|
||||||
<span v-else>{{ model.name_without_type }}</span>
|
<span v-else>{{ model.name_without_type }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="groups-list-tree-container qa-groups-list-tree-container">
|
<div class="groups-list-tree-container" data-qa-selector="groups_list_tree_container">
|
||||||
<div
|
<div
|
||||||
v-if="searchEmpty"
|
v-if="searchEmpty"
|
||||||
class="has-no-search-results gl-font-style-italic gl-text-center gl-text-gray-600 gl-p-5"
|
class="has-no-search-results gl-font-style-italic gl-text-center gl-text-gray-600 gl-p-5"
|
||||||
|
|
|
@ -70,7 +70,6 @@ export default {
|
||||||
<input type="hidden" name="new_parent_group_id" :value="selectedId" />
|
<input type="hidden" name="new_parent_group_id" :value="selectedId" />
|
||||||
</gl-form-group>
|
</gl-form-group>
|
||||||
<confirm-danger
|
<confirm-danger
|
||||||
button-class="qa-transfer-button"
|
|
||||||
:disabled="disableSubmitButton"
|
:disabled="disableSubmitButton"
|
||||||
:phrase="confirmationPhrase"
|
:phrase="confirmationPhrase"
|
||||||
:button-text="confirmButtonText"
|
:button-text="confirmButtonText"
|
||||||
|
|
|
@ -156,7 +156,7 @@ export default {
|
||||||
category="primary"
|
category="primary"
|
||||||
variant="confirm"
|
variant="confirm"
|
||||||
block
|
block
|
||||||
class="qa-begin-commit-button"
|
data-qa-selector="begin_commit_button"
|
||||||
data-testid="begin-commit-button"
|
data-testid="begin-commit-button"
|
||||||
@click="beginCommit"
|
@click="beginCommit"
|
||||||
>
|
>
|
||||||
|
@ -184,7 +184,7 @@ export default {
|
||||||
:disabled="commitButtonDisabled"
|
:disabled="commitButtonDisabled"
|
||||||
:loading="submitCommitLoading"
|
:loading="submitCommitLoading"
|
||||||
data-testid="commit-button"
|
data-testid="commit-button"
|
||||||
class="qa-commit-button"
|
data-qa-selector="commit_button"
|
||||||
category="primary"
|
category="primary"
|
||||||
variant="confirm"
|
variant="confirm"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|
|
@ -80,7 +80,9 @@ export default {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="gl-display-flex gl-align-items-center ide-file-templates qa-file-templates-bar gl-relative gl-z-index-1"
|
class="gl-display-flex gl-align-items-center ide-file-templates gl-relative gl-z-index-1"
|
||||||
|
data-testid="file-templates-bar"
|
||||||
|
data-qa-selector="file_templates_container"
|
||||||
>
|
>
|
||||||
<strong class="gl-mr-3"> {{ $options.i18n.barLabel }} </strong>
|
<strong class="gl-mr-3"> {{ $options.i18n.barLabel }} </strong>
|
||||||
<gl-dropdown
|
<gl-dropdown
|
||||||
|
@ -97,7 +99,8 @@ export default {
|
||||||
</gl-dropdown>
|
</gl-dropdown>
|
||||||
<gl-dropdown
|
<gl-dropdown
|
||||||
v-if="showTemplatesDropdown"
|
v-if="showTemplatesDropdown"
|
||||||
class="gl-mr-6 qa-file-template-dropdown"
|
class="gl-mr-6"
|
||||||
|
data-qa-selector="file_template_dropdown"
|
||||||
:text="$options.i18n.templateListDropdownLabel"
|
:text="$options.i18n.templateListDropdownLabel"
|
||||||
@show="fetchTemplateTypes"
|
@show="fetchTemplateTypes"
|
||||||
>
|
>
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="ide-file-list qa-file-list">
|
<div class="ide-file-list" data-qa-selector="file_list_container">
|
||||||
<template v-if="showLoading">
|
<template v-if="showLoading">
|
||||||
<div v-for="n in 3" :key="n" class="multi-file-loading-container">
|
<div v-for="n in 3" :key="n" class="multi-file-loading-container">
|
||||||
<gl-skeleton-loader />
|
<gl-skeleton-loader />
|
||||||
|
|
|
@ -57,7 +57,6 @@ export default {
|
||||||
/>
|
/>
|
||||||
</gl-form-group>
|
</gl-form-group>
|
||||||
<confirm-danger
|
<confirm-danger
|
||||||
button-class="qa-transfer-button"
|
|
||||||
:disabled="!hasSelectedNamespace"
|
:disabled="!hasSelectedNamespace"
|
||||||
:phrase="confirmationPhrase"
|
:phrase="confirmationPhrase"
|
||||||
:button-text="confirmButtonText"
|
:button-text="confirmButtonText"
|
||||||
|
|
|
@ -53,6 +53,7 @@ export default {
|
||||||
:variant="buttonVariant"
|
:variant="buttonVariant"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:data-testid="buttonTestid"
|
:data-testid="buttonTestid"
|
||||||
|
data-qa-selector="confirm_danger_button"
|
||||||
>{{ buttonText }}</gl-button
|
>{{ buttonText }}</gl-button
|
||||||
>
|
>
|
||||||
<confirm-danger-modal
|
<confirm-danger-modal
|
||||||
|
|
|
@ -66,7 +66,13 @@ export default {
|
||||||
actionPrimary() {
|
actionPrimary() {
|
||||||
return {
|
return {
|
||||||
text: this.confirmButtonText,
|
text: this.confirmButtonText,
|
||||||
attributes: [{ variant: 'danger', disabled: !this.isValid, class: 'qa-confirm-button' }],
|
attributes: [
|
||||||
|
{
|
||||||
|
variant: 'danger',
|
||||||
|
disabled: !this.isValid,
|
||||||
|
'data-qa-selector': 'confirm_danger_modal_button',
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
actionCancel() {
|
actionCancel() {
|
||||||
|
@ -122,7 +128,8 @@ export default {
|
||||||
<gl-form-input
|
<gl-form-input
|
||||||
id="confirm_name_input"
|
id="confirm_name_input"
|
||||||
v-model="confirmationPhrase"
|
v-model="confirmationPhrase"
|
||||||
class="form-control qa-confirm-input"
|
class="form-control"
|
||||||
|
data-qa-selector="confirm_danger_field"
|
||||||
data-testid="confirm-danger-input"
|
data-testid="confirm-danger-input"
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.form-actions.gl-display-flex
|
.form-actions.gl-display-flex
|
||||||
= render Pajamas::ButtonComponent.new(type: :submit, variant: :confirm, button_options: { id: 'commit-changes', class: 'js-commit-button qa-commit-button' }) do
|
= render Pajamas::ButtonComponent.new(type: :submit, variant: :confirm, button_options: { id: 'commit-changes', class: 'js-commit-button', data: { qa_selector: 'commit_button' } }) do
|
||||||
= _('Commit changes')
|
= _('Commit changes')
|
||||||
|
|
||||||
= render Pajamas::ButtonComponent.new(href: cancel_path, button_options: { class: 'gl-ml-3', id: 'cancel-changes', aria: { label: _('Discard changes') }, data: { confirm: leave_edit_message, confirm_btn_variant: "danger" } }) do
|
= render Pajamas::ButtonComponent.new(href: cancel_path, button_options: { class: 'gl-ml-3', id: 'cancel-changes', aria: { label: _('Discard changes') }, data: { confirm: leave_edit_message, confirm_btn_variant: "danger" } }) do
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
%label{ for: "confirm_path_input" }
|
%label{ for: "confirm_path_input" }
|
||||||
= _("To confirm, type %{phrase_code}").html_safe % { phrase_code: '<code class="js-legacy-confirm-danger-match">%{phrase_name}</code>'.html_safe % { phrase_name: @project.full_path } }
|
= _("To confirm, type %{phrase_code}").html_safe % { phrase_code: '<code class="js-legacy-confirm-danger-match">%{phrase_name}</code>'.html_safe % { phrase_name: @project.full_path } }
|
||||||
.form-group
|
.form-group
|
||||||
= text_field_tag 'confirm_path_input', '', class: 'form-control js-legacy-confirm-danger-input qa-confirm-input'
|
= text_field_tag 'confirm_path_input', '', class: 'form-control js-legacy-confirm-danger-input'
|
||||||
.form-actions
|
.form-actions
|
||||||
%button.btn.gl-button.btn-default.gl-mr-4{ type: "button", "data-dismiss": "modal" }
|
%button.btn.gl-button.btn-default.gl-mr-4{ type: "button", "data-dismiss": "modal" }
|
||||||
= _('Cancel')
|
= _('Cancel')
|
||||||
= submit_tag _('Reduce project visibility'), class: "btn gl-button btn-danger js-legacy-confirm-danger-submit qa-confirm-button", disabled: true
|
= submit_tag _('Reduce project visibility'), class: "btn gl-button btn-danger js-legacy-confirm-danger-submit", disabled: true
|
||||||
|
|
|
@ -12,21 +12,26 @@ module QA
|
||||||
base.view 'app/assets/javascripts/lib/utils/confirm_via_gl_modal/confirm_modal.vue' do
|
base.view 'app/assets/javascripts/lib/utils/confirm_via_gl_modal/confirm_modal.vue' do
|
||||||
element :confirm_ok_button
|
element :confirm_ok_button
|
||||||
end
|
end
|
||||||
|
|
||||||
|
base.view 'app/assets/javascripts/vue_shared/components/confirm_danger/confirm_danger_modal.vue' do
|
||||||
|
element :confirm_danger_modal_button
|
||||||
|
element :confirm_danger_field
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fill_confirmation_text(text)
|
def fill_confirmation_text(text)
|
||||||
fill_element(:confirm_input, text)
|
fill_element(:confirm_danger_field, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
def wait_for_confirm_button_enabled
|
def wait_for_confirm_button_enabled
|
||||||
wait_until(reload: false) do
|
wait_until(reload: false) do
|
||||||
!find_element(:confirm_button).disabled?
|
!find_element(:confirm_danger_modal_button).disabled?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm_transfer
|
def confirm_transfer
|
||||||
wait_for_confirm_button_enabled
|
wait_for_confirm_button_enabled
|
||||||
click_element(:confirm_button)
|
click_element(:confirm_danger_modal_button)
|
||||||
end
|
end
|
||||||
|
|
||||||
def click_confirmation_ok_button
|
def click_confirmation_ok_button
|
||||||
|
|
|
@ -8,6 +8,10 @@ module QA
|
||||||
include QA::Page::Component::ConfirmModal
|
include QA::Page::Component::ConfirmModal
|
||||||
include Component::NamespaceSelect
|
include Component::NamespaceSelect
|
||||||
|
|
||||||
|
view 'app/assets/javascripts/vue_shared/components/confirm_danger/confirm_danger.vue' do
|
||||||
|
element :confirm_danger_button
|
||||||
|
end
|
||||||
|
|
||||||
view 'app/views/projects/edit.html.haml' do
|
view 'app/views/projects/edit.html.haml' do
|
||||||
element :project_path_field
|
element :project_path_field
|
||||||
element :change_path_button
|
element :change_path_button
|
||||||
|
@ -47,7 +51,7 @@ module QA
|
||||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/218965
|
# https://gitlab.com/gitlab-org/gitlab/-/issues/218965
|
||||||
select_namespace(namespace.gsub(%r{([^\s])/([^\s])}, '\1 / \2'))
|
select_namespace(namespace.gsub(%r{([^\s])/([^\s])}, '\1 / \2'))
|
||||||
|
|
||||||
click_element(:transfer_button)
|
click_element(:confirm_danger_button)
|
||||||
fill_confirmation_text(project_name)
|
fill_confirmation_text(project_name)
|
||||||
confirm_transfer
|
confirm_transfer
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,11 +24,11 @@ module QA
|
||||||
end
|
end
|
||||||
|
|
||||||
view 'app/assets/javascripts/ide/components/ide_tree_list.vue' do
|
view 'app/assets/javascripts/ide/components/ide_tree_list.vue' do
|
||||||
element :file_list
|
element :file_list_container
|
||||||
end
|
end
|
||||||
|
|
||||||
view 'app/assets/javascripts/ide/components/file_templates/bar.vue' do
|
view 'app/assets/javascripts/ide/components/file_templates/bar.vue' do
|
||||||
element :file_templates_bar
|
element :file_templates_container
|
||||||
element :file_template_dropdown
|
element :file_template_dropdown
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ module QA
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_file?(file_name)
|
def has_file?(file_name)
|
||||||
within_element(:file_list) do
|
within_element(:file_list_container) do
|
||||||
has_element?(:file_name_content, file_name: file_name)
|
has_element?(:file_name_content, file_name: file_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -173,7 +173,7 @@ module QA
|
||||||
has_no_element?(:new_file_modal)
|
has_no_element?(:new_file_modal)
|
||||||
|
|
||||||
wait_until(reload: false) do
|
wait_until(reload: false) do
|
||||||
within_element(:file_templates_bar) do
|
within_element(:file_templates_container) do
|
||||||
click_element :file_template_dropdown
|
click_element :file_template_dropdown
|
||||||
fill_element :dropdown_filter_input, template
|
fill_element :dropdown_filter_input, template
|
||||||
|
|
||||||
|
@ -291,12 +291,12 @@ module QA
|
||||||
click_element(:fork_project_button)
|
click_element(:fork_project_button)
|
||||||
# wait for the fork to be created
|
# wait for the fork to be created
|
||||||
wait_until(reload: true) do
|
wait_until(reload: true) do
|
||||||
has_element?(:file_list)
|
has_element?(:file_list_container)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_file(file_path)
|
def upload_file(file_path)
|
||||||
within_element(:file_list) do
|
within_element(:file_list_container) do
|
||||||
find_element(:file_upload_field, visible: false).send_keys(file_path)
|
find_element(:file_upload_field, visible: false).send_keys(file_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ RSpec.describe 'Projects > Files > Project owner sees a link to create a license
|
||||||
|
|
||||||
expect(page).to have_current_path("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE", ignore_query: true)
|
expect(page).to have_current_path("/-/ide/project/#{project.full_path}/edit/master/-/LICENSE", ignore_query: true)
|
||||||
|
|
||||||
expect(page).to have_selector('.qa-file-templates-bar') # rubocop:disable QA/SelectorUsage
|
expect(page).to have_selector('[data-testid="file-templates-bar"]')
|
||||||
|
|
||||||
select_template('MIT License')
|
select_template('MIT License')
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ RSpec.describe 'Multi-file editor new directory', :js do
|
||||||
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
|
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
|
||||||
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
|
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
|
||||||
# taller (as it is by default with chrome headless) then the button will not exist.
|
# taller (as it is by default with chrome headless) then the button will not exist.
|
||||||
if page.has_css?('.qa-begin-commit-button') # rubocop:disable QA/SelectorUsage
|
if page.has_css?('[data-testid="begin-commit-button"]')
|
||||||
find('.qa-begin-commit-button').click # rubocop:disable QA/SelectorUsage
|
find('[data-testid="begin-commit-button"]').click
|
||||||
end
|
end
|
||||||
|
|
||||||
fill_in('commit-message', with: 'commit message ide')
|
fill_in('commit-message', with: 'commit message ide')
|
||||||
|
|
|
@ -39,8 +39,8 @@ RSpec.describe 'Multi-file editor new file', :js do
|
||||||
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
|
# Compact mode depends on the size of window. If it is shorter than MAX_WINDOW_HEIGHT_COMPACT,
|
||||||
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
|
# (as it is with WEBDRIVER_HEADLESS=0), this initial commit button will exist. Otherwise, if it is
|
||||||
# taller (as it is by default with chrome headless) then the button will not exist.
|
# taller (as it is by default with chrome headless) then the button will not exist.
|
||||||
if page.has_css?('.qa-begin-commit-button') # rubocop:disable QA/SelectorUsage
|
if page.has_css?('[data-testid="begin-commit-button"]')
|
||||||
find('.qa-begin-commit-button').click # rubocop:disable QA/SelectorUsage
|
find('[data-testid="begin-commit-button"]').click
|
||||||
end
|
end
|
||||||
|
|
||||||
fill_in('commit-message', with: 'commit message ide')
|
fill_in('commit-message', with: 'commit message ide')
|
||||||
|
|
|
@ -82,7 +82,6 @@ describe('Transfer group form', () => {
|
||||||
|
|
||||||
it('sets the confirm danger properties', () => {
|
it('sets the confirm danger properties', () => {
|
||||||
expect(findConfirmDanger().props()).toMatchObject({
|
expect(findConfirmDanger().props()).toMatchObject({
|
||||||
buttonClass: 'qa-transfer-button',
|
|
||||||
disabled: true,
|
disabled: true,
|
||||||
buttonText: confirmButtonText,
|
buttonText: confirmButtonText,
|
||||||
phrase: confirmationPhrase,
|
phrase: confirmationPhrase,
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
|
|
||||||
RSpec.describe Gitlab::Git::Tree, :seed_helper do
|
RSpec.describe Gitlab::Git::Tree do
|
||||||
let_it_be(:user) { create(:user) }
|
let_it_be(:user) { create(:user) }
|
||||||
|
|
||||||
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '', 'group/project') }
|
let(:project) { create(:project, :repository) }
|
||||||
|
let(:repository) { project.repository.raw }
|
||||||
|
|
||||||
shared_examples :repo do
|
shared_examples :repo do
|
||||||
subject(:tree) { Gitlab::Git::Tree.where(repository, sha, path, recursive, pagination_params) }
|
subject(:tree) { Gitlab::Git::Tree.where(repository, sha, path, recursive, pagination_params) }
|
||||||
|
@ -105,10 +106,6 @@ RSpec.describe Gitlab::Git::Tree, :seed_helper do
|
||||||
).newrev
|
).newrev
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
|
||||||
ensure_seeds
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(subdir_file.flat_path).to eq('files/flat/path/correct') }
|
it { expect(subdir_file.flat_path).to eq('files/flat/path/correct') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -135,7 +135,7 @@ RSpec.describe PagesDomains::ObtainLetsEncryptCertificateService do
|
||||||
cert.add_extension ef.create_extension("authorityKeyIdentifier",
|
cert.add_extension ef.create_extension("authorityKeyIdentifier",
|
||||||
"keyid:always,issuer:always")
|
"keyid:always,issuer:always")
|
||||||
|
|
||||||
cert.sign key, OpenSSL::Digest.new('SHA1')
|
cert.sign key, OpenSSL::Digest.new('SHA256')
|
||||||
|
|
||||||
cert.to_pem
|
cert.to_pem
|
||||||
end
|
end
|
||||||
|
|
|
@ -391,6 +391,11 @@ RSpec.configure do |config|
|
||||||
Gitlab::WithRequestStore.with_request_store { example.run }
|
Gitlab::WithRequestStore.with_request_store { example.run }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.around(:example, :enable_rugged) do |example|
|
||||||
|
# Skip tests that need rugged when using praefect DB.
|
||||||
|
example.run unless GitalySetup.praefect_with_db?
|
||||||
|
end
|
||||||
|
|
||||||
# previous test runs may have left some resources throttled
|
# previous test runs may have left some resources throttled
|
||||||
config.before do
|
config.before do
|
||||||
::Gitlab::ExclusiveLease.reset_all!("el:throttle:*")
|
::Gitlab::ExclusiveLease.reset_all!("el:throttle:*")
|
||||||
|
|
|
@ -12,6 +12,8 @@ require 'logger'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'bundler'
|
require 'bundler'
|
||||||
|
|
||||||
|
require_relative '../../../lib/gitlab/utils'
|
||||||
|
|
||||||
module GitalySetup
|
module GitalySetup
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
|
@ -139,7 +141,7 @@ module GitalySetup
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_praefect
|
def start_praefect
|
||||||
if ENV['GITALY_PRAEFECT_WITH_DB']
|
if praefect_with_db?
|
||||||
LOGGER.debug 'Starting Praefect with database election strategy'
|
LOGGER.debug 'Starting Praefect with database election strategy'
|
||||||
start(:praefect, File.join(tmp_tests_gitaly_dir, 'praefect-db.config.toml'))
|
start(:praefect, File.join(tmp_tests_gitaly_dir, 'praefect-db.config.toml'))
|
||||||
else
|
else
|
||||||
|
@ -290,7 +292,7 @@ module GitalySetup
|
||||||
|
|
||||||
# In CI we need to pre-generate both config files.
|
# In CI we need to pre-generate both config files.
|
||||||
# For local testing we'll create the correct file on-demand.
|
# For local testing we'll create the correct file on-demand.
|
||||||
if ENV['CI'] || ENV['GITALY_PRAEFECT_WITH_DB'].nil?
|
if ENV['CI'] || !praefect_with_db?
|
||||||
Gitlab::SetupHelper::Praefect.create_configuration(
|
Gitlab::SetupHelper::Praefect.create_configuration(
|
||||||
gitaly_dir,
|
gitaly_dir,
|
||||||
{ 'praefect' => repos_path },
|
{ 'praefect' => repos_path },
|
||||||
|
@ -298,7 +300,7 @@ module GitalySetup
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV['CI'] || ENV['GITALY_PRAEFECT_WITH_DB']
|
if ENV['CI'] || praefect_with_db?
|
||||||
Gitlab::SetupHelper::Praefect.create_configuration(
|
Gitlab::SetupHelper::Praefect.create_configuration(
|
||||||
gitaly_dir,
|
gitaly_dir,
|
||||||
{ 'praefect' => repos_path },
|
{ 'praefect' => repos_path },
|
||||||
|
@ -319,7 +321,7 @@ module GitalySetup
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_praefect
|
def setup_praefect
|
||||||
return unless ENV['GITALY_PRAEFECT_WITH_DB']
|
return unless praefect_with_db?
|
||||||
|
|
||||||
migrate_cmd = service_cmd(:praefect, File.join(tmp_tests_gitaly_dir, 'praefect-db.config.toml')) + ['sql-migrate']
|
migrate_cmd = service_cmd(:praefect, File.join(tmp_tests_gitaly_dir, 'praefect-db.config.toml')) + ['sql-migrate']
|
||||||
system(env, *migrate_cmd, [:out, :err] => 'log/praefect-test.log')
|
system(env, *migrate_cmd, [:out, :err] => 'log/praefect-test.log')
|
||||||
|
@ -396,4 +398,8 @@ module GitalySetup
|
||||||
def praefect_binary
|
def praefect_binary
|
||||||
File.join(tmp_tests_gitaly_dir, "_build", "bin", "praefect")
|
File.join(tmp_tests_gitaly_dir, "_build", "bin", "praefect")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def praefect_with_db?
|
||||||
|
Gitlab::Utils.to_boolean(ENV['GITALY_PRAEFECT_WITH_DB'], default: false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Expects usage of 'incident settings enabled' context.
|
# Expects usage of 'incident management settings enabled' context.
|
||||||
#
|
#
|
||||||
# This shared_example includes the following option:
|
# This shared_example includes the following option:
|
||||||
# - with_issue: includes a test for when the defined `alert` has an associated issue
|
# - with_issue: includes a test for when the defined `alert` has an associated issue
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
# This shared_example requires the following variables:
|
# This shared_example requires the following variables:
|
||||||
# - `alert`, required if :with_issue is true
|
# - `alert`, required if :with_issue is true
|
||||||
RSpec.shared_examples 'processes incident issues if enabled' do |with_issue: false|
|
RSpec.shared_examples 'processes incident issues if enabled' do |with_issue: false|
|
||||||
include_examples 'processes incident issues', with_issue
|
include_examples 'processes incident issues', with_issue: with_issue
|
||||||
|
|
||||||
context 'with incident setting disabled' do
|
context 'with incident setting disabled' do
|
||||||
let(:create_issue) { false }
|
let(:create_issue) { false }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Expects usage of 'incident settings enabled' context.
|
# Expects usage of 'incident management settings enabled' context.
|
||||||
#
|
#
|
||||||
# This shared_example requires the following variables:
|
# This shared_example requires the following variables:
|
||||||
# - `alert`, alert for which related incidents should be closed
|
# - `alert`, alert for which related incidents should be closed
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Expects usage of 'incident settings enabled' context.
|
# Expects usage of 'incident management settings enabled' context.
|
||||||
#
|
#
|
||||||
# This shared_example includes the following option:
|
# This shared_example includes the following option:
|
||||||
# - count: number of notifications expected to be sent
|
# - count: number of notifications expected to be sent
|
||||||
RSpec.shared_examples 'sends alert notification emails if enabled' do |count: 1|
|
RSpec.shared_examples 'sends alert notification emails if enabled' do |count: 1|
|
||||||
include_examples 'sends alert notification emails', count
|
include_examples 'sends alert notification emails', count: count
|
||||||
|
|
||||||
context 'with email setting disabled' do
|
context 'with email setting disabled' do
|
||||||
let(:send_email) { false }
|
let(:send_email) { false }
|
||||||
|
|
Loading…
Reference in a new issue