diff --git a/client/.gitignore b/client/.gitignore index 1026d1331..89b01c0f4 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,4 +1,5 @@ node_modules build/ coverage/ -test/*png +*.png +test/perfjankie/data diff --git a/client/package.json b/client/package.json index 650e59ccb..5209154d9 100644 --- a/client/package.json +++ b/client/package.json @@ -85,7 +85,11 @@ "lint": "eslint app", "clean": "rm build/app.js", "noprobe": "../scope stop && ../scope launch --no-probe --app.window 8760h", - "loadreport": "npm run noprobe && sleep 1 && curl -X POST -H \"Content-Type: application/json\" http://$BACKEND_HOST/api/report -d" + "loadreport": "npm run noprobe && sleep 1 && curl -X POST -H \"Content-Type: application/json\" http://$BACKEND_HOST/api/report -d", + "perf:setup" : "docker-compose -f test/perfjankie/docker-compose.yml up -d", + "perf:run" : ". test/run-jankie.sh", + "perf:cleanup" : "docker-compose -f test/perfjankie/docker-compose.yml down", + "perf" : "npm run perf:setup && npm run perf:run" }, "jest": { "scriptPreprocessor": "/node_modules/babel-jest", diff --git a/client/test/actions/90-nodes-select.js b/client/test/actions/90-nodes-select.js index 0a457557c..f5e56f291 100644 --- a/client/test/actions/90-nodes-select.js +++ b/client/test/actions/90-nodes-select.js @@ -36,7 +36,6 @@ function deselectNode(browser) { module.exports = function(cfg) { - var startUrl = 'http://' + cfg.host + '/'; // cfg - The configuration object. args, from the example above. return function(browser) { @@ -103,16 +102,12 @@ module.exports = function(cfg) { debug('scenario done'); }); }) - .catch(e => { - console.error(e); - }) .fail(function(err) { debug('exception. taking screenshot', err); browser.takeScreenshot(function(err, data) { if (err) { debug(err); } else { - debugger; var base64Data = data.replace(/^data:image\/png;base64,/,""); fs.writeFile('90-nodes-select-' + cfg.run + '.png', base64Data, 'base64', function(err) { if(err) debug(err); diff --git a/client/test/perfjankie/Dockerfile b/client/test/perfjankie/Dockerfile deleted file mode 100644 index 30cbf6bc0..000000000 --- a/client/test/perfjankie/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM couchdb:1.6 - -COPY local.ini /usr/local/etc/couchdb/ - -EXPOSE 5984 diff --git a/client/test/perfjankie/data/_replicator.couch b/client/test/perfjankie/data/_replicator.couch deleted file mode 100755 index b8dbbebd0..000000000 Binary files a/client/test/perfjankie/data/_replicator.couch and /dev/null differ diff --git a/client/test/perfjankie/data/_users.couch b/client/test/perfjankie/data/_users.couch deleted file mode 100755 index 70df30c93..000000000 Binary files a/client/test/perfjankie/data/_users.couch and /dev/null differ diff --git a/client/test/perfjankie/data/performance.couch b/client/test/perfjankie/data/performance.couch deleted file mode 100755 index 38e1a59a6..000000000 Binary files a/client/test/perfjankie/data/performance.couch and /dev/null differ diff --git a/client/test/perfjankie/docker-compose.yml b/client/test/perfjankie/docker-compose.yml index 5af6c5925..99d493473 100644 --- a/client/test/perfjankie/docker-compose.yml +++ b/client/test/perfjankie/docker-compose.yml @@ -1,22 +1,27 @@ version : '2' services: - # nginx: - # container_name: 'nginx' - # image: 'nginx' - # volumes: - # - ./nginx.conf:/etc/nginx/nginx.conf:ro - # links: - # - couchdb - # ports: - # - '5984:5984' + probe: + container_name: 'scope-perf-probe' + image: weaveworks/scope + pid: "host" + privileged: true + labels: + - "works.weave.role=system" + volumes: + - "/var/run/docker.sock:/var/run/docker.sock:rw" + command: + - "--probe.docker" + - "true" selenium: container_name: 'selenium' image: 'elgalu/selenium' + links: + - probe ports: - '4444:24444' - '5900:25900' environment: - - TZ="US/Pacific" + - TZ='US/Pacific' shm_size: 1g couchdb: container_name: 'couchdb' diff --git a/client/test/perfjankie/main.js b/client/test/perfjankie/main.js index a79e27551..4401b7240 100644 --- a/client/test/perfjankie/main.js +++ b/client/test/perfjankie/main.js @@ -1,24 +1,25 @@ var perfjankie = require('perfjankie'); -var run = process.env.COMMIT || 'commit#590f0078e79e9fb968c8b9f8e5e5ce0a96fa4825'; // A hash for the commit, displayed in the x-axis in the dashboard +var run = process.env.COMMIT || 'commit#Hash'; // A hash for the commit, displayed in the x-axis in the dashboard var time = process.env.DATE || new Date().getTime() // Used to sort the data when displaying graph. Can be the time when a commit was made var scenario = process.env.ACTIONS || '90-nodes-select'; -var host = process.env.HOST || 'localhost:4040'; +var host = process.env.HOST || 'probe:4040'; var actions = require('../actions/' + scenario)({host: host, run: run}); -debugger; +var log = (s) => { console.log(s); } + perfjankie({ /* The next set of values identify the test */ suite: 'Scope', name: scenario, // A friendly name for the URL. This is shown as component name in the dashboard time: time, run: run, - repeat: 10, // Run the tests 10 times. Default is 1 time + repeat: 5, // Run the tests 10 times. Default is 1 time /* Identifies where the data and the dashboard are saved */ couch: { - server: 'http://localhost:5984', - database: 'performance' - // updateSite: !process.env.CI, // If true, updates the couchApp that shows the dashboard. Set to false in when running Continuous integration, run this the first time using command line. + server: 'http://local.docker:5984', + database: 'performance', + updateSite: !process.env.CI, // If true, updates the couchApp that shows the dashboard. Set to false in when running Continuous integration, run this the first time using command line. // onlyUpdateSite: false // No data to upload, just update the site. Recommended to do from dev box as couchDB instance may require special access to create views. }, @@ -48,8 +49,24 @@ perfjankie({ actions: actions, selenium: { - hostname: 'local.docker', // or localhost or hub.browserstack.com + hostname: 'localhost', // or localhost or hub.browserstack.com port: 4444, - } + }, + // log: { // Expects the following methods, + // fatal: log, + // error: grunt.fail.warn.bind(grunt.fail), + // warn: grunt.log.error.bind(grunt.log), + // info: grunt.log.ok.bind(grunt.log), + // debug: grunt.verbose.writeln.bind(grunt.verbose), + // trace: grunt.log.debug.bind(grunt.log) + // } + log: [ + 'fatal', + 'error', + 'warn', + 'info', + 'debug', + 'trace' + ].reduce(n => (r, i) => { r[i] = log }, {}) }); diff --git a/client/test/perfjankie/out.json b/client/test/perfjankie/out.json deleted file mode 100644 index 5bcd4b5fe..000000000 --- a/client/test/perfjankie/out.json +++ /dev/null @@ -1,12 +0,0 @@ -[ { Error: [init({"browserName":"chrome","chromeOptions":{"perfLoggingPrefs":{"traceCategories":"toplevel,disabled-by-default-devtools.timeline.frame,blink.console,disabled-by-default-devtools.timeline,benchmark,blink.console,devtools.timeline,disabled-by-default-devtools.timeline,toplevel,disabled-by-default-devtools.timeline.frame,benchmark"},"args":["--enable-gpu-benchmarking","--enable-thread-composting"]},"loggingPrefs":{"performance":"ALL"}})] The environment you requested was unavailable. - at /Users/jpellizzari/Projects/go/src/github.com/weaveworks/scope/client/node_modules/wd/lib/webdriver.js:129:15 - at Request._callback (/Users/jpellizzari/Projects/go/src/github.com/weaveworks/scope/client/node_modules/wd/lib/http-utils.js:87:7) - at Request.self.callback (/Users/jpellizzari/Projects/go/src/github.com/weaveworks/scope/client/node_modules/wd/node_modules/request/request.js:368:22) - at emitTwo (events.js:106:13) - at Request.emit (events.js:191:7) - at Request. (/Users/jpellizzari/Projects/go/src/github.com/weaveworks/scope/client/node_modules/wd/node_modules/request/request.js:1219:14) - at emitOne (events.js:101:20) - at Request.emit (events.js:188:7) - at IncomingMessage. (/Users/jpellizzari/Projects/go/src/github.com/weaveworks/scope/client/node_modules/wd/node_modules/request/request.js:1167:12) - at emitNone (events.js:91:20) - data: '{"state":"unknown error","sessionId":null,"hCode":501768309,"value":{"localizedMessage":"The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html","cause":null,"stackTrace":[{"fileName":"Preconditions.java","nativeMethod":false,"methodName":"checkState","className":"com.google.common.base.Preconditions","hCode":-1301733662,"lineNumber":199,"class":"java.lang.StackTraceElement"},{"fileName":"DriverService.java","nativeMethod":false,"methodName":"findExecutable","className":"org.openqa.selenium.remote.service.DriverService","hCode":-1432293605,"lineNumber":109,"class":"java.lang.StackTraceElement"},{"fileName":"ChromeDriverService.java","nativeMethod":false,"methodName":"access$000","className":"org.openqa.selenium.chrome.ChromeDriverService","hCode":-1230567666,"lineNumber":32,"class":"java.lang.StackTraceElement"},{"fileName":"ChromeDriverService.java","nativeMethod":false,"methodName":"findDefaultExecutable","className":"org.openqa.selenium.chrome.ChromeDriverService$Builder","hCode":-1770001534,"lineNumber":137,"class":"java.lang.StackTraceElement"},{"fileName":"DriverService.java","nativeMethod":false,"methodName":"build","className":"org.openqa.selenium.remote.service.DriverService$Builder","hCode":778286186,"lineNumber":296,"class":"java.lang.StackTraceElement"},{"fileName":"ChromeDriverService.java","nativeMethod":false,"methodName":"createDefaultService","className":"org.openqa.selenium.chrome.ChromeDriverService","hCode":-1740331610,"lineNumber":88,"class":"java.lang.StackTraceElement"},{"fileName":"ChromeDriver.java","nativeMethod":false,"methodName":"","className":"org.openqa.selenium.chrome.ChromeDriver","hCode":988971970,"lineNumber":142,"class":"java.lang.StackTraceElement"},{"fileName":"NativeConstructorAccessorImpl.java","nativeMethod":true,"methodName":"newInstance0","className":"sun.reflect.NativeConstructorAccessorImpl","hCode":-917798116,"lineNumber":-2,"class":"java.lang.StackTraceElement"},{"fileName":"NativeConstructorAccessorImpl.java","nativeMethod":false,"methodName":"newInstance","className":"sun.reflect.NativeConstructorAccessorImpl","hCode":-1864225098,"lineNumber":62,"class":"java.lang.StackTraceElement"},{"fileName":"DelegatingConstructorAccessorImpl.java","nativeMethod":false,"methodName":"newInstance","className":"sun.reflect.DelegatingConstructorAccessorImpl","hCode":-2122307259,"lineNumber":45,"class":"java.lang.StackTraceElement"},{"fileName":"Constructor.java","nativeMethod":false,"methodName":"newInstance","className":"java.lang.reflect.Constructor","hCode":-1319859919,"lineNumber":423,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultDriverProvider.java","nativeMethod":false,"methodName":"callConstructor","className":"org.openqa.selenium.remote.server.DefaultDriverProvider","hCode":-2096353668,"lineNumber":103,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultDriverProvider.java","nativeMethod":false,"methodName":"newInstance","className":"org.openqa.selenium.remote.server.DefaultDriverProvider","hCode":1201680335,"lineNumber":97,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultDriverFactory.java","nativeMethod":false,"methodName":"newInstance","className":"org.openqa.selenium.remote.server.DefaultDriverFactory","hCode":-1365021416,"lineNumber":60,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultSession.java","nativeMethod":false,"methodName":"call","className":"org.openqa.selenium.remote.server.DefaultSession$BrowserCreator","hCode":2056168471,"lineNumber":222,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultSession.java","nativeMethod":false,"methodName":"call","className":"org.openqa.selenium.remote.server.DefaultSession$BrowserCreator","hCode":2056168458,"lineNumber":209,"class":"java.lang.StackTraceElement"},{"fileName":"FutureTask.java","nativeMethod":false,"methodName":"run","className":"java.util.concurrent.FutureTask","hCode":-820313554,"lineNumber":266,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultSession.java","nativeMethod":false,"methodName":"run","className":"org.openqa.selenium.remote.server.DefaultSession$1","hCode":-255143467,"lineNumber":176,"class":"java.lang.StackTraceElement"},{"fileName":"ThreadPoolExecutor.java","nativeMethod":false,"methodName":"runWorker","className":"java.util.concurrent.ThreadPoolExecutor","hCode":-1285150184,"lineNumber":1142,"class":"java.lang.StackTraceElement"},{"fileName":"ThreadPoolExecutor.java","nativeMethod":false,"methodName":"run","className":"java.util.concurrent.ThreadPoolExecutor$Worker","hCode":-242190645,"lineNumber":617,"class":"java.lang.StackTraceElement"},{"fileName":"Thread.java","nativeMethod":false,"methodName":"run","className":"java.lang.Thread","hCode":-82946320,"lineNumber":745,"class":"java.lang.StackTraceElement"}],"suppressed":[],"message":"The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html","hCode":1545013890,"class":"java.lang.IllegalStateException","screen":null},"class":"org.openqa.selenium.remote.Response","status":13}' } ] diff --git a/client/test/run-jankie.sh b/client/test/run-jankie.sh index 005c8444a..6fe05616f 100755 --- a/client/test/run-jankie.sh +++ b/client/test/run-jankie.sh @@ -35,6 +35,5 @@ echo "Testing $COMMIT on $DATE" # ../../scope stop # make SUDO= -C ../.. # ../../scope launch -# sleep 5 - -COMMIT="$COMMIT" DATE=$DATE HOST=$HOST DEBUG=scope* node ./perfjankie/main.js +sleep 5 +COMMIT="$COMMIT" DATE=$DATE HOST=$HOST DEBUG=scope* node test/perfjankie/main.js