diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-15 09:08:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-15 09:08:50 +0000 |
commit | 778772c8d97adc025c126a941a1bd37bf72419ac (patch) | |
tree | f6818108cb058d9f0e9056a34e91d88dc63593b9 /spec/lib | |
parent | a552864a355f31c496e476ad4e57585aeab95a12 (diff) | |
download | gitlab-ce-778772c8d97adc025c126a941a1bd37bf72419ac.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/import_export/project_tree_restorer_spec.rb | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb index 56426bb8110..ac9a63e8414 100644 --- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb @@ -116,6 +116,15 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do expect(Issue.find_by(title: 'Issue without assignees').assignees).to be_empty end + it 'restores timelogs for issues' do + timelog = Issue.find_by(title: 'issue_with_timelogs').timelogs.last + + aggregate_failures do + expect(timelog.time_spent).to eq(72000) + expect(timelog.spent_at).to eq("2019-12-27T00:00:00.000Z") + end + end + it 'contains the merge access levels on a protected branch' do expect(ProtectedBranch.first.merge_access_levels).not_to be_empty end @@ -229,6 +238,11 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do expect(@project.ci_cd_settings.group_runners_enabled?).to eq(false) end + it 'restores `auto_devops`' do + expect(@project.auto_devops_enabled?).to eq(true) + expect(@project.auto_devops.deploy_strategy).to eq('continuous') + end + it 'restores the correct service' do expect(CustomIssueTrackerService.first).not_to be_nil end @@ -268,6 +282,55 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do end end + it 'restores error_tracking_setting' do + setting = @project.error_tracking_setting + + aggregate_failures do + expect(setting.api_url).to eq("https://gitlab.example.com/api/0/projects/sentry-org/sentry-project") + expect(setting.project_name).to eq("Sentry Project") + expect(setting.organization_name).to eq("Sentry Org") + end + end + + it 'restores external pull requests' do + external_pr = @project.external_pull_requests.last + + aggregate_failures do + expect(external_pr.pull_request_iid).to eq(4) + expect(external_pr.source_branch).to eq("feature") + expect(external_pr.target_branch).to eq("master") + expect(external_pr.status).to eq("open") + end + end + + it 'restores pipeline schedules' do + pipeline_schedule = @project.pipeline_schedules.last + + aggregate_failures do + expect(pipeline_schedule.description).to eq('Schedule Description') + expect(pipeline_schedule.ref).to eq('master') + expect(pipeline_schedule.cron).to eq('0 4 * * 0') + expect(pipeline_schedule.cron_timezone).to eq('UTC') + expect(pipeline_schedule.active).to eq(true) + end + end + + it 'restores releases with links' do + release = @project.releases.last + link = release.links.last + + aggregate_failures do + expect(release.tag).to eq('release-1.1') + expect(release.description).to eq('Some release notes') + expect(release.name).to eq('release-1.1') + expect(release.sha).to eq('901de3a8bd5573f4a049b1457d28bc1592ba6bf9') + expect(release.released_at).to eq('2019-12-26T10:17:14.615Z') + + expect(link.url).to eq('http://localhost/namespace6/project6/-/jobs/140463678/artifacts/download') + expect(link.name).to eq('release-1.1.dmg') + end + end + context 'Merge requests' do it 'always has the new project as a target' do expect(MergeRequest.find_by_title('MR1').target_project).to eq(@project) @@ -321,9 +384,9 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do end it 'has the correct number of pipelines and statuses' do - expect(@project.ci_pipelines.size).to eq(6) + expect(@project.ci_pipelines.size).to eq(7) - @project.ci_pipelines.order(:id).zip([2, 2, 2, 2, 2, 0]) + @project.ci_pipelines.order(:id).zip([2, 2, 2, 2, 2, 0, 0]) .each do |(pipeline, expected_status_size)| expect(pipeline.statuses.size).to eq(expected_status_size) end @@ -332,7 +395,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do context 'when restoring hierarchy of pipeline, stages and jobs' do it 'restores pipelines' do - expect(Ci::Pipeline.all.count).to be 6 + expect(Ci::Pipeline.all.count).to be 7 end it 'restores pipeline stages' do @@ -358,6 +421,12 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do it 'restores a Hash for CommitStatus options' do expect(CommitStatus.all.map(&:options).compact).to all(be_a(Hash)) end + + it 'restores external pull request for the restored pipeline' do + pipeline_with_external_pr = @project.ci_pipelines.order(:id).last + + expect(pipeline_with_external_pr.external_pull_request).to be_persisted + end end end end |