Răsfoiți Sursa

remove stat test for missing files

Brian Gough 9 ani în urmă
părinte
comite
2a23082c4e

+ 5 - 18
services/clsi/app/coffee/ResourceStateManager.coffee

@@ -4,7 +4,6 @@ logger = require "logger-sharelatex"
 settings = require("settings-sharelatex")
 Errors = require "./Errors"
 SafeReader = require "./SafeReader"
-async = require "async"
 
 module.exports = ResourceStateManager =
 
@@ -61,21 +60,9 @@ module.exports = ResourceStateManager =
 		seenFile = {}
 		for file in allFiles
 			seenFile[file] = true
-		missingFileCandidates = (resource.path for resource in resources when not seenFile[resource.path])
-		# now check if they are really missing
-		ResourceStateManager._checkMissingFiles missingFileCandidates, basePath, (missingFiles) ->
-			if missingFiles?.length > 0
-				logger.err missingFiles:missingFiles, basePath:basePath, allFiles:allFiles, resources:resources, "missing input files for project"
-				return callback new Errors.FilesOutOfSyncError("resource files missing in incremental update")
-			else
-				callback()
-
-	_checkMissingFiles: (missingFileCandidates, basePath, callback = (missingFiles) ->) ->
-		if missingFileCandidates.length > 0
-			fileDoesNotExist = (file, cb) ->
-				fs.stat Path.join(basePath, file), (err) ->
-					logger.log file:file, err:err, result: err?, "stating potential missing file"
-					cb(err?)
-			async.filterSeries missingFileCandidates, fileDoesNotExist, callback
+		missingFiles = (resource.path for resource in resources when not seenFile[resource.path])
+		if missingFiles?.length > 0
+			logger.err missingFiles:missingFiles, basePath:basePath, allFiles:allFiles, resources:resources, "missing input files for project"
+			return callback new Errors.FilesOutOfSyncError("resource files missing in incremental update")
 		else
-			callback([])
+			callback()

+ 0 - 15
services/clsi/test/unit/coffee/ResourceStateManagerTests.coffee

@@ -88,27 +88,12 @@ describe "ResourceStateManager", ->
 			it "should call the callback", ->
 				@callback.calledWithExactly().should.equal true
 
-		describe "when there is a file missing from the outputFileFinder but present on disk", ->
-			beforeEach ->
-				@allFiles = [ @resources[0].path, @resources[1].path]
-				@fs.stat = sinon.stub().callsArg(1)
-				@ResourceStateManager.checkResourceFiles(@resources, @allFiles, @basePath, @callback)
-
-			it "should stat the file to see if it is present", ->
-				@fs.stat.called.should.equal true
-
-			it "should call the callback", ->
-				@callback.calledWithExactly().should.equal true
-
 		describe "when there is a missing file", ->
 			beforeEach ->
 				@allFiles = [ @resources[0].path, @resources[1].path]
 				@fs.stat = sinon.stub().callsArgWith(1, new Error())
 				@ResourceStateManager.checkResourceFiles(@resources, @allFiles, @basePath, @callback)
 
-			it "should stat the file to see if it is present", ->
-				@fs.stat.called.should.equal true
-
 			it "should call the callback with an error", ->
 				error = new Errors.FilesOutOfSyncError("resource files missing in incremental update")
 				@callback.calledWith(error).should.equal true