Skip to content

Commit

Permalink
chore(qa): New progress bar for gen3qa-run checks (#532)
Browse files Browse the repository at this point in the history
* chore(qa): New progress bar for gen3qa-run checks

* save logs to file and also print to the console
  • Loading branch information
Marcelo R Costa authored Dec 17, 2020
1 parent f98078f commit 84411d6
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 12 deletions.
62 changes: 56 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"nock": "^12.0.3",
"node-fetch": "^2.6.1",
"node-ssh": "^7.0.1",
"progress-bar": "^0.1.1",
"cli-progress": "^3.8.2",
"prettier": "^1.19.1",
"request": "^2.88.2",
"selenium-standalone": "^6.20.0",
Expand Down
11 changes: 6 additions & 5 deletions suites/google/checkAllProjectsGoogleBucketAccessTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
Feature('CheckAllProjectsGoogleBucketAccess');

const bar = require('progress-bar');
const bar = require('cli-progress');
const axios = require('axios');
const log4js = require('log4js');
const {
Expand All @@ -39,13 +39,14 @@ log4js.configure({
type: 'file',
filename: 'all-projects-google-bucket-access-check.log',
},
console: { type: 'console' },
},
categories: {
default: { appenders: ['accessCheck'], level: 'debug' },
default: { appenders: ['accessCheck', 'console'], level: 'debug' },
},
});
const logger = log4js.getLogger('accessCheck');
const progressBar = bar.create(process.stdout);
const progressBar = new bar.SingleBar({}, bar.Presets.shades_classic);

const indexdFilter = process.env.INDEXD_FILTER || 'all';
let numOfCompletedChecks = 0;
Expand Down Expand Up @@ -93,8 +94,7 @@ async function checkAccess(I, a, indexdQueryParam) {
logger.warn(`Zero indexd records found for ${indexdQueryParam} ${a}`);
}
numOfCompletedChecks += 1;
const progress = (numOfCompletedChecks / I.cache.numOfChecks);
progressBar.update(progress);
progressBar.update(numOfCompletedChecks);

// Sleep for a sec to avoid stressing fence
await sleepMS(1000);
Expand Down Expand Up @@ -138,6 +138,7 @@ Scenario('Fetch list of projects (acl/authz) from environment @manual @prjsGoogl
I.cache.authzs = authz;
I.cache.numOfChecks += authz.length;
}
progressBar.start(I.cache.numOfChecks, 0);
});

Scenario('Run PreSigned URL checks against an indexd record from each project @manual @prjsGoogleBucketAccess', async ({ I }) => {
Expand Down

0 comments on commit 84411d6

Please sign in to comment.