[web] prepare filestore migration for Server Pro/CE (#27230)

* [web] prepare filestore migration for Server Pro/CE

* [history-v1] remove unused USER_FILES_BUCKET_NAME env var from script

* [server-ce] tests: write default docker-compose.override.yml on startup

* [server-ce] tests: extend access logging of host-admin for response

* [server-ce] tests: test text and binary file upload

* [server-ce] tests: add tests for filestore migration

* [web] simplify feature gate for filestore/project-history-blobs logic

Co-authored-by: Brian Gough <brian.gough@overleaf.com>

* [server-ce] test: fix flaky test helper

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: f89bdab2749e2b7a49d609e2eac6bf621c727966
This commit is contained in:
Jakob Ackermann
2025-07-22 08:06:58 +00:00
committed by Copybot
co-authored by Brian Gough
parent bf43d4f709
commit 81f0807fc6
18 changed files with 227 additions and 70 deletions
@@ -8,7 +8,6 @@ import _ from 'lodash'
import ProjectGetter from '../../../../../app/src/Features/Project/ProjectGetter.js'
import User from '../../../../../test/acceptance/src/helpers/User.mjs'
import MockDocUpdaterApiClass from '../../../../../test/acceptance/src/mocks/MockDocUpdaterApi.mjs'
import Features from '../../../../../app/src/infrastructure/Features.js'
const { ObjectId } = mongodb
@@ -188,32 +187,25 @@ describe('ProjectStructureChanges', function () {
const cases = [
{
label: 'with filestore disabled and project-history-blobs enabled',
disableFilestore: true,
enableProjectHistoryBlobs: true,
filestoreMigrationLevel: 2,
},
{
label: 'with filestore enabled and project-history-blobs enabled',
disableFilestore: false,
enableProjectHistoryBlobs: true,
filestoreMigrationLevel: 1,
},
{
label: 'with filestore enabled and project-history-blobs disabled',
disableFilestore: false,
enableProjectHistoryBlobs: false,
filestoreMigrationLevel: 0,
},
]
for (const { label, disableFilestore, enableProjectHistoryBlobs } of cases) {
for (const { label, filestoreMigrationLevel } of cases) {
describe(label, function () {
const previousDisableFilestore = Settings.disableFilestore
const previousEnableProjectHistoryBlobs =
Settings.enableProjectHistoryBlobs
const previousFilestoreMigrationLevel = Settings.filestoreMigrationLevel
beforeEach(function () {
Settings.disableFilestore = disableFilestore
Settings.enableProjectHistoryBlobs = enableProjectHistoryBlobs
Settings.filestoreMigrationLevel = filestoreMigrationLevel
})
afterEach(function () {
Settings.disableFilestore = previousDisableFilestore
Settings.enableProjectHistoryBlobs = previousEnableProjectHistoryBlobs
Settings.filestoreMigrationLevel = previousFilestoreMigrationLevel
})
describe('creating a project from the example template', function () {
@@ -244,7 +236,7 @@ describe('ProjectStructureChanges', function () {
expect(updates[2].type).to.equal('add-file')
expect(updates[2].userId).to.equal(owner._id)
expect(updates[2].pathname).to.equal('/frog.jpg')
if (disableFilestore) {
if (filestoreMigrationLevel === 2) {
expect(updates[2].url).to.not.exist
expect(updates[2].createdBlob).to.be.true
} else {
@@ -301,10 +293,10 @@ describe('ProjectStructureChanges', function () {
expect(updates[2].type).to.equal('add-file')
expect(updates[2].userId).to.equal(owner._id)
expect(updates[2].pathname).to.equal('/frog.jpg')
if (disableFilestore) {
if (filestoreMigrationLevel === 2) {
expect(updates[2].url).to.not.exist
expect(updates[2].createdBlob).to.be.true
} else if (Features.hasFeature('project-history-blobs')) {
} else if (filestoreMigrationLevel === 1) {
expect(updates[2].url).to.be.null
} else {
expect(updates[2].url).to.be.a('string')
@@ -378,7 +370,7 @@ describe('ProjectStructureChanges', function () {
expect(updates[1].type).to.equal('add-file')
expect(updates[1].userId).to.equal(owner._id)
expect(updates[1].pathname).to.equal('/1pixel.png')
if (disableFilestore) {
if (filestoreMigrationLevel === 2) {
expect(updates[1].url).to.not.exist
expect(updates[1].createdBlob).to.be.true
} else {
@@ -478,7 +470,7 @@ describe('ProjectStructureChanges', function () {
expect(update.type).to.equal('add-file')
expect(update.userId).to.equal(owner._id)
expect(update.pathname).to.equal('/1pixel.png')
if (disableFilestore) {
if (filestoreMigrationLevel === 2) {
expect(update.url).to.not.exist
expect(update.createdBlob).to.be.true
} else {
@@ -516,7 +508,7 @@ describe('ProjectStructureChanges', function () {
expect(updates[1].type).to.equal('add-file')
expect(updates[1].userId).to.equal(owner._id)
expect(updates[1].pathname).to.equal('/1pixel.png')
if (disableFilestore) {
if (filestoreMigrationLevel === 2) {
expect(updates[1].url).to.not.exist
expect(updates[1].createdBlob).to.be.true
} else {
@@ -1005,7 +997,7 @@ describe('ProjectStructureChanges', function () {
expect(update.type).to.equal('add-file')
expect(update.userId).to.equal(owner._id)
expect(update.pathname).to.equal('/1pixel.png')
if (disableFilestore) {
if (filestoreMigrationLevel === 2) {
expect(update.url).to.not.exist
expect(update.createdBlob).to.be.true
} else {
@@ -1068,7 +1060,7 @@ describe('ProjectStructureChanges', function () {
expect(updates[1].type).to.equal('add-file')
expect(updates[1].userId).to.equal(owner._id)
expect(updates[1].pathname).to.equal('/1pixel.png')
if (disableFilestore) {
if (filestoreMigrationLevel === 2) {
expect(updates[1].url).to.not.exist
expect(updates[1].createdBlob).to.be.true
} else {