Skip to content

Commit ce2309c

Browse files
authored
Merge pull request #15 from vizzuhq/veghdev
manual and integration test improvements
2 parents c1ddc13 + 9e8d656 commit ce2309c

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

ci/cloudfunctions/getVizzuList/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@ exports.getVizzuList = (req, res) => {
77
const bucket = storage.bucket(bucketName);
88
bucket.getFiles().then(files => {
99
let ans = [];
10+
files[0].sort((a, b) => {
11+
if (a.metadata.updated > b.metadata.updated) {
12+
return 1;
13+
}
14+
if (a.metadata.updated < b.metadata.updated) {
15+
return -1;
16+
}
17+
return 0;
18+
});
1019
files[0].forEach(file => {
1120
let fileEnd = '/vizzu.js'
1221
if (file.name.endsWith(fileEnd)) {
13-
ans.push(file.name.slice(0,-fileEnd.length));
22+
let tmp = {};
23+
tmp.sha = file.name.slice(0,-fileEnd.length)
24+
tmp.time = file.metadata.updated;
25+
ans.push(tmp);
1426
}
1527
});
1628
let message = req.query.message || req.body.message || JSON.stringify(ans);

ci/cloudfunctions/getVizzuList/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "getVizzuList",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"dependencies": {
55
"@google-cloud/storage": "*",
66
"@google-cloud/functions-framework": "*"

test/integration/manual/manual.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class Manual {
3838
libList['HEAD'] = 'https://' + remoteStableBucket + '/lib';
3939
let vizzuListUrl = await fetch('https://' + remoteCloudFunctions + '/getVizzuList');
4040
let vizzuList = await vizzuListUrl.json();
41-
vizzuList.forEach(vizzu => {
42-
libList[vizzu] = 'https://' + remoteLatestBucket + '/' + vizzu;
41+
vizzuList.slice().reverse().forEach(vizzu => {
42+
libList[vizzu.time.substring(0,10) + ' ' + vizzu.time.substring(11,16) + ' ' + vizzu.sha] = 'https://' + remoteLatestBucket + '/' + vizzu.sha;
4343
});
4444
libList['0.2.0'] = 'https://vizzuhq.github.io/vizzu-beta-release/0.2.0';
4545
this.#server.get('/getLibList', (req, res) => {

test/integration/vizzutest.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ try {
3030

3131
#testCasesPath;
3232
#testCases = [];
33+
#testCasesRun = [];
3334
#testCasesData = {};
3435
#testCasesDataPath;
3536

@@ -162,14 +163,15 @@ try {
162163
async runTestSuite() {
163164
try {
164165
await this.#setUrl(argv.vizzuUrl);
165-
let testCases = this.#filterTestCases(argv._);
166-
if (testCases.length > 0) {
166+
this.#testCasesRun = this.#filterTestCases(argv._);
167+
if (this.#testCasesRun.length > 0) {
167168
this.#startTestSuite();
168-
for (let i = 0; i < testCases.length; i++) {
169-
await this.#runTestCase(testCases[i]);
169+
console.log('[ TESTS ]' + ' ' + '[ ' + this.#testCasesRun.length + ' / ' + this.#testCases.length + ' ]');
170+
for (let i = 0; i < this.#testCasesRun.length; i++) {
171+
await this.#runTestCase(i);
170172
}
171173
if (argv.reportLevel != 'DISABLED') {
172-
this.#createJson(__dirname + '/test_report/', testCases);
174+
this.#createJson(__dirname + '/test_report/', this.#testCasesRun);
173175
}
174176
}
175177
} catch (err) {
@@ -236,7 +238,8 @@ try {
236238
}
237239
}
238240

239-
async #runTestCase(testCase) {
241+
async #runTestCase(i) {
242+
let testCase = this.#testCasesRun[i];
240243
let testCaseResultPath = __dirname + '/test_report/' + testCase;
241244
let testCaseData = await this.#runTestCaseClient(testCase, this.#url);
242245
let testCaseResultObject = this.#getTestCaseResult(testCaseData, testCase);
@@ -245,20 +248,20 @@ try {
245248

246249
let createReport = false;
247250
if (testCaseResult == 'PASSED') {
248-
console.log(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ').success + testCase);
251+
console.log(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ').success + '[ ' + String(i + 1).padEnd(String(this.#testCasesRun.length).length, ' ') + ' ] ' + testCase);
249252
this.#testSuiteResults.PASSED.push(testCase);
250253
if (argv.reportLevel == 'INFO') {
251254
createReport = true;
252255
}
253256
} else if (testCaseResult == 'WARNING') {
254-
console.warn(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + testCaseResultObject.testCaseReultDescription + ' ] ').warn + testCase);
257+
console.warn(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + String(i + 1).padEnd(String(this.#testCasesRun.length).length, ' ') + ' ] [ ' + testCaseResultObject.testCaseReultDescription + ' ] ').warn + testCase);
255258
this.#testSuiteResults.WARNING.push(testCase);
256259
if (argv.reportLevel == 'INFO' || argv.reportLevel == 'WARN') {
257260
createReport = true;
258261
}
259262
} else {
260263
let errParts = testCaseResultObject.testCaseReultDescription.split('http://127.0.0.1:' + + String(this.#workspace.getWorkspacePort())).join(path.resolve(this.#workspacePath)).split('\n');
261-
console.error(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + errParts[0] + ' ] ').error + testCase);
264+
console.error(('[ ' + testCaseResult.padEnd(padLength, ' ') + ' ] ' + '[ ' + String(i + 1).padEnd(String(this.#testCasesRun.length).length, ' ') + ' ] [ ' + errParts[0] + ' ] ').error + testCase);
262265
if (errParts.length > 1) {
263266
errParts.slice(1).forEach(item => {
264267
console.error(''.padEnd(padLength + 7, ' ') + item);

0 commit comments

Comments
 (0)