Commit adc9e13d authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix import/export project tree saver specs

parent bf8c5643
...@@ -181,19 +181,23 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -181,19 +181,23 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end end
context 'when restoring hierarchy of pipeline, stages and jobs' do context 'when restoring hierarchy of pipeline, stages and jobs' do
it 'restores statuses' do
expect(CommitStatus.all.count).to be 10
end
it 'restores pipeline stages' do it 'restores pipeline stages' do
expect(Ci::Stage.all.count).to be 6 expect(Ci::Stage.all.count).to be 6
end end
it 'correctly restores association between stage and a pipeline' do
expect(Ci::Stage.all).to all(have_attributes(pipeline_id: a_value > 0))
end
it 'restores statuses' do
expect(CommitStatus.all.count).to be 10
end
it 'correctly restores association between a stage and a job' do it 'correctly restores association between a stage and a job' do
expect(CommitStatus.all).to all(have_attributes(stage_id: a_value > 0)) expect(CommitStatus.all).to all(have_attributes(stage_id: a_value > 0))
end end
it 'correctly restores association between a stage and a pipeline' do it 'correctly restores association between a pipeline and a job' do
expect(CommitStatus.all).to all(have_attributes(pipeline_id: a_value > 0)) expect(CommitStatus.all).to all(have_attributes(pipeline_id: a_value > 0))
end end
end end
......
...@@ -109,12 +109,20 @@ describe Gitlab::ImportExport::ProjectTreeSaver do ...@@ -109,12 +109,20 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
expect(saved_project_json['merge_requests'].first['notes'].first['author']).not_to be_empty expect(saved_project_json['merge_requests'].first['notes'].first['author']).not_to be_empty
end end
it 'has pipeline stages' do
expect(saved_project_json.dig('pipelines', 0, 'stages')).not_to be_empty
end
it 'has pipeline statuses' do it 'has pipeline statuses' do
expect(saved_project_json['pipelines'].first['statuses']).not_to be_empty expect(saved_project_json.dig('pipelines', 0, 'stages', 0, 'statuses')).not_to be_empty
end end
it 'has pipeline builds' do it 'has pipeline builds' do
expect(saved_project_json['pipelines'].first['statuses'].count { |hash| hash['type'] == 'Ci::Build' }).to eq(1) builds_count = saved_project_json
.dig('pipelines', 0, 'stages', 0, 'statuses')
.count { |hash| hash['type'] == 'Ci::Build' }
expect(builds_count).to eq(1)
end end
it 'has no when YML attributes but only the DB column' do it 'has no when YML attributes but only the DB column' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment