Skip to content

Commit ce16727

Browse files
authored
Merge pull request #1569 from plotly/better-image-test-logs
Better image test logs
2 parents f6f2048 + b55e411 commit ce16727

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Developers are strongly encouraged to first make a PR to their own plotly.js for
44

55
Before opening a pull request, developer should:
66

7-
- `git rebase` their local branch off the latest `master`
8-
- make sure to **not** `git add` the `dist/` folder (the `dist/` is updated only on verion bumps)
9-
- write an overview of what the PR attempts to do.
7+
- `git rebase` their local branch off the latest `master`,
8+
- make sure to **not** `git add` the `dist/` folder (the `dist/` is updated only on verion bumps),
9+
- write an overview of what the PR attempts to do,
10+
- select the _Allow edits from maintainers_ option (see this [article](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) for more details).
1011

1112
Note that it is forbidden to force push (i.e. `git push -f`) to remote branches associated with opened pull requests. Force pushes make it hard for maintainers to keep track of updates. Therefore, if required, please `git merge master` into your PR branch instead of `git rebase master`.

tasks/util/container_commands.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ containerCommands.dockerRun = [
2929
'--name', constants.testContainerName,
3030
'-v', constants.pathToRoot + ':' + constants.testContainerHome,
3131
'-p', constants.testContainerPort + ':' + constants.testContainerPort,
32-
'plotly/testbed:latest'
32+
constants.testContainerImage
3333
].join(' ');
3434

3535
containerCommands.getRunCmd = function(isCI, commands) {

test/image/compare_pixels_test.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ function comparePixels(mockName, cb) {
212212
imagePaths = getImagePaths(mockName),
213213
saveImageStream = fs.createWriteStream(imagePaths.test);
214214

215+
function log(msg) {
216+
process.stdout.write('Error for', mockName + ':', msg);
217+
}
218+
215219
function checkImage() {
216220

217221
// baseline image must be generated first
@@ -253,8 +257,8 @@ function comparePixels(mockName, cb) {
253257
function onEqualityCheck(err, isEqual) {
254258
if(err) {
255259
common.touch(imagePaths.diff);
256-
console.error(err);
257-
return;
260+
log(err);
261+
return cb(false, mockName);
258262
}
259263
if(isEqual) {
260264
fs.unlinkSync(imagePaths.diff);
@@ -266,12 +270,20 @@ function comparePixels(mockName, cb) {
266270
// 525 means a plotly.js error
267271
function onResponse(response) {
268272
if(+response.statusCode === 525) {
269-
console.error('plotly.js error while generating', mockName);
270-
cb(false, mockName);
273+
log('plotly.js error');
274+
return cb(false, mockName);
271275
}
272276
}
273277

278+
// this catches connection errors
279+
// e.g. when the image server blows up
280+
function onError(err) {
281+
log(err);
282+
return cb(false, mockName);
283+
}
284+
274285
request(requestOpts)
286+
.on('error', onError)
275287
.on('response', onResponse)
276288
.pipe(saveImageStream)
277289
.on('close', checkImage);

0 commit comments

Comments
 (0)