Merge pull request #13454 from overleaf/jpa-n2d-split-test

[web] add split test for running standard compiles on n2d instances

GitOrigin-RevId: 05b85870c2ff5eb0345e700101225535a4a569f1
This commit is contained in:
Eric Mc Sween 2023-06-14 07:10:23 -04:00 committed by Copybot
parent 55c5330108
commit f038cd4d10
2 changed files with 50 additions and 14 deletions

View file

@ -246,10 +246,19 @@ module.exports = CompileManager = {
_getCompileBackendClassDetails(owner, compileGroup, callback) { _getCompileBackendClassDetails(owner, compileGroup, callback) {
const { defaultBackendClass } = Settings.apis.clsi const { defaultBackendClass } = Settings.apis.clsi
if (compileGroup === 'standard') { if (compileGroup === 'standard') {
return callback(null, { return SplitTestHandler.getAssignmentForMongoUser(
compileBackendClass: defaultBackendClass, owner,
showFasterCompilesFeedbackUI: false, 'compile-backend-class-n2d',
}) (err, assignment) => {
if (err) return callback(err, {})
const { variant } = assignment
callback(null, {
compileBackendClass:
variant === 'default' ? defaultBackendClass : variant,
showFasterCompilesFeedbackUI: false,
})
}
)
} }
SplitTestHandler.getAssignmentForMongoUser( SplitTestHandler.getAssignmentForMongoUser(
owner, owner,

View file

@ -250,16 +250,43 @@ describe('CompileManager', function () {
beforeEach(function () { beforeEach(function () {
this.features.compileGroup = 'standard' this.features.compileGroup = 'standard'
}) })
it('should return the default class and disable ui', function (done) {
this.CompileManager.getProjectCompileLimits( describe('default', function () {
this.project_id, beforeEach(function () {
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => { this.getAssignmentForMongoUser.yields(null, {
if (err) return done(err) variant: 'default',
expect(compileBackendClass).to.equal('e2') })
expect(showFasterCompilesFeedbackUI).to.equal(false) })
done() it('should return the e2 class and disable the ui', function (done) {
} this.CompileManager.getProjectCompileLimits(
) this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('e2')
expect(showFasterCompilesFeedbackUI).to.equal(false)
done()
}
)
})
})
describe('n2d variant', function () {
beforeEach(function () {
this.getAssignmentForMongoUser.yields(null, {
variant: 'n2d',
})
})
it('should return the n2d class and disable the ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('n2d')
expect(showFasterCompilesFeedbackUI).to.equal(false)
done()
}
)
})
}) })
}) })