Skip to content

Shard gl jasmine tests #2933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Aug 21, 2018
Merged

Shard gl jasmine tests #2933

merged 16 commits into from
Aug 21, 2018

Conversation

etpinard
Copy link
Contributor

resolves #2922 (hopefully)

This PR adds a sharding script that splits our jasmine test suites into groups of a given number of it blocks. We use it here to shard jasmine tests with tag @gl, but the same logic could eventually be used in other jasmine tests.

To make the sharding logic simple and predictable, we enforce the following jasmine test tag rules:

  • @gl, @noCI, @noCIdep and @flaky are the only allowed tags
  • @gl and @flaky can't be set in describe blocks, only in it blocks
  • a given it block can't have both a@gl and a @flaky tag (i.e. all @gl are flaky and are in runned in retry loop on ci, setting both tags is redundant)

Along the way, commit 7712507 made gl2d_plot_interact_test.js and gl2d_click_test.js more robust and bdf468e moved the @flaky test run from jasmine) to jasmine2) on CI. Things appear to be working fine: many 📗 runs are occuring in succession on CI.

cc @alexcjohnson hopefully this will be enough to not have to worry about intermittent failures for a while.

@@ -34,7 +35,12 @@ case $1 in
;;

jasmine2)
retry npm run test-jasmine -- --tags=gl --skip-tags=noCI,flaky
SHARDS=($(node $ROOT/tasks/shard_jasmine_tests.js --tag=gl))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node tasks/shard_jasmine_tests.js --tag=gl outputs:

gl2d_plot_interact_test.js
gl3d_plot_interact_test.js
parcoords_test.js
gl2d_click_test.js
splom_test.js,cartesian_test.js,gl2d_scatterplot_contour_test.js,gl2d_pointcloud_test.js,gl_plot_interact_basic_test.js
streamtube_test.js,gl2d_date_axis_render_test.js,cone_test.js

which is then converted into a bash array (that's the outer ()) and then looped below.

glob(path.join(pathToJasmineTests, '*.js'), function(err, files) {
if(err) throw err;

var file2cnt = {};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to note, with --limit=20 and --tag=gl, this fills up to:

{ 'cartesian_test.js': 1,
  'cone_test.js': 5,
  'gl_plot_interact_basic_test.js': 2,
  'gl2d_click_test.js': 20,
  'gl2d_date_axis_render_test.js': 4,
  'gl2d_plot_interact_test.js': 28,
  'gl2d_pointcloud_test.js': 2,
  'gl2d_scatterplot_contour_test.js': 2,
  'gl3d_plot_interact_test.js': 26,
  'parcoords_test.js': 30,
  'splom_test.js': 10,
  'streamtube_test.js': 10 }

Plotly.purge(gd);
destroyGraphDiv();
setTimeout(done, 1000);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this appears to reduce the number of intermittent failures (and the number of retry attempts) a little.

@alexcjohnson
Copy link
Collaborator

Nice! 💃

Non-blocking: This leaves test-jasmine2 a bit long, would be great if we can shift the burden a bit onto other suites, to get the total time under 10 minutes. But not now, lets merge this and get ourselves up and running again!

@alexcjohnson
Copy link
Collaborator

Another (non-blocking) thought to speed up test-jasmine2 - have only the final retry run to completion, let all the others fail fast.

@etpinard
Copy link
Contributor Author

have only the final retry run to completion, let all the others fail fast.

That's a great idea. I'll push another commit this morning.


I was also looking at ways to make the retry not waste time bundling on every attempt. I couldn't find anything in user land, but this could be a nice karma plugin. Bundling our test code takes about ~10s, over multiple retries we can easily spend 1 minute just bundling code.

- which makes karma exits upon first test failure
- this might help us debug intermittent failures in our tests
@@ -235,6 +241,8 @@ func.defaultConfig = {
suppressPassed: true,
suppressSkipped: false,
showSpecTiming: false,
// use 'karma-fail-fast-reporter' to fail fast w/o conflicting
// with other karma plugins
failFast: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this failFast shouldn't ever be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting it to true won't break anything, but it won't actually fail fast.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More on this topic: to make karma-spec-reporter fail fast, one needs to add it to the plugins list: https://github.com/mlex/karma-spec-reporter#configuration

When doing so, it conflicts with karma-browserify.

There might be a way, to list them (order dependent?) so that they don't conflict, but using karma-fail-fast-reporter was easy enough.

n=$[$n+1]
done

if [ $n -eq $MAX_AUTO_RETRY ]; then
log "one last time, w/o failing fast"
"$@" && n=0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

man, shell scripts are ugly... that said, very nicely done 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the cleanest solution I could think of 😑

- this is a relic from the circular-dependency era,
- we use to have to do this in order to run test per-suite to
  setup the registry correctly.
- this should speed bundling times in single-suite runs
@alexcjohnson
Copy link
Collaborator

💃 is still dancing.

@etpinard etpinard merged commit 3c1adeb into master Aug 21, 2018
@etpinard etpinard deleted the shard-gl-tests branch August 21, 2018 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find robust way to split jasmine tests in different karma runs
2 participants