diff --git a/services/web/app/src/Features/Compile/ClsiCacheManager.mjs b/services/web/app/src/Features/Compile/ClsiCacheManager.mjs index 496bc9a97b..b96d916d5d 100644 --- a/services/web/app/src/Features/Compile/ClsiCacheManager.mjs +++ b/services/web/app/src/Features/Compile/ClsiCacheManager.mjs @@ -249,7 +249,7 @@ async function createTemplateClsiCache({ docEntries, }) { const compileGroup = Settings.defaultFeatures.compileGroup - const compileBackendClass = Settings.apis.clsi.submissionBackendClass + const compileBackendClass = Settings.apis.clsi.submissionCompileBackendClass const submissionId = new ObjectId().toString() const editorId = Crypto.randomUUID() const historyId = project.overleaf.history.id diff --git a/services/web/app/src/Features/Compile/ClsiCookieManager.mjs b/services/web/app/src/Features/Compile/ClsiCookieManager.mjs index 7ccbfcdfd7..8fce3fbe57 100644 --- a/services/web/app/src/Features/Compile/ClsiCookieManager.mjs +++ b/services/web/app/src/Features/Compile/ClsiCookieManager.mjs @@ -34,6 +34,18 @@ const ClsiCookieManagerFactory = function (backendGroup) { } } + // TODO: remove this once the old keys have expired after the rollout of the + // c3d->free / c4d->premium compile backend class rename. + function buildOldKey(projectId, userId, compileBackendClass) { + let oldCompileBackendClass = compileBackendClass + if (compileBackendClass === 'free') { + oldCompileBackendClass = 'c3d' + } else if (compileBackendClass === 'premium') { + oldCompileBackendClass = 'c4d' + } + return buildKey(projectId, userId, oldCompileBackendClass) + } + async function getServerId( projectId, userId, @@ -43,9 +55,16 @@ const ClsiCookieManagerFactory = function (backendGroup) { if (!clsiCookiesEnabled) { return } - const serverId = await rclient.get( + let serverId = await rclient.get( buildKey(projectId, userId, compileBackendClass) ) + if (!serverId) { + // Fallback to the old key from before the c3d->free / c4d->premium rename. + // TODO: remove this once the old keys have expired. + serverId = await rclient.get( + buildOldKey(projectId, userId, compileBackendClass) + ) + } if (!serverId) { return await cookieManager.promises._populateServerIdViaRequest( @@ -215,7 +234,10 @@ const ClsiCookieManagerFactory = function (backendGroup) { return } try { - await rclient.del(buildKey(projectId, userId, compileBackendClass)) + await rclient.del( + buildKey(projectId, userId, compileBackendClass), + buildOldKey(projectId, userId, compileBackendClass) + ) } catch (err) { // redis errors need wrapping as the instance may be shared throw new OError( diff --git a/services/web/app/src/Features/Compile/ClsiManager.mjs b/services/web/app/src/Features/Compile/ClsiManager.mjs index 00b0883495..effad9f39f 100644 --- a/services/web/app/src/Features/Compile/ClsiManager.mjs +++ b/services/web/app/src/Features/Compile/ClsiManager.mjs @@ -87,16 +87,14 @@ function getDoubleCompilePercentile(projectId) { } function getNewCompileBackendClass(projectId, compileBackendClass) { + const clsi = Settings.apis.clsi let cfg - switch (compileBackendClass) { - case 'c3d': - cfg = Settings.apis.clsi_new.doubleCompileFree - break - case 'c4d': - cfg = Settings.apis.clsi_new.doubleCompilePremium - break - default: - throw new Error('unknown ?compileBackendClass') + if (compileBackendClass === clsi.standardCompileBackendClass) { + cfg = Settings.apis.clsi_new.doubleCompileFree + } else if (compileBackendClass === clsi.priorityCompileBackendClass) { + cfg = Settings.apis.clsi_new.doubleCompilePremium + } else { + throw new Error('unknown ?compileBackendClass') } if (!cfg.backendClass || !cfg.sample) return null if (getDoubleCompilePercentile(projectId) >= cfg.sample) return null diff --git a/services/web/app/src/Features/Compile/CompileController.mjs b/services/web/app/src/Features/Compile/CompileController.mjs index 76f5933229..eb27104dbb 100644 --- a/services/web/app/src/Features/Compile/CompileController.mjs +++ b/services/web/app/src/Features/Compile/CompileController.mjs @@ -338,7 +338,8 @@ const _CompileController = { } options.compileGroup = req.body?.compileGroup || Settings.defaultFeatures.compileGroup - options.compileBackendClass = Settings.apis.clsi.submissionBackendClass + options.compileBackendClass = + Settings.apis.clsi.submissionCompileBackendClass options.timeout = req.body?.timeout || Settings.defaultFeatures.compileTimeout const { status, outputFiles, clsiServerId, validationProblems } = diff --git a/services/web/app/src/Features/Compile/CompileManager.mjs b/services/web/app/src/Features/Compile/CompileManager.mjs index 3104c98698..3cc9259a87 100644 --- a/services/web/app/src/Features/Compile/CompileManager.mjs +++ b/services/web/app/src/Features/Compile/CompileManager.mjs @@ -164,7 +164,10 @@ async function _getUserCompileLimits(userId) { timeout: ownerFeatures.compileTimeout || Settings.defaultFeatures.compileTimeout, compileGroup, - compileBackendClass: compileGroup === 'standard' ? 'c3d' : 'c4d', + compileBackendClass: + compileGroup === 'standard' + ? Settings.apis.clsi.standardCompileBackendClass + : Settings.apis.clsi.priorityCompileBackendClass, ownerAnalyticsId: analyticsId, } diff --git a/services/web/config/settings.defaults.js b/services/web/config/settings.defaults.js index 70144ecf4f..b9f042af0f 100644 --- a/services/web/config/settings.defaults.js +++ b/services/web/config/settings.defaults.js @@ -252,8 +252,12 @@ module.exports = { ? `http://${process.env.CLSI_LB_IP || process.env.CLSI_LB_HOST}:80` : `http://${process.env.DOWNLOAD_HOST || '127.0.0.1'}:8080`, backendGroupName: undefined, - submissionBackendClass: - process.env.CLSI_SUBMISSION_BACKEND_CLASS || 'c3d', + submissionCompileBackendClass: + process.env.CLSI_SUBMISSION_COMPILE_BACKEND_CLASS || 'free', + standardCompileBackendClass: + process.env.CLSI_STANDARD_COMPILE_BACKEND_CLASS || 'free', + priorityCompileBackendClass: + process.env.CLSI_PRIORITY_COMPILE_BACKEND_CLASS || 'premium', }, clsiCache: { instances: JSON.parse(process.env.CLSI_CACHE_INSTANCES || '[]'), diff --git a/services/web/test/unit/src/Compile/ClsiCookieManager.test.mjs b/services/web/test/unit/src/Compile/ClsiCookieManager.test.mjs index ca700167d6..0324642133 100644 --- a/services/web/test/unit/src/Compile/ClsiCookieManager.test.mjs +++ b/services/web/test/unit/src/Compile/ClsiCookieManager.test.mjs @@ -51,7 +51,26 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, '', - 'c3d' + 'free' + ) + ctx.redis.get + .calledWith(`clsiserver:free:${ctx.project_id}:${ctx.user_id}`) + .should.equal(true) + serverId.should.equal('clsi-7') + }) + + it('should fall back to the old key during the free/premium rollout', async function (ctx) { + ctx.redis.get + .withArgs(`clsiserver:free:${ctx.project_id}:${ctx.user_id}`) + .resolves(null) + ctx.redis.get + .withArgs(`clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`) + .resolves('clsi-7') + const serverId = await ctx.ClsiCookieManager.promises.getServerId( + ctx.project_id, + ctx.user_id, + '', + 'free' ) ctx.redis.get .calledWith(`clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`) @@ -83,7 +102,7 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, '', - 'c3d' + 'free' ) ctx.ClsiCookieManager.promises._populateServerIdViaRequest .calledWith(ctx.project_id, ctx.user_id) @@ -114,13 +133,13 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, 'standard', - 'c3d' + 'free' ) const args = ctx.ClsiCookieManager.promises.setServerId.args[0] args[0].should.equal(ctx.project_id) args[1].should.equal(ctx.user_id) args[2].should.equal('standard') - args[3].should.equal('c3d') + args[3].should.equal('free') args[4].should.deep.equal(ctx.clsiServerId) }) @@ -130,7 +149,7 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, '', - 'c3d' + 'free' ) serverId.should.equal(ctx.clsiServerId) }) @@ -149,7 +168,7 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, 'standard', - 'c3d', + 'free', ctx.clsiServerId, null ) @@ -163,9 +182,10 @@ describe('ClsiCookieManager', function () { await ctx.ClsiCookieManager.promises.clearServerId( ctx.project_id, ctx.user_id, - 'c3d' + 'free' ) ctx.redis.del.should.have.been.calledWith( + `clsiserver:free:${ctx.project_id}:${ctx.user_id}`, `clsiserver:c3d:${ctx.project_id}:${ctx.user_id}` ) }) @@ -184,12 +204,12 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, 'standard', - 'c3d', + 'free', ctx.clsiServerId, null ) ctx.redis.setex.should.have.been.calledWith( - `clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`, + `clsiserver:free:${ctx.project_id}:${ctx.user_id}`, ctx.settings.clsiCookie.ttlInSeconds, ctx.clsiServerId ) @@ -201,12 +221,12 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, 'standard', - 'c3d', + 'free', ctx.clsiServerId, null ) expect(ctx.redis.setex).to.have.been.calledWith( - `clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`, + `clsiserver:free:${ctx.project_id}:${ctx.user_id}`, ctx.settings.clsiCookie.ttlInSecondsRegular, ctx.clsiServerId ) @@ -229,7 +249,7 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, 'standard', - 'c3d', + 'free', ctx.clsiServerId, null ) @@ -254,12 +274,12 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, 'standard', - 'c3d', + 'free', ctx.clsiServerId, null ) ctx.redis_secondary.setex.should.have.been.calledWith( - `clsiserver:c3d:${ctx.project_id}:${ctx.user_id}`, + `clsiserver:free:${ctx.project_id}:${ctx.user_id}`, ctx.settings.clsiCookie.ttlInSeconds, ctx.clsiServerId ) @@ -273,14 +293,14 @@ describe('ClsiCookieManager', function () { ctx.project_id, ctx.user_id, 'standard', - 'c3d', + 'free', ctx.clsiServerId, 'previous-clsi-server-id' ) expect( ctx.fetchUtils.fetchStringWithResponse ).to.have.been.calledWith( - `${ctx.settings.apis.clsi.url}/instance-state?clsiserverid=previous-clsi-server-id&compileGroup=standard&compileBackendClass=c3d`, + `${ctx.settings.apis.clsi.url}/instance-state?clsiserverid=previous-clsi-server-id&compileGroup=standard&compileBackendClass=free`, { method: 'GET', signal: sinon.match.instanceOf(AbortSignal) } ) } diff --git a/services/web/test/unit/src/Compile/ClsiManager.test.mjs b/services/web/test/unit/src/Compile/ClsiManager.test.mjs index e121ba2445..95c96f2cc7 100644 --- a/services/web/test/unit/src/Compile/ClsiManager.test.mjs +++ b/services/web/test/unit/src/Compile/ClsiManager.test.mjs @@ -178,7 +178,9 @@ describe('ClsiManager', function () { }, clsi: { url: `http://${CLSI_HOST}`, - submissionBackendClass: 'c3d', + submissionCompileBackendClass: 'free', + standardCompileBackendClass: 'free', + priorityCompileBackendClass: 'premium', }, clsi_new: { doubleCompileFree: { @@ -333,7 +335,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, { - compileBackendClass: 'c3d', + compileBackendClass: 'free', compileGroup: 'standard', timeout: ctx.timeout, } @@ -347,7 +349,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}/compile` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'standard' ), { @@ -427,7 +429,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, 'standard', - 'c3d', + 'free', `${ctx.newClsiServerId}1` ) }) @@ -471,7 +473,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, { - compileBackendClass: 'c3d', + compileBackendClass: 'free', compileGroup: 'standard', timeout: ctx.timeout, compileFromHistory: true, @@ -488,7 +490,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}/compile` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'standard' ), { @@ -576,7 +578,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, 'standard', - 'c3d', + 'free', `${ctx.newClsiServerId}1` ) }) @@ -619,7 +621,7 @@ describe('ClsiManager', function () { ctx.result = await ctx.ClsiManager.promises.sendRequest( ctx.project._id, ctx.user_id, - { compileBackendClass: 'c3d', compileGroup: 'standard' } + { compileBackendClass: 'free', compileGroup: 'standard' } ) }) @@ -654,7 +656,7 @@ describe('ClsiManager', function () { { timeout: 100, incrementalCompilesEnabled: true, - compileBackendClass: 'c3d', + compileBackendClass: 'free', compileGroup: 'priority', compileFromClsiCache: true, populateClsiCache: true, @@ -707,7 +709,7 @@ describe('ClsiManager', function () { url.hostname === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}/compile` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'priority' ), { @@ -1006,7 +1008,7 @@ describe('ClsiManager', function () { ctx.result = await ctx.ClsiManager.promises.sendRequest( ctx.project._id, ctx.user_id, - { compileBackendClass: 'c3d' } + { compileBackendClass: 'free' } ) }) @@ -1031,7 +1033,7 @@ describe('ClsiManager', function () { it('should clear the CLSI server id cookie', function (ctx) { expect( ctx.ClsiCookieManager.promises.clearServerId - ).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'c3d') + ).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'free') }) it('should return a success status', function (ctx) { @@ -1060,7 +1062,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, { - compileBackendClass: 'c3d', + compileBackendClass: 'free', compileGroup: 'standard', } ) @@ -1076,7 +1078,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}/compile` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'standard' ) ) @@ -1093,7 +1095,7 @@ describe('ClsiManager', function () { ctx.AnalyticsManager.recordEventForUserInBackground ).to.have.been.calledWith(ctx.user_id, 'double-compile-result', { projectId: 'project-id', - compileBackendClass: 'c3d', + compileBackendClass: 'free', newCompileBackendClass: 'n4', status: 'success', compileTime: 1337, @@ -1114,7 +1116,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, { - compileBackendClass: 'c3d', + compileBackendClass: 'free', compileGroup: 'standard', } ) @@ -1130,7 +1132,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}/compile` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'standard' ) ) @@ -1144,7 +1146,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, { - compileBackendClass: 'c4d', + compileBackendClass: 'premium', compileGroup: 'priority', } ) @@ -1160,7 +1162,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}/compile` && - url.searchParams.get('compileBackendClass') === 'c4d' && + url.searchParams.get('compileBackendClass') === 'premium' && url.searchParams.get('compileGroup') === 'priority' ) ) @@ -1177,7 +1179,7 @@ describe('ClsiManager', function () { ctx.AnalyticsManager.recordEventForUserInBackground ).to.have.been.calledWith(ctx.user_id, 'double-compile-result', { projectId: 'project-id', - compileBackendClass: 'c4d', + compileBackendClass: 'premium', newCompileBackendClass: 'n4d', status: 'success', compileTime: 1337, @@ -1222,7 +1224,7 @@ describe('ClsiManager', function () { ctx.result = await ctx.ClsiManager.promises.sendExternalRequest( ctx.submissionId, ctx.clsiRequest, - { compileBackendClass: 'c3d', compileGroup: 'standard' } + { compileBackendClass: 'free', compileGroup: 'standard' } ) }) @@ -1232,7 +1234,7 @@ describe('ClsiManager', function () { url => url.host === CLSI_HOST && url.pathname === `/project/${ctx.submissionId}/compile` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'standard' ), { @@ -1297,7 +1299,7 @@ describe('ClsiManager', function () { await ctx.ClsiManager.promises.deleteAuxFiles( ctx.project._id, ctx.user_id, - { compileBackendClass: 'c3d', compileGroup: 'standard' }, + { compileBackendClass: 'free', compileGroup: 'standard' }, 'node-1' ) }) @@ -1309,7 +1311,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'standard' && url.searchParams.get('clsiserverid') === 'node-1' ), @@ -1331,7 +1333,7 @@ describe('ClsiManager', function () { it('should clear the clsi persistance', function (ctx) { ctx.ClsiCookieManager.promises.clearServerId - .calledWith(ctx.project._id, ctx.user_id, 'c3d') + .calledWith(ctx.project._id, ctx.user_id, 'free') .should.equal(true) }) @@ -1347,7 +1349,7 @@ describe('ClsiManager', function () { await ctx.ClsiManager.promises.deleteAuxFiles( ctx.project._id, ctx.user_id, - { compileBackendClass: 'c4d', compileGroup: 'priority' }, + { compileBackendClass: 'premium', compileGroup: 'priority' }, 'node-1' ) // wait for the background task to finish @@ -1357,7 +1359,7 @@ describe('ClsiManager', function () { it('should clear both cookies', function (ctx) { expect( ctx.ClsiCookieManager.promises.clearServerId - ).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'c4d') + ).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'premium') expect( ctx.ClsiCookieManager.promises.clearServerId ).to.have.been.calledWith(ctx.project._id, ctx.user_id, 'n4d') @@ -1370,7 +1372,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}` && - url.searchParams.get('compileBackendClass') === 'c4d' && + url.searchParams.get('compileBackendClass') === 'premium' && url.searchParams.get('compileGroup') === 'priority' && url.searchParams.get('clsiserverid') === 'node-1' ), @@ -1399,7 +1401,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, false, - { compileBackendClass: 'c3d', compileGroup: 'standard' }, + { compileBackendClass: 'free', compileGroup: 'standard' }, 'node-1' ) }) @@ -1409,7 +1411,7 @@ describe('ClsiManager', function () { sinon.match( url => url.toString() === - `http://clsi.example.com/project/${ctx.project._id}/user/${ctx.user_id}/wordcount?compileBackendClass=c3d&compileGroup=standard&file=main.tex&image=mock-image-name&clsiserverid=node-1` + `http://clsi.example.com/project/${ctx.project._id}/user/${ctx.user_id}/wordcount?compileBackendClass=free&compileGroup=standard&file=main.tex&image=mock-image-name&clsiserverid=node-1` ) ) }) @@ -1426,7 +1428,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, 'other.tex', - { compileBackendClass: 'c3d', compileGroup: 'standard' }, + { compileBackendClass: 'free', compileGroup: 'standard' }, 'node-2' ) }) @@ -1438,7 +1440,7 @@ describe('ClsiManager', function () { url.host === CLSI_HOST && url.pathname === `/project/${ctx.project._id}/user/${ctx.user_id}/wordcount` && - url.searchParams.get('compileBackendClass') === 'c3d' && + url.searchParams.get('compileBackendClass') === 'free' && url.searchParams.get('compileGroup') === 'standard' && url.searchParams.get('clsiserverid') === 'node-2' && url.searchParams.get('file') === 'other.tex' && @@ -1460,7 +1462,7 @@ describe('ClsiManager', function () { ctx.project._id, ctx.user_id, false, - { compileBackendClass: 'c4d', compileGroup: 'priority' }, + { compileBackendClass: 'premium', compileGroup: 'priority' }, 'node-1' ) // wait for the background task to finish @@ -1472,7 +1474,7 @@ describe('ClsiManager', function () { sinon.match( url => url.toString() === - `http://clsi.example.com/project/${ctx.project._id}/user/${ctx.user_id}/wordcount?compileBackendClass=c4d&compileGroup=priority&file=main.tex&image=mock-image-name&clsiserverid=node-1` + `http://clsi.example.com/project/${ctx.project._id}/user/${ctx.user_id}/wordcount?compileBackendClass=premium&compileGroup=priority&file=main.tex&image=mock-image-name&clsiserverid=node-1` ) ) expect(ctx.FetchUtils.fetchStringWithResponse).to.have.been.calledWith( diff --git a/services/web/test/unit/src/Compile/CompileController.test.mjs b/services/web/test/unit/src/Compile/CompileController.test.mjs index 5fb691646e..9f9ec8da49 100644 --- a/services/web/test/unit/src/Compile/CompileController.test.mjs +++ b/services/web/test/unit/src/Compile/CompileController.test.mjs @@ -27,7 +27,7 @@ describe('CompileController', function () { promises: { compile: sinon.stub(), getProjectCompileLimits: sinon.stub().resolves({ - compileBackendClass: 'c3d', + compileBackendClass: 'free', compileGroup: 'standard', }), syncTeX: sinon.stub(), @@ -48,7 +48,7 @@ describe('CompileController', function () { clsi: { url: 'http://clsi.example.com:3013', downloadHost: 'http://clsi.example.com:8080', - submissionBackendClass: 'c3d', + submissionCompileBackendClass: 'free', }, clsi_priority: { url: 'http://clsi-priority.example.com', @@ -481,7 +481,7 @@ describe('CompileController', function () { ctx.ClsiManager.promises.sendExternalRequest.should.have.been.calledWith( ctx.submission_id, { compileGroup: 'special', timeout: 600 }, - { compileGroup: 'special', compileBackendClass: 'c3d', timeout: 600 } + { compileGroup: 'special', compileBackendClass: 'free', timeout: 600 } ) }) }) @@ -512,7 +512,7 @@ describe('CompileController', function () { draft: true, check: 'validate', compileGroup: 'standard', - compileBackendClass: 'c3d', + compileBackendClass: 'free', timeout: 60, } ) @@ -646,7 +646,7 @@ describe('CompileController', function () { it('should proxy the PDF from the CLSI', function (ctx) { ctx.fetchUtils.fetchStreamWithResponse.should.have.been.calledWith( - `${ctx.settings.apis.clsi.url}/project/${ctx.projectId}/user/${ctx.user_id}/build/${ctx.build_id}/output/output.zip?compileBackendClass=c3d&clsiserverid=${ctx.clsiServerId}` + `${ctx.settings.apis.clsi.url}/project/${ctx.projectId}/user/${ctx.user_id}/build/${ctx.build_id}/output/output.zip?compileBackendClass=free&clsiserverid=${ctx.clsiServerId}` ) }) }) @@ -657,7 +657,7 @@ describe('CompileController', function () { .stub() .resolves({ compileGroup: 'priority', - compileBackendClass: 'c4d', + compileBackendClass: 'premium', }) await ctx.CompileController.getOutputZipFromClsi( ctx.req, @@ -668,7 +668,7 @@ describe('CompileController', function () { it('should proxy the PDF from the CLSI', function (ctx) { ctx.fetchUtils.fetchStreamWithResponse.should.have.been.calledWith( - `${ctx.settings.apis.clsi.url}/project/${ctx.projectId}/user/${ctx.user_id}/build/${ctx.build_id}/output/output.zip?compileBackendClass=c4d&clsiserverid=${ctx.clsiServerId}` + `${ctx.settings.apis.clsi.url}/project/${ctx.projectId}/user/${ctx.user_id}/build/${ctx.build_id}/output/output.zip?compileBackendClass=premium&clsiserverid=${ctx.clsiServerId}` ) }) }) diff --git a/services/web/test/unit/src/Compile/CompileManager.test.mjs b/services/web/test/unit/src/Compile/CompileManager.test.mjs index 8a720731b8..4f226ff31c 100644 --- a/services/web/test/unit/src/Compile/CompileManager.test.mjs +++ b/services/web/test/unit/src/Compile/CompileManager.test.mjs @@ -19,7 +19,11 @@ describe('CompileManager', function () { vi.doMock('@overleaf/settings', () => ({ default: (ctx.settings = { apis: { - clsi: { submissionBackendClass: 'c3d' }, + clsi: { + submissionCompileBackendClass: 'free', + standardCompileBackendClass: 'free', + priorityCompileBackendClass: 'premium', + }, }, redis: { web: { host: '127.0.0.1', port: 42 } }, rateLimit: { autoCompile: {} }, @@ -292,7 +296,7 @@ describe('CompileManager', function () { .calledWith(null, { timeout: ctx.timeout, compileGroup: ctx.group, - compileBackendClass: 'c4d', + compileBackendClass: 'premium', ownerAnalyticsId: 'abc', }) .should.equal(true) @@ -322,7 +326,7 @@ describe('CompileManager', function () { await ctx.CompileManager.promises.getProjectCompileLimits( ctx.project_id ) - expect(compileBackendClass).to.equal('c4d') + expect(compileBackendClass).to.equal('premium') }) }) })