Commit bc255110 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Only mark pages as not deployed if there is no deployment

parent dd9193ef
......@@ -40,7 +40,10 @@ module Pages
rescue ::Pages::ZipDirectoryService::InvalidArchiveError => e
Gitlab::ErrorTracking.track_exception(e, project_id: project.id)
project.mark_pages_as_not_deployed if Feature.enabled?(:pages_migration_mark_as_not_deployed, project)
if !project.pages_metadatum&.reload&.pages_deployment &&
Feature.enabled?(:pages_migration_mark_as_not_deployed, project)
project.mark_pages_as_not_deployed
end
end
end
end
......@@ -14,6 +14,16 @@ RSpec.describe Pages::MigrateLegacyStorageToDeploymentService do
end.to change { project.pages_metadatum.reload.deployed }.from(true).to(false)
end
it 'does not mark pages as not deployed if public directory is absent but pages_deployment exists' do
deployment = create(:pages_deployment, project: project)
project.update_pages_deployment!(deployment)
project.mark_pages_as_deployed
expect do
service.execute
end.not_to change { project.pages_metadatum.reload.deployed }.from(true)
end
it 'does not mark pages as not deployed if public directory is absent but feature is disabled' do
stub_feature_flags(pages_migration_mark_as_not_deployed: false)
......
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