[misc] use a directory in /tmp for temporary data

This commit is contained in:
Jakob Ackermann 2020-03-27 11:10:27 +01:00 committed by Jakob Ackermann
parent b9deec1095
commit 101c4ea4dc
2 changed files with 17 additions and 16 deletions

View file

@ -12,10 +12,6 @@ chown node:node /app/cache
chown node:node /app/compiles chown node:node /app/compiles
chown node:node /app/db chown node:node /app/db
# acceptance tests
mkdir -p /app/test/acceptance/fixtures/tmp/
chown -R node:node /app/test/acceptance/fixtures
# make synctex available for remount in compiles # make synctex available for remount in compiles
cp /app/bin/synctex /app/bin/synctex-mount/synctex cp /app/bin/synctex /app/bin/synctex-mount/synctex

View file

@ -19,11 +19,17 @@ const Client = require('./helpers/Client')
const request = require('request') const request = require('request')
require('chai').should() require('chai').should()
const fs = require('fs') const fs = require('fs')
const fsExtra = require('fs-extra')
const ChildProcess = require('child_process') const ChildProcess = require('child_process')
const ClsiApp = require('./helpers/ClsiApp') const ClsiApp = require('./helpers/ClsiApp')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const Path = require('path') const Path = require('path')
const fixturePath = path => Path.normalize(__dirname + '/../fixtures/' + path) const fixturePath = path => {
if (path.slice(0, 3) === 'tmp') {
return '/tmp/clsi_acceptance_tests' + path.slice(3)
}
return Path.normalize(__dirname + '/../fixtures/' + path)
}
const process = require('process') const process = require('process')
console.log( console.log(
process.pid, process.pid,
@ -32,13 +38,6 @@ console.log(
process.getgroups(), process.getgroups(),
'PID' 'PID'
) )
try {
console.log('creating tmp directory', fixturePath('tmp'))
fs.mkdirSync(fixturePath('tmp'))
} catch (error) {
const err = error
console.log(err, fixturePath('tmp'), 'unable to create fixture tmp path')
}
const MOCHA_LATEX_TIMEOUT = 60 * 1000 const MOCHA_LATEX_TIMEOUT = 60 * 1000
@ -201,10 +200,16 @@ Client.runServer(4242, fixturePath('examples'))
describe('Example Documents', function() { describe('Example Documents', function() {
before(function(done) { before(function(done) {
return ChildProcess.exec('rm test/acceptance/fixtures/tmp/*').on( ClsiApp.ensureRunning(done)
'exit', })
() => ClsiApp.ensureRunning(done) before(function(done) {
) fsExtra.remove(fixturePath('tmp'), done)
})
before(function(done) {
fs.mkdir(fixturePath('tmp'), done)
})
after(function(done) {
fsExtra.remove(fixturePath('tmp'), done)
}) })
return Array.from(fs.readdirSync(fixturePath('examples'))).map(example_dir => return Array.from(fs.readdirSync(fixturePath('examples'))).map(example_dir =>