Problem/Motivation
This issue is raised for discussion.
Currently a single bare Drupal installation is around 41.3Mb, this includes a multitude of tests. For some people on cheaper shared hosting packages, this is a large part of their storage allowance. On a production site, do we really need all the tests that are normally used for module/theme or core development?
Proposed resolution
Create a new distribution of Drupal 8 core (before release) with all tests and Simpletest removed. This will reduce the installation size by around 15.4Mb and decrease upload time significantly. This should be clearly identified as for production sites, and should indicate the difference to the normal distribution.
Remaining tasks
Document the new distribution, making users aware of the advantage to using this for production.
User interface changes
SimpleTest module can be removed, and all functional tests.
API changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drupal8_size.png | 164.15 KB | mbrett5062 |
| Tests_NoTests.JPG | 69.98 KB | mbrett5062 |
Comments
Comment #1
mbrett5062 commentedJust this morning I downloaded a clean copy of Drupal 8 Dev, then proceeded to remove all tests and the simpletest module and PHPUnit from a copy of the download.
I have installed both and done as much manual testing as I can, and as far as I can see everything works fine.
Here is a comparison screenshot of the relative size of the installation.
Comment #2
mbrett5062 commentedComment #3
dawehner... You should have described which directories you could remove. You might have for example not removed the phpunit tests from both core as
well as the vendor dependencies.
Comment #4
mbrett5062 commentedOK I understand, and yes I did remove from vendor as well.
I thought at the time that was a bad idea as they are probably pulled in as a whole from the vendor. I will tomorrow go through all that I removed, and sanitize were I can, then report back here with actual details.
Only code I had to change was the composer and gitignore and stuff like that at top level.
I may have been overly aggressive in my implementation, but I still see this as a worth while exercise if it can be done easily with a script or something.
As far as I am concerned no production site requires all of these tests.
Thanks for taking the time to reply.
P.S. I am no developer by any means, so if this is naive or a waste of time and effort please ignore.
Comment #10
TheDanScott commentedmbrett5062: I for one appreciate your efforts, and don't see this as a waste of time.
I've had this exact question burning in my mind for a while (when I worked out that there were some 7000 files and some 20MB of tests that will never be used on a production site). Yeah, you'll have those who'll say "disk space is cheap thesedays, stop whining", but thousands of files across a drupal install slow down source control systems and uploads (of the codebase to a production server) and all manner of things.
As a developer who lives outside a major city and has limited upload speed, the bloat of Drupal is a big deal to me. I manage Drupal through Subversion, so I don't upload directly very much (I tend to pull from one internet server to another when I deploy), but there are times - such as updating my master copy of Drupal in source control - where all that cruft bogs things down.
Rather than a separate core release for production, another option might be some kind of bundled automated process that can be run during config sync (or some other appropriate time) might be an option. Such a script could also remove all the test stuff from the vendor directory, and from contributed modules. Maybe the uninstall hook for the simpletest module would be a good place to run that?
Comment #11
dawehnerJust to give people a bit more update. We do strip vendor tests, see
Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup@TheSchmuck
Nice idea! How about writing some script, and call this from drush/composer?
Comment #13
nulf commentedGreat to see an issue about this. I'm starting a project at work to remove all test-libraries from our production servers just because phpunit has had atleast one remote code execution exploit in the last couple of years. And as phpunit is categorized as a test/dev-library it isn't sure that these kind of exploits gets fixed quickly.
Will follow this and share if I stumble on something useful/interesting.
Comment #14
peterx commentedDrupal 8.6.3 is a 16.4 MB download containing 20,369 items and using 83.8 MB on Ext4 disk. I did a quick test deleting just the directories containing tests and the result contains 12,059 items and uses only 48 MB on disk. If something as simple as that can save 35 MB per upload, it will make many uploads faster.
I look forward to a list of the changes you make.
Comment #15
kristi wachter commentedI would like to voice my support for doing this.
I have a client on shared hosting with unlimited storage space but a limit on number of individual files. They've had to spend time finding files to delete ... and having 1200 files in core/modules/system alone is causing problems.
The problems are multiplied if you don't immediately zip your backups - or if you use drush, which saves unzipped backups to drush-backups.
I'd like to see test files be excluded from the default install, and only added in as a selectable option.
Thanks for proposing this!
Comment #16
traviscarden commentedComment #17
anavarreI feel we should close this issue as a duplicate of #3067979: Exclude test files from release packages if we agree that we don't need a
but to remove tests altogether from release packages.
Comment #18
andypost++ to 16-17