Skip to content

Commit c30bc76

Browse files
committed
test: update output
1 parent 0cd7f43 commit c30bc76

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

tools/api-tester/apitest.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,37 @@ const conf = YAML.parse(fs.readFileSync(config).toString());
6161

6262

6363
const main = async () => {
64+
const results = [];
6465
for (const mountpoint of conf.mountpoints) {
65-
// console.log(`Testing ${mountpoint.path}`);
66-
await test({ mountpoint });
66+
const result = await test({ mountpoint });
67+
results.push(...result);
6768
}
69+
70+
let tbl = {};
71+
for ( const result of results ) {
72+
tbl[result.name + ' - ' + result.settings] = {
73+
passed: result.caseCount - result.failCount,
74+
failed: result.failCount,
75+
total: result.caseCount,
76+
}
77+
}
78+
79+
// hard-coded identifier for ci script
80+
console.log("==================== nightly build results begin ====================")
81+
82+
console.table(tbl);
83+
84+
// hard-coded identifier for ci script
85+
console.log("==================== nightly build results end ====================")
6886
}
6987

88+
/**
89+
* Run test using the given config, and return the test results
90+
*
91+
* @param {Object} options
92+
* @param {Object} options.mountpoint
93+
* @returns {Promise<Object>}
94+
*/
7095
async function test({ mountpoint }) {
7196
const context = {
7297
mountpoint
@@ -106,6 +131,8 @@ async function test({ mountpoint }) {
106131
const all = unit && bench;
107132
if ( all || unit ) ts.printTestResults();
108133
if ( all || bench ) ts.printBenchmarkResults();
134+
135+
return ts.packageResults;
109136
}
110137

111138
const main_e = async () => {
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
url: http://puter.localhost:4001/
2-
username: lavender_hat_6100
1+
url: http://api.puter.localhost:4100/
2+
username: admin
33
token: ---
4+
mountpoints:
5+
- path: /
6+
provider: puterfs
7+
- path: /admin/tmp
8+
provider: memoryfs

tools/api-tester/lib/TestSDK.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ module.exports = class TestSDK {
5858
// === test related methods ===
5959

6060
async runTestPackage (testDefinition) {
61+
// display the fs provider name in the test results
62+
const settings = this.context.mountpoint?.provider;
63+
6164
this.nameStack.push(testDefinition.name);
6265
this.packageResults.push({
66+
settings,
6367
name: testDefinition.name,
6468
failCount: 0,
6569
caseCount: 0,
@@ -160,6 +164,7 @@ module.exports = class TestSDK {
160164
let tbl = {};
161165
for ( const pkg of this.packageResults ) {
162166
tbl[pkg.name] = {
167+
settings: pkg.settings,
163168
passed: pkg.caseCount - pkg.failCount,
164169
failed: pkg.failCount,
165170
total: pkg.caseCount,

0 commit comments

Comments
 (0)