summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-13 09:13:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-13 09:13:39 +0000
commitbfd344aeac677543c2a2f623fd103d4cf0f4e247 (patch)
treeb798e8174a0519a31b97bcd7d2dab8258d0520aa /spec
parent2baf0eca39c55603848b667087cfd0471c5ac9bb (diff)
downloadgitlab-ce-bfd344aeac677543c2a2f623fd103d4cf0f4e247.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/design_management/designs.rb2
-rw-r--r--spec/factories/design_management/versions.rb4
-rw-r--r--spec/features/projects/settings/webhooks_settings_spec.rb6
-rw-r--r--spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js3
-rw-r--r--spec/frontend/pipelines/pipelines_table_spec.js8
-rw-r--r--spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js27
-rw-r--r--spec/lib/gitlab/git/branch_spec.rb2
-rw-r--r--spec/lib/gitlab/git/cross_repo_comparer_spec.rb2
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb32
-rw-r--r--spec/lib/gitlab/git/tree_spec.rb2
-rw-r--r--spec/models/ci/build_dependencies_spec.rb23
-rw-r--r--spec/models/projects/build_artifacts_size_refresh_spec.rb12
-rw-r--r--spec/models/snippet_repository_spec.rb8
-rw-r--r--spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb6
-rw-r--r--spec/services/git/branch_hooks_service_spec.rb2
-rw-r--r--spec/support/shared_examples/requests/api/snippets_shared_examples.rb2
16 files changed, 101 insertions, 40 deletions
diff --git a/spec/factories/design_management/designs.rb b/spec/factories/design_management/designs.rb
index 56a1b55b969..3d95c754a96 100644
--- a/spec/factories/design_management/designs.rb
+++ b/spec/factories/design_management/designs.rb
@@ -109,7 +109,7 @@ FactoryBot.define do
repository = project.design_repository
commit_version = ->(action) do
- repository.multi_action(
+ repository.commit_files(
evaluator.author,
branch_name: 'master',
message: "#{action.action} for #{design.filename}",
diff --git a/spec/factories/design_management/versions.rb b/spec/factories/design_management/versions.rb
index e505a77d6bd..9d965c6e86c 100644
--- a/spec/factories/design_management/versions.rb
+++ b/spec/factories/design_management/versions.rb
@@ -102,7 +102,7 @@ FactoryBot.define do
end
if actions.present?
- repository.multi_action(
+ repository.commit_files(
evaluator.author,
branch_name: 'master',
message: "created #{actions.size} files",
@@ -123,7 +123,7 @@ FactoryBot.define do
end
end
- sha = repository.multi_action(
+ sha = repository.commit_files(
evaluator.author,
branch_name: 'master',
message: "edited #{version_actions.size} files",
diff --git a/spec/features/projects/settings/webhooks_settings_spec.rb b/spec/features/projects/settings/webhooks_settings_spec.rb
index c84de7fc03f..d525544ac15 100644
--- a/spec/features/projects/settings/webhooks_settings_spec.rb
+++ b/spec/features/projects/settings/webhooks_settings_spec.rb
@@ -139,6 +139,12 @@ RSpec.describe 'Projects > Settings > Webhook Settings' do
expect(page).to have_current_path(edit_project_hook_path(project, hook), ignore_query: true)
end
+
+ it 'does not show search settings on the hook log details' do
+ visit project_hook_hook_log_path(project, hook, hook_log)
+
+ expect(page).not_to have_field(placeholder: 'Search settings', disabled: true)
+ end
end
end
end
diff --git a/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js b/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js
index 27645f1dd82..52b440f18bb 100644
--- a/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js
+++ b/spec/frontend/pipelines/components/pipeline_mini_graph/pipeline_stage_spec.js
@@ -129,10 +129,11 @@ describe('Pipelines stage component', () => {
await axios.waitForAll();
});
- it('renders the received data and emit `clickedDropdown` event', async () => {
+ it('renders the received data and emits the correct events', async () => {
expect(findDropdownMenu().text()).toContain(stageReply.latest_statuses[0].name);
expect(findDropdownMenuTitle().text()).toContain(stageReply.name);
expect(eventHub.$emit).toHaveBeenCalledWith('clickedDropdown');
+ expect(wrapper.emitted('miniGraphStageClick')).toEqual([[]]);
});
it('refreshes when updateDropdown is set to true', async () => {
diff --git a/spec/frontend/pipelines/pipelines_table_spec.js b/spec/frontend/pipelines/pipelines_table_spec.js
index 12ee06d81a3..044683ce533 100644
--- a/spec/frontend/pipelines/pipelines_table_spec.js
+++ b/spec/frontend/pipelines/pipelines_table_spec.js
@@ -200,6 +200,14 @@ describe('Pipelines Table', () => {
label: TRACKING_CATEGORIES.table,
});
});
+
+ it('tracks pipeline mini graph stage click', () => {
+ findPipelineMiniGraph().vm.$emit('miniGraphStageClick');
+
+ expect(trackingSpy).toHaveBeenCalledWith(undefined, 'click_minigraph', {
+ label: TRACKING_CATEGORIES.table,
+ });
+ });
});
});
});
diff --git a/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js b/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js
index f9f520cb2ab..7c3f4e76ae5 100644
--- a/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js
+++ b/spec/frontend/projects/settings_service_desk/components/service_desk_setting_spec.js
@@ -15,6 +15,7 @@ describe('ServiceDeskSetting', () => {
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findTemplateDropdown = () => wrapper.findComponent(GlDropdown);
const findToggle = () => wrapper.findComponent(GlToggle);
+ const findSuffixFormGroup = () => wrapper.findByTestId('suffix-form-group');
const createComponent = ({ props = {} } = {}) =>
extendedWrapper(
@@ -51,6 +52,32 @@ describe('ServiceDeskSetting', () => {
expect(findLoadingIcon().exists()).toBe(true);
expect(findIncomingEmail().exists()).toBe(false);
});
+
+ it('should display help text', () => {
+ expect(findSuffixFormGroup().text()).toContain(
+ 'To add a custom suffix, set up a Service Desk email address',
+ );
+ expect(findSuffixFormGroup().text()).not.toContain(
+ 'Add a suffix to Service Desk email address',
+ );
+ });
+ });
+ });
+
+ describe('when customEmailEnabled', () => {
+ beforeEach(() => {
+ wrapper = createComponent({
+ props: { customEmailEnabled: true },
+ });
+ });
+
+ it('should not display help text', () => {
+ expect(findSuffixFormGroup().text()).not.toContain(
+ 'To add a custom suffix, set up a Service Desk email address',
+ );
+ expect(findSuffixFormGroup().text()).toContain(
+ 'Add a suffix to Service Desk email address',
+ );
});
});
diff --git a/spec/lib/gitlab/git/branch_spec.rb b/spec/lib/gitlab/git/branch_spec.rb
index feaa1f6595c..95cc833390f 100644
--- a/spec/lib/gitlab/git/branch_spec.rb
+++ b/spec/lib/gitlab/git/branch_spec.rb
@@ -111,7 +111,7 @@ RSpec.describe Gitlab::Git::Branch do
end
def create_commit
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: 'HEAD',
message: 'commit message',
diff --git a/spec/lib/gitlab/git/cross_repo_comparer_spec.rb b/spec/lib/gitlab/git/cross_repo_comparer_spec.rb
index 1c49486b7b1..7888e224d59 100644
--- a/spec/lib/gitlab/git/cross_repo_comparer_spec.rb
+++ b/spec/lib/gitlab/git/cross_repo_comparer_spec.rb
@@ -110,7 +110,7 @@ RSpec.describe Gitlab::Git::CrossRepoComparer do
def create_commit(user, repo, branch)
action = { action: :create, file_path: '/FILE', content: 'content' }
- result = repo.multi_action(user, branch_name: branch, message: 'Commit', actions: [action])
+ result = repo.commit_files(user, branch_name: branch, message: 'Commit', actions: [action])
result.newrev
end
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index 3f990cff0be..e1ea5c2d825 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -309,7 +309,7 @@ RSpec.describe Gitlab::Git::Repository do
repository.create_branch('right-branch')
left.times do |i|
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: 'left-branch',
message: 'some more content for a',
@@ -322,7 +322,7 @@ RSpec.describe Gitlab::Git::Repository do
end
right.times do |i|
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: 'right-branch',
message: 'some more content for b',
@@ -367,7 +367,7 @@ RSpec.describe Gitlab::Git::Repository do
repository.create_branch('right-branch')
left.times do |i|
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: 'left-branch',
message: 'some more content for a',
@@ -380,7 +380,7 @@ RSpec.describe Gitlab::Git::Repository do
end
right.times do |i|
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: 'right-branch',
message: 'some more content for b',
@@ -518,7 +518,7 @@ RSpec.describe Gitlab::Git::Repository do
before do
repository.create_branch(ref)
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: ref,
message: 'committing something',
@@ -528,7 +528,7 @@ RSpec.describe Gitlab::Git::Repository do
content: content
}]
)
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: ref,
message: 'committing something',
@@ -605,7 +605,7 @@ RSpec.describe Gitlab::Git::Repository do
let(:query) { 'file with space.md' }
before do
- mutable_repository.multi_action(
+ mutable_repository.commit_files(
user,
actions: [{ action: :create, file_path: "file with space.md", content: "Test content" }],
branch_name: ref, message: "Test"
@@ -622,7 +622,7 @@ RSpec.describe Gitlab::Git::Repository do
let(:query) { file_name }
before do
- mutable_repository.multi_action(
+ mutable_repository.commit_files(
user,
actions: [{ action: :create, file_path: file_name, content: "Test content" }],
branch_name: ref, message: "Test"
@@ -690,7 +690,7 @@ RSpec.describe Gitlab::Git::Repository do
before do
# Add new commits so that there's a renamed file in the commit history
- @commit_with_old_name_id = repository.multi_action(
+ @commit_with_old_name_id = repository.commit_files(
user,
branch_name: repository.root_ref,
message: 'Update CHANGELOG',
@@ -700,7 +700,7 @@ RSpec.describe Gitlab::Git::Repository do
content: 'CHANGELOG'
}]
).newrev
- @rename_commit_id = repository.multi_action(
+ @rename_commit_id = repository.commit_files(
user,
branch_name: repository.root_ref,
message: 'Move CHANGELOG to encoding/',
@@ -711,7 +711,7 @@ RSpec.describe Gitlab::Git::Repository do
content: 'CHANGELOG'
}]
).newrev
- @commit_with_new_name_id = repository.multi_action(
+ @commit_with_new_name_id = repository.commit_files(
user,
branch_name: repository.root_ref,
message: 'Edit encoding/CHANGELOG',
@@ -1005,7 +1005,7 @@ RSpec.describe Gitlab::Git::Repository do
let(:commit) { create_commit('nested/new-blob.txt' => 'This is a new blob') }
def create_commit(blobs)
- commit_result = repository.multi_action(
+ commit_result = repository.commit_files(
user,
branch_name: 'a-new-branch',
message: 'Add a file',
@@ -1154,7 +1154,7 @@ RSpec.describe Gitlab::Git::Repository do
describe '#new_commits' do
let(:repository) { mutable_repository }
let(:new_commit) do
- commit_result = repository.multi_action(
+ commit_result = repository.commit_files(
user,
branch_name: 'a-new-branch',
message: 'Message',
@@ -1793,7 +1793,7 @@ RSpec.describe Gitlab::Git::Repository do
let(:source_branch) { 'new-branch-for-fetch-source-branch' }
let!(:new_oid) do
- source_repository.multi_action(
+ source_repository.commit_files(
user,
branch_name: source_branch,
message: 'Add a file',
@@ -2241,7 +2241,7 @@ RSpec.describe Gitlab::Git::Repository do
context 'when the diff contains a rename' do
let(:end_sha) do
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: repository.root_ref,
message: 'Move CHANGELOG to encoding/',
@@ -2324,7 +2324,7 @@ RSpec.describe Gitlab::Git::Repository do
it 'can still access objects in the object pool' do
object_pool.link(repository)
- new_commit_id = object_pool.repository.multi_action(
+ new_commit_id = object_pool.repository.commit_files(
project.owner,
branch_name: object_pool.repository.root_ref,
message: 'Add a file',
diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb
index 2e4520cd3a0..7c84c737c00 100644
--- a/spec/lib/gitlab/git/tree_spec.rb
+++ b/spec/lib/gitlab/git/tree_spec.rb
@@ -95,7 +95,7 @@ RSpec.describe Gitlab::Git::Tree do
let(:subdir_file) { entries.first }
# rubocop: enable Rails/FindBy
let!(:sha) do
- repository.multi_action(
+ repository.commit_files(
user,
branch_name: 'HEAD',
message: "Create #{filename}",
diff --git a/spec/models/ci/build_dependencies_spec.rb b/spec/models/ci/build_dependencies_spec.rb
index 737348765d9..1dd0386060d 100644
--- a/spec/models/ci/build_dependencies_spec.rb
+++ b/spec/models/ci/build_dependencies_spec.rb
@@ -13,10 +13,15 @@ RSpec.describe Ci::BuildDependencies do
status: 'success')
end
- let!(:build) { create(:ci_build, pipeline: pipeline, name: 'build', stage_idx: 0, stage: 'build') }
- let!(:rspec_test) { create(:ci_build, :success, pipeline: pipeline, name: 'rspec', stage_idx: 1, stage: 'test') }
- let!(:rubocop_test) { create(:ci_build, pipeline: pipeline, name: 'rubocop', stage_idx: 1, stage: 'test') }
- let!(:staging) { create(:ci_build, pipeline: pipeline, name: 'staging', stage_idx: 2, stage: 'deploy') }
+ let(:build_stage) { create(:ci_stage, name: 'build', pipeline: pipeline) }
+ let(:test_stage) { create(:ci_stage, name: 'test', pipeline: pipeline) }
+ let(:deploy_stage) { create(:ci_stage, name: 'deploy', pipeline: pipeline) }
+ let!(:build) { create(:ci_build, pipeline: pipeline, name: 'build', stage_idx: 0, ci_stage: build_stage) }
+ let!(:rubocop_test) { create(:ci_build, pipeline: pipeline, name: 'rubocop', stage_idx: 1, ci_stage: test_stage) }
+ let!(:staging) { create(:ci_build, pipeline: pipeline, name: 'staging', stage_idx: 2, ci_stage: deploy_stage) }
+ let!(:rspec_test) do
+ create(:ci_build, :success, pipeline: pipeline, name: 'rspec', stage_idx: 1, ci_stage: test_stage)
+ end
context 'for local dependencies' do
subject { described_class.new(job).all }
@@ -63,7 +68,7 @@ RSpec.describe Ci::BuildDependencies do
name: 'dag_job',
scheduling_type: :dag,
stage_idx: 2,
- stage: 'deploy'
+ ci_stage: deploy_stage
)
end
@@ -87,7 +92,7 @@ RSpec.describe Ci::BuildDependencies do
name: 'final',
scheduling_type: scheduling_type,
stage_idx: 3,
- stage: 'deploy',
+ ci_stage: deploy_stage,
options: { dependencies: dependencies }
)
end
@@ -218,12 +223,12 @@ RSpec.describe Ci::BuildDependencies do
cross_pipeline_limit.times do |index|
create(:ci_build, :success,
pipeline: parent_pipeline, name: "dependency-#{index}",
- stage_idx: 1, stage: 'build', user: user
+ stage_idx: 1, ci_stage: build_stage, user: user
)
create(:ci_build, :success,
pipeline: sibling_pipeline, name: "dependency-#{index}",
- stage_idx: 1, stage: 'build', user: user
+ stage_idx: 1, ci_stage: build_stage, user: user
)
end
end
@@ -355,7 +360,7 @@ RSpec.describe Ci::BuildDependencies do
describe '#all' do
let!(:job) do
- create(:ci_build, pipeline: pipeline, name: 'deploy', stage_idx: 3, stage: 'deploy')
+ create(:ci_build, pipeline: pipeline, name: 'deploy', stage_idx: 3, ci_stage: deploy_stage)
end
let(:dependencies) { described_class.new(job) }
diff --git a/spec/models/projects/build_artifacts_size_refresh_spec.rb b/spec/models/projects/build_artifacts_size_refresh_spec.rb
index 052e654af76..21cd8e0b9d4 100644
--- a/spec/models/projects/build_artifacts_size_refresh_spec.rb
+++ b/spec/models/projects/build_artifacts_size_refresh_spec.rb
@@ -265,4 +265,16 @@ RSpec.describe Projects::BuildArtifactsSizeRefresh, type: :model do
it { is_expected.to eq(result) }
end
end
+
+ describe 'callbacks' do
+ context 'when destroyed' do
+ it 'enqueues a Namespaces::ScheduleAggregationWorker' do
+ refresh = create(:project_build_artifacts_size_refresh)
+
+ expect(Namespaces::ScheduleAggregationWorker).to receive(:perform_async).with(refresh.project.namespace_id)
+
+ refresh.destroy!
+ end
+ end
+ end
end
diff --git a/spec/models/snippet_repository_spec.rb b/spec/models/snippet_repository_spec.rb
index e8a933d2277..655cfad57c9 100644
--- a/spec/models/snippet_repository_spec.rb
+++ b/spec/models/snippet_repository_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe SnippetRepository do
let(:data) { [new_file, move_file, update_file] }
it 'returns nil when files argument is empty' do
- expect(snippet.repository).not_to receive(:multi_action)
+ expect(snippet.repository).not_to receive(:commit_files)
operation = snippet_repository.multi_files_action(user, [], **commit_opts)
@@ -47,7 +47,7 @@ RSpec.describe SnippetRepository do
end
it 'returns nil when files argument is nil' do
- expect(snippet.repository).not_to receive(:multi_action)
+ expect(snippet.repository).not_to receive(:commit_files)
operation = snippet_repository.multi_files_action(user, nil, **commit_opts)
@@ -119,7 +119,7 @@ RSpec.describe SnippetRepository do
end
it 'infers the commit action based on the parameters if not present' do
- expect(repo).to receive(:multi_action).with(user, hash_including(actions: result))
+ expect(repo).to receive(:commit_files).with(user, hash_including(actions: result))
snippet_repository.multi_files_action(user, data, **commit_opts)
end
@@ -131,7 +131,7 @@ RSpec.describe SnippetRepository do
specify do
expect(repo).to(
- receive(:multi_action).with(
+ receive(:commit_files).with(
user,
hash_including(actions: array_including(hash_including(action: expected_action)))))
diff --git a/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb b/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb
index 6f28f892f00..73d185283b6 100644
--- a/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb
+++ b/spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb
@@ -217,18 +217,20 @@ RSpec.describe AutoMerge::MergeWhenPipelineSucceedsService do
let(:ref) { mr_merge_if_green_enabled.source_branch }
let(:sha) { project.commit(ref).id }
+ let(:build_stage) { create(:ci_stage, name: 'build', pipeline: pipeline) }
+
let(:pipeline) do
create(:ci_empty_pipeline, ref: ref, sha: sha, project: project)
end
let!(:build) do
create(:ci_build, :created, pipeline: pipeline, ref: ref,
- name: 'build', stage: 'build')
+ name: 'build', ci_stage: build_stage )
end
let!(:test) do
create(:ci_build, :created, pipeline: pipeline, ref: ref,
- name: 'test', stage: 'test')
+ name: 'test')
end
before do
diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb
index 5de1c0e27be..973ead28462 100644
--- a/spec/services/git/branch_hooks_service_spec.rb
+++ b/spec/services/git/branch_hooks_service_spec.rb
@@ -596,7 +596,7 @@ RSpec.describe Git::BranchHooksService, :clean_gitlab_redis_shared_state do
end
end
- project.repository.multi_action(
+ project.repository.commit_files(
user, message: 'message', branch_name: branch, actions: actions
)
end
diff --git a/spec/support/shared_examples/requests/api/snippets_shared_examples.rb b/spec/support/shared_examples/requests/api/snippets_shared_examples.rb
index 2b72c69cb37..1b92eb56f54 100644
--- a/spec/support/shared_examples/requests/api/snippets_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/snippets_shared_examples.rb
@@ -133,7 +133,7 @@ RSpec.shared_examples 'snippet file updates' do
context 'when save fails due to a repository commit error' do
before do
allow_next_instance_of(Repository) do |instance|
- allow(instance).to receive(:multi_action).and_raise(Gitlab::Git::CommitError)
+ allow(instance).to receive(:commit_files).and_raise(Gitlab::Git::CommitError)
end
update_snippet(params: { files: [create_action] })