-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Run the isolation tests on Travis, and the functional tests on Circle, and style checks on Shippable #3339
Conversation
Really close! Blocked on Shippable/support#4100 |
This reverts commit cc23dae.
We've already got improvement here! Previously, we had to wait >1hr to run the functional + isolation tests on Travis alone. With this new division, we have:
These run in parallel, so we're already looking at cutting our test time about in half. However, I'm still not satisfied. Shippable is running all of our tests in series, so we loose all of our parallelism. There's also a lot of waiting around required before we get our one container to run a test in. However, once we have a container scheduled, our tests run really really fast. I'm going to make one more test run, this time reducing the number of different builds variants that we queue on shippable. I think this will give even better results. |
Woah, now it's really fast! The shippable build is down to only 17 minutes! We're not done yet, though. The thing is that each serial build only took about four minutes; the tests had to wait about a minute for the first test to start, and then there was another 8-minute delay before the second test started. If we just eliminate the matrix entirely, we can probably cut our test time in half yet again. |
Well that last run was super fast!
Down from an hour to only 7 minutes! That's amazing! The only problem is that there's one failure in the shippable tests. The first set of tests all pass, but then I just re-ran unish.sut.php to rebuild the sut. It did, in fact, build a new sut with Drupal 8.5.x as desired, but the composer-lock-update test failed for some reason. I probably need to rm some files in between the tests. Any ideas? |
So, I was sort of thinking that we could rely on the isolation tests for php version coverage, and just run the functional tests on a single version of php. The problem with this is that there is a lot of code in Drush that is never exercised unless there is a bootstrapped Drupal site. The isolation tests should still parse every file, which will catch some instances where a php-7-only feature creeps into the code base. However, I don't think it would catch everything. I am reluctant to give up on the 7-minute tests. If we added php 5.6 to the functional tests, then we'd be at (7x2) + 1 (wait for first test) + 8 (wait for second test) = 25m. Way better than before, but so so much longer than 7m. We'd be up over an hour again if we split apart the highest / lowest tests again AND added php 5.6. What if we did this instead:
What do you think? Is it worth continuing here? |
Nice work!
|
Yes, the individual tests on shippable are super fast, but there's a long wait to get a container on the free service. We would be up to ~30m to test two versions of PHP on shippable. I can try Circle 2.0 with four parallel builds for the functional tests as you suggested, and perhaps run just the code style tests on shippable. I sort of thought that anyone in drush-ops would have access to the shippable builds, since drush is in drush-ops. However, I logged in to shippable with my github account, so maybe that's the only account that gets admin permissions. This might be another paywall feature to encourage folks to update to premium. Maybe this will be less of an issue if we only use shippable for code style. I was thinking about putting the test results in a table:
If it's not clear from the badge what the service is, we could also put the service name next to the badge (or just let the user find out which service is which when they click through -- although it's good to know offhand which is which, because you only see the service name in pull requests) |
I figured out why that test above is failing. Building the SUT is correctly getting the COMPOSER environment variable set, but I didn't pass the same environment variable along to phpunit, so the test is looking for the wrong composer.lock filename. Not fixing for now, since I'm going to move functional tests to Circle. |
…nning just one set of tests on CircleCI.
Working on swapping the responsibilities of shippable (will run style checks) and circle (will run functional tests). Starting with just one test suite on one php version for now. Eventually we can use our four parallel jobs on Circle to run php 5.6 and 7.1 with composer.json and composer-highest.json. |
MUCH fiddling to get mysql databases working on Circle. |
Almost 12m to run just one test suite on one version of php on circle; a fair bit slower than the same treatment on shippable. Tomorrow I'll see how much that scales up when we run four tests in parallel. This could be quite a big win if they all start up pretty close together. |
So the good news is that the latest failed test took only 15:38 in aggregate, when the slowest individual step in the parallel test suite took 15:35: https://circleci.com/workflow-run/37644a5a-5b8f-489b-85b1-8d9e72e4aac7 By coincidence, the slowest test ran first. It's not clear how much wait time there was for the other tests to start up. In some instances, we might have more than 3s overhead, but overall the efficiency of the parallelism is looking very promising. The failed test will run longer when it succeeds (one step was skipped), but it looks like we stand to gain quite a bit here. One of the odd things about Circle 2.0 is that it requires that you have a step called "build". Since we want to run unish.sut.sh separately for each permutation, we do not need or want to share any build data between the processes. Therefore, I am using the build step to run one of the tests, to save the time we'd have to wait to schedule an extra container. I have therefore named the steps as follows: build: PHP 7.1 + composer.json (Drupal 8.4) We have one more parallel process available to us. We could do a PHP 5.6 + composer_highest, but I thought that maybe it might be worthwhile to make a composer_lowest.json, and test Drupal 8.3 as well. Let me know what you think would be the best use of this last permutation. We could also choose to punt shippable, and use this last slot to run the code style checks. (We'd loose the ability to separately badge the style checks if we did this, though, so I don't think there's any point.) I'm a little mystified by the test failures. In the PHP 5.6 build, it looks like the timezone is not getting set correctly. Maybe the PHP 5.6 container is placing the php.ini file in a different location. On the composer_highest test, I can't come up with any hypothesis about why the tests are failing. The good news, though, is that now that we are running the functional tests on Circle, this gives us the added benefit of being able to ssh into the build to figure stuff like this out. I'll do that later. Moving forward, there are a couple more optimizations we could make. The setup script takes about a minute to run; we could save all of this time if we made a custom docker container that was pre-built with the binaries and settings we need. It is also really easy to use a custom docker container on shippable. I was thinking of making a docker container that has phpenv and all of the main versions of php that we want to support. (Likely someone has already built something like this.) With this sort of container, we could run the lint tests with each supported version of php. This could really help catch instances where version-specific features slip into a PR. |
All green! I'm unsure why there is that entry We still have one more parallel Circle build we could use. I added some badges to the README in a table. Made a typo in one, but I'll fix that. It's a little large; not sure how we should format and place this information. I'll do something similar on the page that has the existing build status badges. The current build times are: Code style on shippable: 1m total, 1m running The amount of time required to wait for a container can be highly variable on shippable and travis; circle, on the other hand, seems to start for us right away. In aggregate, this gets us down from over an hour to under 15 minutes! Pretty darn good. I'm going to do one more build just to clean up the badges. |
I figured out how to fix the problem with the phantom ci/circleci build that never came in. This was a required test that no longer exists. I altered the GLOBAL PROJECT SETTINGS to fix this. We should therefore probably merge this branch pretty soon, as I've sort of messed up all the other PRs here. 😝 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor comments. Feel free to merge.
<<: *defaults | ||
docker: | ||
# We can probably use a standard php container here. Maybe we should make our own w/ everything pre-installed | ||
- image: circleci/php:7.1-apache-node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this override *defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I could remove the image in *defaults, since it is never used.
|
||
# Configure bash environment variables | ||
echo 'export PATH=~/.composer/vendor/bin:~/drush:$PATH' >> $BASH_ENV | ||
echo 'export HOME=/tmp/drush-sandbox/home' >> $BASH_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. My understanding is that all we need to do is assure that TEMP env variable is available. Unish does the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I should have commented on this. The problem is that on Circle CI 2.0 with composer-highest.json, when Unish launches drush
in a subprocess, somehow the HOME
environment variable is whatever it was set to by the process that called Unish, regardless of what Unish tries to set it to. It is very odd that a) this does not seem to happen with the composer.json test (implying that the cause is in symfony/process), although b) this does not seem to happen with any test in the old Travis CI scripts. Setting HOME to what the drush subprocess expects it to be is a workaround, but this would break again if the Unish path calculation for HOME
changed again in the future. 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is related to the comment in CommandUnishTestCase::execute()
tests/UnishTestCase.php
Outdated
@@ -603,7 +603,7 @@ public function installDrupal($env = 'dev', $install = false) | |||
'db-url' => $this->dbUrl($env), | |||
'sites-subdir' => $uri, | |||
'yes' => null, | |||
'quiet' => null, | |||
'debug' => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed anymore?
This PR aims to refactor the tests such that:
There are two advantages to splitting the isolation tests from the functional tests:
I'm reducing the functional tests to only run on one version of php; shippable does support Travis-style php version selection that will run tests across the whole matrix, though, so it would be possible to test both a 5.x and a 7.x version of php if desired.
It's better to run the unit tests on Travis and the functional tests on Shippable, as Travis has better availability for php versions (w/out making a custom container), and the functional tests are less sensitive to the exact php version used.
Maybe the README might need more badges if we do this. 😄