From 9c6f4e5cc369d01d326b9f11a5abecf3863ec057 Mon Sep 17 00:00:00 2001 From: Jun HU Date: Fri, 4 Dec 2015 18:08:47 -0500 Subject: [PATCH 1/9] using supervisor instead --- circle.yml | 4 ++-- dist/plotly-geo-assets.js | 7 +------ docker-compose.yml | 2 +- tasks/baseline.sh | 4 ++-- tasks/test_image.sh | 4 ++-- test/image/compare_pixels_test.js | 1 + 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/circle.yml b/circle.yml index 2615242402e..0560615af7a 100644 --- a/circle.yml +++ b/circle.yml @@ -12,10 +12,10 @@ machine: dependencies: pre: - - docker pull plotly/imageserver:latest + - docker pull plotly/imageserver:candidate post: - npm run cibuild - - docker run -d --name myimageserver -v $PWD:/var/www/streambed/image_server/plotly.js -p 9010:9010 plotly/imageserver:latest; sleep 20 + - docker run -d --name myimageserver -v $PWD:/var/www/streambed/image_server/plotly.js -p 9010:9010 plotly/imageserver:candidate test: override: diff --git a/dist/plotly-geo-assets.js b/dist/plotly-geo-assets.js index 0764d59895f..329376f3dbf 100644 --- a/dist/plotly-geo-assets.js +++ b/dist/plotly-geo-assets.js @@ -1,9 +1,3 @@ -/** -* plotly.js v1.1.1 -* Copyright 2012-2015, Plotly, Inc. -* All rights reserved. -* Licensed under the MIT license -*/ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PlotlyGeoAssets = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Date: Fri, 4 Dec 2015 18:13:01 -0500 Subject: [PATCH 2/9] add wait for response --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 0560615af7a..b96e4f8f81e 100644 --- a/circle.yml +++ b/circle.yml @@ -16,7 +16,7 @@ dependencies: post: - npm run cibuild - docker run -d --name myimageserver -v $PWD:/var/www/streambed/image_server/plotly.js -p 9010:9010 plotly/imageserver:candidate - + - wget --server-response --spider --tries=8 --retry-connrefused http://localhost:9010/ping test: override: - sudo lxc-attach -n "$(docker inspect --format '{{.Id}}' myimageserver)" -- bash -c "cd /var/www/streambed/image_server/plotly.js && node test/image/compare_pixels_test.js" From f9c717e67bbf955bb8325054241b373cfcb66fd6 Mon Sep 17 00:00:00 2001 From: Jun HU Date: Fri, 4 Dec 2015 18:29:33 -0500 Subject: [PATCH 3/9] try only 20 tests --- test/image/compare_pixels_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 9d489041b5a..79e8973a13d 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -42,7 +42,7 @@ function runAll () { */ t.plan(files.length - 40); - for (var i = 0; i < files.length; i ++) { + for (var i = 0; i < 20; i ++) { testMock(files[i], t); } From 117a10e6aebff5c6a63a9173c1f387802d30dd76 Mon Sep 17 00:00:00 2001 From: Jun HU Date: Mon, 7 Dec 2015 15:04:14 -0500 Subject: [PATCH 4/9] change image --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2b1107dca97..6d89d50a34a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ dev: container_name: imagetest - image: moi/testing #plotly/imageserver:latest + image: plotly/imageserver:candidate #plotly/imageserver:latest volumes: - .:/var/www/streambed/image_server/plotly.js ports: From 1bad5887636b09ff4e331a9aaeac8e723838bbd3 Mon Sep 17 00:00:00 2001 From: etpinard Date: Mon, 7 Dec 2015 18:28:34 -0500 Subject: [PATCH 5/9] lint --- test/image/compare_pixels_test.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 79e8973a13d..8a90ccfa34d 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -9,18 +9,23 @@ var request = require('request'); var test = require('tape'); var gm = require('gm'); +var touch = function(fileName) { + fs.closeSync(fs.openSync(fileName, 'w')); +}; + // make artifact folders -if(!fs.existsSync(constants.pathToTestImagesDiff)) fs.mkdirSync(constants.pathToTestImagesDiff); -if(!fs.existsSync(constants.pathToTestImages)) fs.mkdirSync(constants.pathToTestImages); +if(!fs.existsSync(constants.pathToTestImagesDiff)) { + fs.mkdirSync(constants.pathToTestImagesDiff); +} +if(!fs.existsSync(constants.pathToTestImages)) { + fs.mkdirSync(constants.pathToTestImages); +} var userFileName = process.argv[2]; -var touch = function(fileName) { - fs.closeSync(fs.openSync(fileName, 'w')); -}; - -if (!userFileName) runAll(); +// run the test(s) +if(!userFileName) runAll(); else runSingle(userFileName); function runAll () { @@ -107,7 +112,6 @@ function testMock (fileName, t) { } request(options) - .on('response', function() { console.log('pong') }) .pipe(savedImageStream) .on('close', checkImage); } From a3c21d5aad7de98e2f6df7949ebb850a95509abf Mon Sep 17 00:00:00 2001 From: etpinard Date: Mon, 7 Dec 2015 18:29:18 -0500 Subject: [PATCH 6/9] test images in batches: - by calling testMock inside setTimeout --- test/image/compare_pixels_test.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 8a90ccfa34d..2001ab80660 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -31,7 +31,7 @@ else runSingle(userFileName); function runAll () { test('testing mocks', function (t) { - var files = fs.readdirSync(constants.pathToTestImageMocks); + var allMocks = fs.readdirSync(constants.pathToTestImageMocks); /* * Some test cases exhibit run-to-run randomness; @@ -45,10 +45,16 @@ function runAll () { * - all gl2d (38) * - gl2d_bunny-hull (1) */ - t.plan(files.length - 40); + t.plan(allMocks.length - 40); - for (var i = 0; i < 20; i ++) { - testMock(files[i], t); + var BASE_TIMEOUT = 500, + BATCH_SIZE = 5, + cnt = 0; + + for(var i = 0; i < allMocks.length; i++) { + setTimeout(function() { + testMock(allMocks[cnt++], t); + }, BASE_TIMEOUT * Math.floor(i / BATCH_SIZE) * BATCH_SIZE); } }); From 61e4c194e5d4a5323f8c4b5e65fa1f3dfdb0a20b Mon Sep 17 00:00:00 2001 From: etpinard Date: Tue, 8 Dec 2015 09:55:57 -0500 Subject: [PATCH 7/9] filter mocks before calling testMock in loop: - rm polar_scatter.json for now (it is showing some run-to-run randomness) --- test/image/compare_pixels_test.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index 2001ab80660..fea0b97016b 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -40,12 +40,20 @@ function runAll () { * More info: * https://github.com/plotly/plotly.js/issues/62 * - * 40 test cases are removed: + * 41 test cases are removed: * - font-wishlist (1 test case) * - all gl2d (38) - * - gl2d_bunny-hull (1) + * - gl3d_bunny-hull (1) + * - polar_scatter (1) */ - t.plan(allMocks.length - 40); + var mocks = allMocks.filter(function(mock) { + return !( + mock === 'font-wishlist.json' || + mock.indexOf('gl2d') !== -1 || + mock === 'gl3d_bunny-hull.json' || + mock === 'polar_scatter.json' + ); + }); var BASE_TIMEOUT = 500, BATCH_SIZE = 5, @@ -55,6 +63,8 @@ function runAll () { setTimeout(function() { testMock(allMocks[cnt++], t); }, BASE_TIMEOUT * Math.floor(i / BATCH_SIZE) * BATCH_SIZE); + t.plan(mocks.length); + } }); @@ -68,15 +78,6 @@ function runSingle (userFileName) { } function testMock (fileName, t) { - if(path.extname(fileName) !== '.json') return; - if(fileName === 'font-wishlist.json' && !userFileName) return; - - // TODO fix race condition in gl2d image generation - if(fileName.indexOf('gl2d_') !== -1) return; - - // TODO fix run-to-run randomness - if(fileName === 'gl3d_bunny-hull.json') return; - var figure = require(path.join(constants.pathToTestImageMocks, fileName)); var bodyMock = { figure: figure, From a805c802cd7528d4a11e87f121042410b28179a1 Mon Sep 17 00:00:00 2001 From: etpinard Date: Tue, 8 Dec 2015 09:56:07 -0500 Subject: [PATCH 8/9] lint + add comments --- test/image/compare_pixels_test.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/image/compare_pixels_test.js b/test/image/compare_pixels_test.js index fea0b97016b..b85099df378 100644 --- a/test/image/compare_pixels_test.js +++ b/test/image/compare_pixels_test.js @@ -55,16 +55,19 @@ function runAll () { ); }); - var BASE_TIMEOUT = 500, - BATCH_SIZE = 5, + var BASE_TIMEOUT = 500, // base timeout time + BATCH_SIZE = 5, // size of each test 'batch' cnt = 0; - for(var i = 0; i < allMocks.length; i++) { - setTimeout(function() { - testMock(allMocks[cnt++], t); - }, BASE_TIMEOUT * Math.floor(i / BATCH_SIZE) * BATCH_SIZE); + function testFunction() { + testMock(mocks[cnt++], t); + } + t.plan(mocks.length); + for(var i = 0; i < mocks.length; i++) { + setTimeout(testFunction, + BASE_TIMEOUT * Math.floor(i / BATCH_SIZE) * BATCH_SIZE); } }); From b4aa68bf2d03f2ce7c50f83211c0f6fb6362e76e Mon Sep 17 00:00:00 2001 From: etpinard Date: Tue, 8 Dec 2015 14:16:40 -0500 Subject: [PATCH 9/9] replace 'candidate' image with 'latest' --- circle.yml | 4 ++-- docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index b96e4f8f81e..672e1e5328e 100644 --- a/circle.yml +++ b/circle.yml @@ -12,10 +12,10 @@ machine: dependencies: pre: - - docker pull plotly/imageserver:candidate + - docker pull plotly/imageserver:latest post: - npm run cibuild - - docker run -d --name myimageserver -v $PWD:/var/www/streambed/image_server/plotly.js -p 9010:9010 plotly/imageserver:candidate + - docker run -d --name myimageserver -v $PWD:/var/www/streambed/image_server/plotly.js -p 9010:9010 plotly/imageserver:latest - wget --server-response --spider --tries=8 --retry-connrefused http://localhost:9010/ping test: override: diff --git a/docker-compose.yml b/docker-compose.yml index 6d89d50a34a..c5e54bb707f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,9 +13,9 @@ dev: container_name: imagetest - image: plotly/imageserver:candidate #plotly/imageserver:latest + image: plotly/imageserver:latest volumes: - .:/var/www/streambed/image_server/plotly.js ports: - "9010:9010" - - "2022:22" \ No newline at end of file + - "2022:22"