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,11 +246,20 @@ 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,
'compile-backend-class-n2d',
(err, assignment) => {
if (err) return callback(err, {})
const { variant } = assignment
callback(null, {
compileBackendClass:
variant === 'default' ? defaultBackendClass : variant,
showFasterCompilesFeedbackUI: false, showFasterCompilesFeedbackUI: false,
}) })
} }
)
}
SplitTestHandler.getAssignmentForMongoUser( SplitTestHandler.getAssignmentForMongoUser(
owner, owner,
'compile-backend-class', 'compile-backend-class',

View file

@ -250,7 +250,14 @@ 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) {
describe('default', function () {
beforeEach(function () {
this.getAssignmentForMongoUser.yields(null, {
variant: 'default',
})
})
it('should return the e2 class and disable the ui', function (done) {
this.CompileManager.getProjectCompileLimits( this.CompileManager.getProjectCompileLimits(
this.project_id, this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => { (err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
@ -263,6 +270,26 @@ describe('CompileManager', function () {
}) })
}) })
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()
}
)
})
})
})
describe('with priority compile', function () { describe('with priority compile', function () {
beforeEach(function () { beforeEach(function () {
this.features.compileGroup = 'priority' this.features.compileGroup = 'priority'