Send clear cache requests to the correct CLSI group

This commit is contained in:
James Allen
2014-12-01 12:19:01 +00:00
parent e0178b17b5
commit c70c048aae
6 changed files with 51 additions and 42 deletions
@@ -77,15 +77,27 @@ describe "ClsiManager", ->
describe "deleteAuxFiles", ->
beforeEach ->
@request.del = sinon.stub().callsArg(1)
@ClsiManager.deleteAuxFiles @project_id, @callback
describe "with the standard compileGroup", ->
beforeEach ->
@ClsiManager.deleteAuxFiles @project_id, {compileGroup: "standard"}, @callback
it "should call the delete method in the CLSI", ->
@request.del
.calledWith("#{@settings.apis.clsi.url}/project/#{@project_id}")
.should.equal true
it "should call the delete method in the standard CLSI", ->
@request.del
.calledWith("#{@settings.apis.clsi.url}/project/#{@project_id}")
.should.equal true
it "should call the callback", ->
@callback.called.should.equal true
it "should call the callback", ->
@callback.called.should.equal true
describe "with the priority compileGroup", ->
beforeEach ->
@ClsiManager.deleteAuxFiles @project_id, {compileGroup: "priority"}, @callback
it "should call the delete method in the CLSI", ->
@request.del
.calledWith("#{@settings.apis.clsi_priority.url}/project/#{@project_id}")
.should.equal true
describe "_buildRequest", ->
beforeEach ->
@@ -181,14 +181,14 @@ describe "CompileController", ->
describe "deleteAuxFiles", ->
beforeEach ->
@ClsiManager.deleteAuxFiles = sinon.stub().callsArg(1)
@CompileManager.deleteAuxFiles = sinon.stub().callsArg(1)
@req.params =
Project_id: @project_id
@res.send = sinon.stub()
@CompileController.deleteAuxFiles @req, @res, @next
it "should proxy to the CLSI", ->
@ClsiManager.deleteAuxFiles
@CompileManager.deleteAuxFiles
.calledWith(@project_id)
.should.equal true
@@ -134,26 +134,25 @@ describe "CompileManager", ->
compileGroup: @group
})
.should.equal true
describe "getLogLines", ->
describe "deleteAuxFiles", ->
beforeEach ->
@ClsiManager.getLogLines = sinon.stub().callsArgWith(1, null, @lines = ["log", "lines"])
@CompileManager.getLogLines @project_id, @callback
it "should call the new api", ->
@ClsiManager.getLogLines
@CompileManager.getProjectCompileLimits = sinon.stub().callsArgWith 1, null, @limits = { compileGroup: "mock-compile-group" }
@ClsiManager.deleteAuxFiles = sinon.stub().callsArg(2)
@CompileManager.deleteAuxFiles @project_id, @callback
it "should look up the compile group to use", ->
@CompileManager.getProjectCompileLimits
.calledWith(@project_id)
.should.equal true
it "should call the callback with the lines", ->
@callback
.calledWith(null, @lines)
.should.equal true
it "should increase the log count metric", ->
@Metrics.inc
.calledWith("editor.raw-logs")
it "should delete the aux files", ->
@ClsiManager.deleteAuxFiles
.calledWith(@project_id, @limits)
.should.equal true
it "should call the callback", ->
@callback.called.should.equal true
describe "_checkIfRecentlyCompiled", ->
describe "when the key exists in redis", ->