feat(scripts): add an ignore file for the explain script

Some of our existing stored procedures fail in the explain script but we
don't want those failures to show up. In the future we may have reasons
for wanting to ignore other procedures too. This change lets us ignore
them while still running the script in CI.
This commit is contained in:
Phil Booth 2018-09-17 13:00:06 +01:00
Родитель 9e9457c39a
Коммит b90688cbc0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B8E710D82AE27976
2 изменённых файлов: 15 добавлений и 0 удалений

4
.explain-ignore Normal file
Просмотреть файл

@ -0,0 +1,4 @@
accountEmails_4
fetchVerificationReminders_2
prune_7
sessionWithDevice_15

Просмотреть файл

@ -68,7 +68,9 @@ Mysql(log, require('../db-server').errors)
.then(db => { .then(db => {
return populateDatabase(db, 0) return populateDatabase(db, 0)
.then(() => { .then(() => {
const ignore = parseIgnoreFile()
return getProcedureNames() return getProcedureNames()
.filter(procedure => ! ignore.has(procedure))
.map(procedure => ({ .map(procedure => ({
procedure, procedure,
path: getPath(procedure) path: getPath(procedure)
@ -272,6 +274,15 @@ function createAccountResetToken (db, uid, tokenId) {
})) }))
} }
function parseIgnoreFile () {
return new Set(
fs.readFileSync('.explain-ignore', RETURN_STRING)
.split('\n')
.map(procedure => procedure.trim())
.filter(procedure => !! procedure)
)
}
function getProcedureNames () { function getProcedureNames () {
return cp.execSync( return cp.execSync(
// eslint-disable-next-line quotes // eslint-disable-next-line quotes