From 6323a0f1a4ce43ef3f2801ff8a33c87e4ebd1209 Mon Sep 17 00:00:00 2001 From: Elexy Date: Thu, 22 Nov 2018 11:39:31 +0100 Subject: [PATCH 1/2] integrated local-extract and aded to the dashboard --- infrastructure/grafana/dashboard.json | 890 ++++++++++++++++++++++++-- runner/config.js | 11 +- runner/persistence.js | 2 +- tests/local-add.js | 10 +- tests/local-extract.js | 28 +- tests/local-transfer.js | 1 + 6 files changed, 883 insertions(+), 59 deletions(-) diff --git a/infrastructure/grafana/dashboard.json b/infrastructure/grafana/dashboard.json index 2e672dca..24f536ed 100644 --- a/infrastructure/grafana/dashboard.json +++ b/infrastructure/grafana/dashboard.json @@ -30,7 +30,7 @@ "datasource": null, "format": "ms", "gauge": { - "maxValue": 500, + "maxValue": 1000, "minValue": 0, "show": true, "thresholdLabels": false, @@ -42,7 +42,7 @@ "x": 0, "y": 0 }, - "id": 4, + "id": 25, "interval": null, "links": [], "mappingType": 1, @@ -79,6 +79,7 @@ "tableColumn": "", "targets": [ { + "alias": "largeFile", "groupBy": [ { "params": [ @@ -114,15 +115,15 @@ ], "tags": [ { - "key": "project", + "key": "testClass", "operator": "=", - "value": "js-ipfs" + "value": "largefile" }, { "condition": "AND", - "key": "testClass", + "key": "project", "operator": "=", - "value": "smallfile" + "value": "js-ipfs" }, { "condition": "AND", @@ -133,8 +134,8 @@ ] } ], - "thresholds": "500, 350, 250", - "title": "empty/small", + "thresholds": "1000, 750, 400", + "title": "empty / large", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ @@ -158,7 +159,7 @@ "datasource": null, "format": "ms", "gauge": { - "maxValue": 1000, + "maxValue": 500, "minValue": 0, "show": true, "thresholdLabels": false, @@ -170,7 +171,7 @@ "x": 3, "y": 0 }, - "id": 6, + "id": 23, "interval": null, "links": [], "mappingType": 1, @@ -207,7 +208,6 @@ "tableColumn": "", "targets": [ { - "alias": "largeFile", "groupBy": [ { "params": [ @@ -243,15 +243,15 @@ ], "tags": [ { - "key": "testClass", + "key": "project", "operator": "=", - "value": "largefile" + "value": "js-ipfs" }, { "condition": "AND", - "key": "project", + "key": "testClass", "operator": "=", - "value": "js-ipfs" + "value": "smallfile" }, { "condition": "AND", @@ -262,8 +262,8 @@ ] } ], - "thresholds": "1000, 750, 400", - "title": "empty / large", + "thresholds": "500, 350, 250", + "title": "empty/small", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ @@ -606,7 +606,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -635,7 +635,7 @@ "condition": "AND", "key": "subTest", "operator": "=", - "value": "add-empty-repo" + "value": "empty-repo" }, { "condition": "AND", @@ -734,7 +734,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -763,7 +763,7 @@ "condition": "AND", "key": "subTest", "operator": "=", - "value": "add-empty-repo" + "value": "empty-repo" }, { "condition": "AND", @@ -862,7 +862,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -891,7 +891,7 @@ "condition": "AND", "key": "subTest", "operator": "=", - "value": "add-populated-repo" + "value": "populated-repo" }, { "condition": "AND", @@ -990,7 +990,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -1019,7 +1019,7 @@ "condition": "AND", "key": "subTest", "operator": "=", - "value": "add-populated-repo" + "value": "populated-repo" }, { "condition": "AND", @@ -1124,7 +1124,7 @@ "condition": "AND", "key": "testClass", "operator": "=", - "value": "largefile" + "value": "smallfile" }, { "condition": "AND", @@ -1179,7 +1179,7 @@ "condition": "AND", "key": "testClass", "operator": "=", - "value": "smallfile" + "value": "largefile" }, { "condition": "AND", @@ -1234,7 +1234,7 @@ "condition": "AND", "key": "testClass", "operator": "=", - "value": "smallfile" + "value": "largefile" }, { "condition": "AND", @@ -1289,7 +1289,7 @@ "condition": "AND", "key": "testClass", "operator": "=", - "value": "largefile" + "value": "smallfile" }, { "condition": "AND", @@ -1394,7 +1394,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "A", @@ -1417,7 +1417,7 @@ { "key": "subTest", "operator": "=", - "value": "add-empty-repo" + "value": "empty-repo" }, { "condition": "AND", @@ -1443,7 +1443,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "C", @@ -1466,7 +1466,7 @@ { "key": "subTest", "operator": "=", - "value": "add-empty-repo" + "value": "empty-repo" }, { "condition": "AND", @@ -1492,7 +1492,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "D", @@ -1515,7 +1515,7 @@ { "key": "subTest", "operator": "=", - "value": "add-populated-repo" + "value": "populated-repo" }, { "condition": "AND", @@ -1541,7 +1541,7 @@ "type": "fill" } ], - "measurement": "unixFS", + "measurement": "unixFS-add", "orderByTime": "ASC", "policy": "default", "refId": "B", @@ -1564,7 +1564,7 @@ { "key": "subTest", "operator": "=", - "value": "add-populated-repo" + "value": "populated-repo" }, { "condition": "AND", @@ -1614,6 +1614,818 @@ "align": false, "alignLevel": null } + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#d44a3a", + "rgba(237, 129, 40, 0.89)", + "#299c46" + ], + "datasource": null, + "format": "ms", + "gauge": { + "maxValue": 500, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 0, + "y": 10 + }, + "id": 4, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "tags": [ + { + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "testClass", + "operator": "=", + "value": "smallfile" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "empty-repo" + } + ] + } + ], + "thresholds": "500, 350, 250", + "title": "empty/small", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#d44a3a", + "rgba(237, 129, 40, 0.89)", + "#299c46" + ], + "datasource": null, + "format": "ms", + "gauge": { + "maxValue": 1000, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 3, + "y": 10 + }, + "id": 6, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "alias": "largeFile", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "tags": [ + { + "key": "testClass", + "operator": "=", + "value": "largefile" + }, + { + "condition": "AND", + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "empty-repo" + } + ] + } + ], + "thresholds": "1000, 750, 400", + "title": "empty / large", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": null, + "format": "ms", + "gauge": { + "maxValue": 10, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 6, + "y": 10 + }, + "id": 26, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "tags": [ + { + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "populated-repo" + }, + { + "condition": "AND", + "key": "testClass", + "operator": "=", + "value": "smallfile" + } + ] + } + ], + "thresholds": "3,5,7", + "title": "populated / small", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": null, + "format": "ms", + "gauge": { + "maxValue": 50, + "minValue": 0, + "show": true, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 9, + "y": 10 + }, + "id": 27, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "last" + } + ] + ], + "tags": [ + { + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "populated-repo" + }, + { + "condition": "AND", + "key": "testClass", + "operator": "=", + "value": "largefile" + } + ] + } + ], + "thresholds": "20,30,40", + "title": "populated / large", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "avg" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 13 + }, + "id": 28, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "alias": "small file - empty repo", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "testClass", + "operator": "=", + "value": "smallfile" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "empty-repo" + } + ] + }, + { + "alias": "large file - empty repo", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "B", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "testClass", + "operator": "=", + "value": "largefile" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "empty-repo" + } + ] + }, + { + "alias": "large file - populated repo", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "C", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "testClass", + "operator": "=", + "value": "largefile" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "populated-repo" + } + ] + }, + { + "alias": "small file - populated repo", + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "none" + ], + "type": "fill" + } + ], + "measurement": "unixFS-extract", + "orderByTime": "ASC", + "policy": "default", + "refId": "D", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [ + { + "key": "project", + "operator": "=", + "value": "js-ipfs" + }, + { + "condition": "AND", + "key": "testClass", + "operator": "=", + "value": "smallfile" + }, + { + "condition": "AND", + "key": "subTest", + "operator": "=", + "value": "populated-repo" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Local Extract", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transparent": false, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "short", + "label": "milliseconds", + "logBase": 10, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } } ], "refresh": "10s", @@ -1624,7 +2436,7 @@ "list": [] }, "time": { - "from": "now-3h", + "from": "now-30m", "to": "now" }, "timepicker": { @@ -1655,5 +2467,5 @@ "timezone": "", "title": "IPFS performance", "uid": "nxBZpJBmk", - "version": 5 + "version": 19 } \ No newline at end of file diff --git a/runner/config.js b/runner/config.js index 8b6913c8..cd456811 100644 --- a/runner/config.js +++ b/runner/config.js @@ -34,13 +34,18 @@ const getBenchmarkHostname = () => { const tests = [ { name: 'localTransfer', - shell: `rm -Rf /tmp/peerb && source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-transfer.js`, + shell: `source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-transfer.js`, localShell: 'OUT_FOLDER=/tmp/out REMOTE=true node ' + path.join(__dirname, '/../tests/local-transfer.js') }, { - name: 'unixFS', - shell: `rm -Rf /tmp/peerb && source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-add.js`, + name: 'unixFS-add', + shell: `source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-add.js`, localShell: 'OUT_FOLDER=/tmp/out REMOTE=true node ' + path.join(__dirname, '/../tests/local-add.js') + }, + { + name: 'unixFS-extract', + shell: `source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-extract.js`, + localShell: 'OUT_FOLDER=/tmp/out REMOTE=true node ' + path.join(__dirname, '/../tests/local-extract.js') } ] diff --git a/runner/persistence.js b/runner/persistence.js index b07aeab0..a8ce90ca 100644 --- a/runner/persistence.js +++ b/runner/persistence.js @@ -23,7 +23,7 @@ const writePoints = (data) => { for (let point of data) { payload.push({ measurement: point.name, - tags: { subTest: point.subTest, commit: point.meta.commit, project: point.meta.project, testClass: point.testClass }, + tags: { subTest: point.subtest, commit: point.meta.commit, project: point.meta.project, testClass: point.testClass }, fields: { duration: parseDuration(point.duration) }, timestamp: moment(point.date).toDate() }) diff --git a/tests/local-add.js b/tests/local-add.js index 70ae6cce..0a7e4552 100644 --- a/tests/local-add.js +++ b/tests/local-add.js @@ -7,7 +7,7 @@ const { store } = require('./lib/output') const fixtures = require('./lib/fixtures') const clean = require('./lib/clean') -const testName = 'unixFS' +const testName = 'unixFS-add' async function localAdd (node, name, subtest, testClass) { try { @@ -35,7 +35,7 @@ async function scenarios () { try { const node = await ipfsNode() let arrResults = [] - arrResults.push(await localAdd(node, testName, 'add-empty-repo', 'largefile')) + arrResults.push(await localAdd(node, testName, 'empty-repo', 'largefile')) const node1 = await ipfsNode({ 'Addresses': { 'API': '/ip4/127.0.0.1/tcp/5013', @@ -48,11 +48,11 @@ async function scenarios () { 'Bootstrap': [] }) - arrResults.push(await localAdd(node1, testName, 'add-empty-repo', 'smallfile')) + arrResults.push(await localAdd(node1, testName, 'empty-repo', 'smallfile')) - arrResults.push(await localAdd(node1, testName, 'add-populated-repo', 'smallfile')) + arrResults.push(await localAdd(node1, testName, 'populated-repo', 'smallfile')) - arrResults.push(await localAdd(node, testName, 'add-populated-repo', 'largefile')) + arrResults.push(await localAdd(node, testName, 'populated-repo', 'largefile')) store(arrResults) diff --git a/tests/local-extract.js b/tests/local-extract.js index 09b05b85..2baee2cd 100644 --- a/tests/local-extract.js +++ b/tests/local-extract.js @@ -3,11 +3,15 @@ const fs = require('fs') const ipfsNode = require('./lib/create-node.js') const { build } = require('./schema/results') -const { write } = require('./lib/output') +const { store } = require('./lib/output') +const fixtures = require('./lib/fixtures') +const clean = require('./lib/clean') -async function localExtract (node, name, subtest, file, testClass) { +const testName = 'unixFS-extract' + +async function localExtract (node, name, subtest, testClass) { try { - const fileStream = fs.createReadStream(file) + const fileStream = fs.createReadStream(fixtures[testClass]) const inserted = await node.files.add(fileStream) const start = process.hrtime() const validCID = inserted[0].hash @@ -16,7 +20,7 @@ async function localExtract (node, name, subtest, file, testClass) { return build({ name: name, subtest: subtest, - file: file, + file: fixtures[testClass], description: 'Get file to local repo', testClass: testClass, duration: { s: end[0], @@ -26,12 +30,12 @@ async function localExtract (node, name, subtest, file, testClass) { throw Error(err) } } -const results = [] async function scenarios () { try { + let arrResults = [] const node = await ipfsNode() - write(await localExtract(node, 'unixFS', 'extract-emptyRepo', './fixtures/200Bytes.txt', 'smallfile')) + arrResults.push(await localExtract(node, testName, 'empty-repo', 'smallfile')) const node1 = await ipfsNode({ 'Addresses': { 'API': '/ip4/127.0.0.1/tcp/5013', @@ -44,16 +48,18 @@ async function scenarios () { 'Bootstrap': [] }) - const r = await localExtract(node1, 'unixFS', 'extract-emptyRepo', './fixtures/1.2MiB.txt', 'largefile') - write(r) - results.push(r) + const r = await localExtract(node1, testName, 'empty-repo', 'largefile') + arrResults.push(r) + + arrResults.push(await localExtract(node1, testName, 'populated-repo', 'smallfile')) - write(await localExtract(node1, 'unixFS', 'extract', './fixtures/200Bytes.txt', 'smallfile')) + arrResults.push(await localExtract(node, testName, 'populated-repo', 'largefile')) - write(await localExtract(node, 'unixFS', 'extract', './fixtures/1.2MiB.txt', 'largefile')) + store(arrResults) node.stop() node1.stop() + clean.peerRepos() } catch (err) { throw Error(err) } diff --git a/tests/local-transfer.js b/tests/local-transfer.js index 9578d303..61b1752d 100644 --- a/tests/local-transfer.js +++ b/tests/local-transfer.js @@ -7,6 +7,7 @@ const fixtures = require('./lib/fixtures.js') const { store } = require('./lib/output') const { build } = require('./schema/results') const clean = require('./lib/clean') + const testName = 'localTransfer' const log = (msg) => { From 394d6927494d0ce1aac90cc461635472367dbeb2 Mon Sep 17 00:00:00 2001 From: Elexy Date: Thu, 22 Nov 2018 17:07:11 +0100 Subject: [PATCH 2/2] abstract some repeated strings --- runner/config.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/runner/config.js b/runner/config.js index cd456811..38273f18 100644 --- a/runner/config.js +++ b/runner/config.js @@ -10,6 +10,8 @@ let pino const inventoryPath = path.join(__dirname, '../infrastructure/inventory/inventory.yaml') const playbookPath = path.join(__dirname, '../infrastructure/playbooks/benchmarks.yaml') const remoteTestsPath = process.env.REMOTE_FOLDER || '~/ipfs/tests/' +const params = 'OUT_FOLDER=/tmp/out REMOTE=true' +const remotePreCommand = `source ~/.nvm/nvm.sh && ${params}` // pretty logs in local if (process.env.LOG_PRETTY === 'true') { @@ -34,18 +36,18 @@ const getBenchmarkHostname = () => { const tests = [ { name: 'localTransfer', - shell: `source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-transfer.js`, - localShell: 'OUT_FOLDER=/tmp/out REMOTE=true node ' + path.join(__dirname, '/../tests/local-transfer.js') + shell: `${remotePreCommand} REMOTE=true node ${remoteTestsPath}/local-transfer.js`, + localShell: `${params} node ${path.join(__dirname, '/../tests/local-transfer.js')}` }, { name: 'unixFS-add', - shell: `source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-add.js`, - localShell: 'OUT_FOLDER=/tmp/out REMOTE=true node ' + path.join(__dirname, '/../tests/local-add.js') + shell: `${remotePreCommand} REMOTE=true node ${remoteTestsPath}/local-add.js`, + localShell: `${params} node ${path.join(__dirname, '/../tests/local-add.js')}` }, { name: 'unixFS-extract', - shell: `source ~/.nvm/nvm.sh && OUT_FOLDER=/tmp/out REMOTE=true node ${remoteTestsPath}/local-extract.js`, - localShell: 'OUT_FOLDER=/tmp/out REMOTE=true node ' + path.join(__dirname, '/../tests/local-extract.js') + shell: `${remotePreCommand} REMOTE=true node ${remoteTestsPath}/local-extract.js`, + localShell: `${params} node ${path.join(__dirname, '/../tests/local-extract.js')}` } ]