Skip to content
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

Split cypress tests #6241

Merged
merged 2 commits into from
Nov 15, 2018
Merged

Conversation

timifasubaa
Copy link
Contributor

@timifasubaa timifasubaa commented Oct 31, 2018

This PR reduces the cypress runtime from ~18 minutes to ~11 minutes. It uses a few techniques listed below:

  1. splitting the tests into several independent components run in parallel
  2. using subprocesses to run non-dependent build up step in each test in parallel
  3. removes the recording of video that we weren't using

It also times each subcomponent so we can track how the times are growing

@mistercrunch @michellethomas @john-bodley

@timifasubaa timifasubaa force-pushed the split_cypress_tests branch 5 times, most recently from d0c83a3 to ec218d0 Compare October 31, 2018 09:01
@codecov-io
Copy link

codecov-io commented Oct 31, 2018

Codecov Report

Merging #6241 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6241   +/-   ##
=======================================
  Coverage   77.31%   77.31%           
=======================================
  Files          67       67           
  Lines        9581     9581           
=======================================
  Hits         7408     7408           
  Misses       2173     2173

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb55668...741c06f. Read the comment docs.

@timifasubaa timifasubaa force-pushed the split_cypress_tests branch 10 times, most recently from 22888d1 to f050685 Compare November 10, 2018 00:32
@timifasubaa timifasubaa force-pushed the split_cypress_tests branch 13 times, most recently from c2d83c3 to a070e4a Compare November 11, 2018 12:09
@timifasubaa timifasubaa force-pushed the split_cypress_tests branch 11 times, most recently from 8840356 to 34fb0d6 Compare November 13, 2018 01:04
@timifasubaa timifasubaa changed the title [WIP] Split cypress tests Split cypress tests Nov 13, 2018
@timifasubaa timifasubaa force-pushed the split_cypress_tests branch 2 times, most recently from 697fac5 to f5a9033 Compare November 13, 2018 01:35
npm run build
npm run cypress run
#run all the python steps in a background process
(time /home/travis/build/apache/incubator-superset/superset/bin/superset db upgrade; time /home/travis/build/apache/incubator-superset/superset/bin/superset load_test_users; /home/travis/build/apache/incubator-superset/superset/bin/superset load_examples; time /home/travis/build/apache/incubator-superset/superset/bin/superset init; echo "[completed python build steps]"; flask run -p 8081 --with-threads --reload --debugger) &
Copy link
Contributor

Choose a reason for hiding this comment

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

did you mean to leave the time statements in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I left it there so we can see how long each subpart takes

@michellethomas
Copy link
Contributor

🙏 thanks so much for doing this 👍

.travis.yml Outdated
@@ -4,7 +4,33 @@ jobs:
include:
- language: python
python: 3.6
env: TOXENV=cypress
env: TOXENV=cypress_dashboard
Copy link
Member

Choose a reason for hiding this comment

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

Using a matrix here might help to reduce the repetition.

tox.ini Outdated
@@ -45,9 +45,31 @@ setenv =
whitelist_externals =
npm

[testenv:cypress]
[testenv:cypress_dashboard]
Copy link
Member

Choose a reason for hiding this comment

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

The use of factor conditions for the command could help reduce the repetition.

npm run build
npm run cypress run
#run all the python steps in a background process
(time /home/travis/build/apache/incubator-superset/superset/bin/superset db upgrade; time /home/travis/build/apache/incubator-superset/superset/bin/superset load_test_users; /home/travis/build/apache/incubator-superset/superset/bin/superset load_examples; time /home/travis/build/apache/incubator-superset/superset/bin/superset init; echo "[completed python build steps]"; flask run -p 8081 --with-threads --reload --debugger) &
Copy link
Member

Choose a reason for hiding this comment

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

Should we be using && rather than ; here per this?

Copy link
Contributor Author

@timifasubaa timifasubaa Nov 14, 2018

Choose a reason for hiding this comment

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

I think either way is fine. They will both lead to a failed build if something goes wrong in the middle

#run all the python steps in a background process
(time /home/travis/build/apache/incubator-superset/superset/bin/superset db upgrade; time /home/travis/build/apache/incubator-superset/superset/bin/superset load_test_users; /home/travis/build/apache/incubator-superset/superset/bin/superset load_examples; time /home/travis/build/apache/incubator-superset/superset/bin/superset init; echo "[completed python build steps]"; flask run -p 8081 --with-threads --reload --debugger) &

#block on the longer running javascript process
Copy link
Member

Choose a reason for hiding this comment

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

It seems like we should have flask run run after we've run npm run build as then there's no need to background the task above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

npm run build takes a really long time esp when it freezes on 92%. So I decided to put in as much as possible in the background while it is running so as to save the time it will take to run if it were to run after npm run build

(time /home/travis/build/apache/incubator-superset/superset/bin/superset db upgrade; time /home/travis/build/apache/incubator-superset/superset/bin/superset load_test_users; /home/travis/build/apache/incubator-superset/superset/bin/superset load_examples; time /home/travis/build/apache/incubator-superset/superset/bin/superset init; echo "[completed python build steps]"; flask run -p 8081 --with-threads --reload --debugger) &

#block on the longer running javascript process
(time yarn install --frozen-lockfile; time npm run build; echo "[completed js build steps]")
Copy link
Member

Choose a reason for hiding this comment

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

See note ^^.

@timifasubaa timifasubaa merged commit c17de39 into apache:master Nov 15, 2018
bipinsoniguavus pushed a commit to ThalesGroup/incubator-superset that referenced this pull request Dec 26, 2018
* aplit cypress tests

* split into three
@ktmud ktmud mentioned this pull request Apr 9, 2020
7 tasks
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants