Merge pull request #11940 from overleaf/jpa-fix-assignment-of-initial-clsi-vm

[web] fix assignment of initial compile server

GitOrigin-RevId: 84aea918946a106a5826d7cf39cc0bf47047cb35
This commit is contained in:
Jakob Ackermann
2023-03-07 09:04:33 +00:00
committed by Copybot
parent 38973fb971
commit e0c84f08fb
5 changed files with 112 additions and 14 deletions
@@ -69,6 +69,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'',
'e2',
(err, serverId) => {
this.redis.get
.calledWith(`clsiserver:${this.project_id}:${this.user_id}`)
@@ -106,6 +107,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'',
'e2',
(err, serverId) => {
this.ClsiCookieManager._populateServerIdViaRequest
.calledWith(this.project_id, this.user_id)
@@ -130,12 +132,14 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
(err, serverId) => {
const args = this.ClsiCookieManager.setServerId.args[0]
args[0].should.equal(this.project_id)
args[1].should.equal(this.user_id)
args[2].should.equal('standard')
args[3].should.deep.equal(this.response)
args[3].should.equal('e2')
args[4].should.deep.equal(this.response)
return done()
}
)
@@ -146,6 +150,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'',
'e2',
(err, serverId) => {
serverId.should.equal('clsi-9')
return done()
@@ -167,6 +172,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response,
null,
err => {
@@ -190,6 +196,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response,
null,
err => {
@@ -208,6 +215,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response,
null,
(err, serverId) => {
@@ -229,6 +237,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response,
null,
(err, serverId) => {
@@ -246,6 +255,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response,
null,
(err, serverId) => {
@@ -276,6 +286,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response,
null,
(err, serverId) => {
@@ -304,6 +315,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'',
'e2',
(err, jar) => {
jar._jar.store.idx['clsi.example.com']['/'][
this.settings.clsiCookie.key
@@ -328,6 +340,7 @@ describe('ClsiCookieManager', function () {
this.project_id,
this.user_id,
'',
'e2',
(err, jar) => {
assert.deepEqual(jar, realRequst.jar())
return done()
@@ -514,6 +514,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
{
method: 'DELETE',
url: `${this.settings.apis.clsi.url}/project/${this.project_id}/user/${this.user_id}?compileBackendClass=e2&compileGroup=standard`,
@@ -965,7 +966,7 @@ describe('ClsiManager', function () {
it('should send the request to the CLSI', function () {
const url = `${this.settings.apis.clsi.url}/project/${this.project_id}/user/${this.user_id}/compile?compileBackendClass=e2&compileGroup=standard`
this.ClsiManager._makeRequest
.calledWith(this.project_id, this.user_id, 'standard', {
.calledWith(this.project_id, this.user_id, 'standard', 'e2', {
method: 'POST',
url,
json: this.req,
@@ -1030,6 +1031,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
{
method: 'GET',
url: `http://clsi.example.com/project/${this.project_id}/user/${this.user_id}/wordcount?compileBackendClass=e2&compileGroup=standard`,
@@ -1067,6 +1069,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
{
method: 'GET',
url: `http://clsi.example.com/project/${this.project_id}/user/${this.user_id}/wordcount?compileBackendClass=e2&compileGroup=standard`,
@@ -1099,6 +1102,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
{
method: 'GET',
url: `http://clsi.example.com/project/${this.project_id}/user/${this.user_id}/wordcount?compileBackendClass=e2&compileGroup=standard`,
@@ -1127,6 +1131,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
() => {
const args = this.request.args[0]
@@ -1143,6 +1148,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
() => {
this.ClsiCookieManager.setServerId
@@ -1150,6 +1156,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response
)
.should.equal(true)
@@ -1175,6 +1182,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
undefined,
err => {
@@ -1194,6 +1202,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
undefined,
err => {
@@ -1203,6 +1212,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.response
)
.should.equal(true)
@@ -1218,6 +1228,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
'node-1',
err => {
@@ -1229,6 +1240,7 @@ describe('ClsiManager', function () {
expect(requestOpts.qs).to.deep.equal({
clsiserverid: 'node-1',
compileGroup: 'standard',
compileBackendClass: 'e2',
})
done()
}
@@ -1240,6 +1252,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
'node-1',
err => {
@@ -1271,6 +1284,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
() => {
const args = this.request.args[0]
@@ -1288,6 +1302,7 @@ describe('ClsiManager', function () {
this.project_id,
this.user_id,
'standard',
'e2',
this.opts,
err => {
expect(err).to.equal(undefined)