Problem/Motivation
We currently have functional tests which are limited by group, such as CoreD8MySqlPassingTest. We do this so the test runs don't take so long. :-)
They check that the tests run, but they don't check that non-group tests don't run.
We also have CoreNoGroupTest which checks the behavior when no group is specified.
Proposed resolution
Modify existing tests which specify DCI_TestGroups to verify that non-group tests did not run.
Remaining tasks
User interface changes
API changes
Data model changes
Original issue
While working with @Mixologic on debugging a failed test, I discovered that no matter how I invoked the drupalci command, the vagrant hosted local always generated an "All tests will run." test run.
Set up: vagrant local-hosted DrupalCI, with drupalci init using default settings (PHP 5.5, Mysql, etc.).
Here's a sample script I've used to invoke a test run:
DCI_Fetch='https://www.drupal.org/files/issues/file-example-2102651-torenware-v6.patch,modules/examples' \ DCI_Patch='file-example-2102651-torenware-v6.patch,modules/examples' \ DCI_TestItem='directory:modules/examples' \ DCI_TestGroups=' --module file_example ' DCI_AdditionalRepositories='git,git://git.drupal.org/project/examples.git,8.x-1.x,modules/examples,1;' \ DCI_Concurrency=4 DCI_Color=true ./drupalci run simpletest
This sets up a run with the command:
cd /var/www/html && sudo -u www-data php /var/www/html/core/scripts/run-tests.sh --url http://localhost/checkout --dburl mysql://drupaltestbot:drupaltestbotpw@drupaltestbot-db-mysql-5-5/simpletest_1446092781 --color --keep-results --sqlite /var/www/html/results/simpletest.sqlite --concurrency 4 --php /opt/phpenv/shims/php --all
I've tried a number of different combinations, but all of them run all of the tests.
Even the example from the Running DrupalCI Locally page does this:
Running
DCI_Concurrency=4 DCI_Testgroups=action DCI_Color=true ./drupalci run simpletest
results in "All tests will run."
cd /var/www/html && sudo -u www-data php /var/www/html/core/scripts/run-tests.sh --url http://localhost/checkout --dburl mysql://drupaltestbot:drupaltestbotpw@drupaltestbot-db-mysql-5-5/simpletest_1446141728 --color --keep-results --sqlite /var/www/html/results/simpletest.sqlite --concurrency 4 --php /opt/phpenv/shims/php --all
I'm not sure if the documentation needs to be changed, or if the command line tool is broken right now, but I don't see a way to get a run restricted to a single test, class, or module.
Comments
Comment #2
Torenware commentedComment #3
Torenware commentedComment #4
isntall commentedby removing
DCI_TestGroups=' --module file_example 'I was able to get the desired outcome
here's an excerpt of my local output on a vagrant vm using the dev branch of drupalci.
and on the 20151029_production tag
Comment #5
Torenware commented@isntall -- I'm not getting your results, not on dev, and not on production. The script you put in #4 gives me "All tests will run" in both branches. Maybe there's a stray setting somewhere I'm missing, but I'm definitely not getting just the tests for examples.module.
What exact configuration (i.e., via ./drupalci init) are you using? I especially need these for dev, since I can't make heads or tails what the first group of choices mean, much less which is appropriate:
The other two groups are obvious enough; the defaults are the same as production, and I took the defaults.
I blew away my /home/vagrant/.drupalci/ directory, so I'm running defaults. Are you sure there isn't anything in your configuration that got in from someplace other than the script you posted? Also, I pulled dev a few minutes ago.
Something is still significantly different from my set up from yours. Let's see if we can figure out what that is.
Comment #6
isntall commentedI don't use drupalci init.
Here are my steps (the drupalci command is slightly different than before, i usually specify the php version, db type/version, etc.)
and excerpt from this run
cd /var/www/html && sudo -u www-data php /var/www/html/core/scripts/run-tests.sh --url http://localhost/checkout --dburl mysql://drupaltestbot:drupaltestbotpw@drupaltestbot-db-mysql-5-5/simpletest_1446663422 --color --keep-results --concurrency 4 --color --sqlite /var/www/html/results/simpletest.sqlite --php /opt/phpenv/shims/php --directory modules/examplesWhat i usually do, when using a vagrant box is use open a second bash shell and use export
and an excerpt from this run
cd /var/www/html && sudo -u www-data php /var/www/html/core/scripts/run-tests.sh --url http://localhost/checkout --dburl mysql://drupaltestbot:drupaltestbotpw@drupaltestbot-db-mysql-5-5/simpletest_1446663760 --color --keep-results --color --concurrency 4 --sqlite /var/www/html/results/simpletest.sqlite --php /opt/phpenv/shims/php --directory modules/exampleswork does need to be done on drupalci init, our main focus has been drupalci run simpletest and making that work.
Comment #7
Torenware commented@isntall: thanks. That procedure works. The only thing I haven't figured out is where the test assets end up.
At some point, somebody needs to update the docs, since that procedure doesn't work anymore. I'm not adverse to doing it, although I don't have enough experience with the system yet to generalize the instructions.
EDIT: turns out the environment maps its mounts into /var/lib/drupalci/. To find exactly where, see "Accessing Results" on Running DrupalCI Locally.
Comment #8
mile23OK, so in the past you'd use
DCI_TestItem, which would parsemodule:whateverout to--module whatever, which seems much better to me.Now, you have to use
DCI_TestGroupswhich is expected to have--module whatever(complete with end spacing) since it's a direct string replacement, which seems inferior to me. Though it does allow you to specify multiple modules, I suppose.Moving to the specific test runner project.
Comment #9
MixologicComment #10
mile23Pretty sure this has been solved, so I'm re-scoping to write a test case.
Comment #11
mile23Comment #12
MixologicBoth DCI_TestItem and DCI_TestGroups , and now even DCI_RTTestGroups work in the following ways:
"all" => --all
"module:projectname" => "--module projectname"
"class:\fully\qualified\classname" => "--class \fully\qualified\classname"
"file:src/module/tests/filename" => "--file src/module/tests/filename"
"directory:modules/projectname" => "--directory modules/projectname"
Anything else gets passed directly through, so an actual groupname like Url works but so does "--directory modules/projectname"
Comment #13
MixologicComment #14
Mixologic