Skip to content

Commit

Permalink
test: use eslint in daily tests (#3355)
Browse files Browse the repository at this point in the history
Description
---
- adds eslint to daily tests
- fix a number of lints
- fix broken git pull command

Motivation and Context
---
Small feedback loop for errors on daily tests will prevent constant fixing of "silly" mistakes 

How Has This Been Tested?
---
eslint passes
  • Loading branch information
sdbondi authored Sep 16, 2021
1 parent 8163ef8 commit 154402d
Show file tree
Hide file tree
Showing 9 changed files with 4,821 additions and 126 deletions.
36 changes: 36 additions & 0 deletions applications/daily_tests/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["prettier", "@babel"],
"env": {
"browser": true,
"commonjs": true,
"node": true,
"es2021": true
},
"parser": "@babel/eslint-parser", // Tell ESLint that you want to use the @babel/eslint-parser.
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module",
"allowImportExportEverywhere": false,
"ecmaFeatures": {
"globalReturn": false
},
"requireConfigFile": false
},
"rules": {
"no-undef": "error",
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"prettier/prettier": [
"error",
{
"doubleQuote": true,
"endOfLine": "auto"
}
]
}
}
2 changes: 1 addition & 1 deletion applications/daily_tests/automatic_recovery_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const helpers = require("./helpers");
const WalletProcess = require("integration_tests/helpers/walletProcess");

const RECOVERY_COMPLETE_REGEXP = /Recovery complete! Scanned = (\d+) in/;
const RECOVERY_WORTH_REGEXP = /worth ([0-9\.]+) (µ?T)/;
const RECOVERY_WORTH_REGEXP = /worth ([0-9.]+) (µ?T)/;
const FAILURE_REGEXP =
/Attempt (\d+)\/(\d+): Failed to complete wallet recovery/;

Expand Down
12 changes: 9 additions & 3 deletions applications/daily_tests/cron_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ const WEBHOOK_CHANNEL = "protocol-bot-stuff";

function failed(message) {
console.error(message);
if (!!getWebhookUrl()) {
if (getWebhookUrl()) {
sendWebhookNotification(WEBHOOK_CHANNEL, `🚨 ${message}`);
}
process.exit(1);
}

function notify(message) {
console.log(message);
if (!!getWebhookUrl()) {
if (getWebhookUrl()) {
sendWebhookNotification(WEBHOOK_CHANNEL, message);
}
}
Expand Down Expand Up @@ -141,7 +141,13 @@ async function main() {
runBaseNodeSyncTest(SyncType.Archival)
).start();
new CronJob("30 6 * * *", () => runBaseNodeSyncTest(SyncType.Pruned)).start();
new CronJob("0 4 * * *", () => git.pull(__dirname)).start();
new CronJob("0 4 * * *", () =>
git.pull(__dirname).catch((err) => {
failed("Failed to update git repo");
console.error(err);
return Promise.resolve(null);
})
).start();

console.log("⏱ Cron jobs started.");
}
Expand Down
2 changes: 0 additions & 2 deletions applications/daily_tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,8 @@ const git = {
});
ps.on("close", (exitCode) => {
if (exitCode && exitCode !== 0) {
console.error(`child process exited with code ${exitCode}`);
reject(`child process exited with code ${exitCode}`);
} else {
console.log(command);
resolve(null);
}
});
Expand Down
Loading

0 comments on commit 154402d

Please sign in to comment.