acquia / blt

Acquia's toolset for automating Drupal 8 and 9 development, testing, and deployment.
https://docs.acquia.com/blt/
GNU General Public License v2.0
442 stars 394 forks source link

Unable to run "blt tests:phpunit:run" #4388

Closed kd796 closed 2 years ago

kd796 commented 3 years ago

I want to... I want to run PHPUNIT test with blt commands.

It's not working because... I have a blt 12 project. Whenever I am trying to run "lando blt tests:phpunit:run" it is giving the below error:

There are no commands defined in the "tests:phpunit" namespace. Did you mean one of these? recipes:phpunit tests tests:frontend tests:server

Detailed error output

lando 13:41:24 DEBUG ==> No update available. lando 13:41:24 VERBOSE ==> starting bootstrap at level engine... lando 13:41:24 VERBOSE ==> config bootstrap beginning... lando 13:41:24 DEBUG ==> emitting event pre-bootstrap-config lando 13:41:24 DEBUG ==> plugin lando-core loaded from C:/snapshot/lando/build/cli/plugins/lando-core/index.js lando 13:41:24 DEBUG ==> plugin lando-events loaded from C:/snapshot/lando/build/cli/plugins/lando-events/index.js lando 13:41:24 DEBUG ==> plugin lando-networking loaded from C:/snapshot/lando/build/cli/plugins/lando-networking/index.js lando 13:41:24 DEBUG ==> plugin lando-proxy loaded from C:/snapshot/lando/build/cli/plugins/lando-proxy/index.js lando 13:41:24 DEBUG ==> plugin lando-recipes loaded from C:/snapshot/lando/build/cli/plugins/lando-recipes/index.js lando 13:41:24 DEBUG ==> plugin lando-services loaded from C:/snapshot/lando/build/cli/plugins/lando-services/index.js lando 13:41:24 DEBUG ==> plugin lando-sharing loaded from C:/snapshot/lando/build/cli/plugins/lando-sharing/index.js lando 13:41:24 DEBUG ==> plugin lando-test loaded from C:/snapshot/lando/build/cli/plugins/lando-test/index.js lando 13:41:24 DEBUG ==> plugin lando-tooling loaded from C:/snapshot/lando/build/cli/plugins/lando-tooling/index.js lando 13:41:24 DEBUG ==> plugin lando-acquia loaded from C:/snapshot/lando/build/cli/integrations/lando-acquia/index.js lando 13:41:24 DEBUG ==> plugin lando-lagoon loaded from C:/snapshot/lando/build/cli/integrations/lando-lagoon/index.js lando 13:41:24 DEBUG ==> plugin lando-pantheon loaded from C:/snapshot/lando/build/cli/integrations/lando-pantheon/index.js lando 13:41:24 DEBUG ==> plugin lando-platformsh loaded from C:/snapshot/lando/build/cli/integrations/lando-platformsh/index.js lando 13:41:24 DEBUG ==> emitting event post-bootstrap-config lando 13:41:24 VERBOSE ==> building proxy config... lando 13:41:24 VERBOSE ==> config bootstrap completed. lando 13:41:25 VERBOSE ==> tasks bootstrap beginning... lando 13:41:25 DEBUG ==> emitting event pre-bootstrap-tasks lando 13:41:25 DEBUG ==> autoloaded task config lando 13:41:25 DEBUG ==> autoloaded task destroy lando 13:41:25 DEBUG ==> autoloaded task info lando 13:41:25 DEBUG ==> autoloaded task list lando 13:41:25 DEBUG ==> autoloaded task logs lando 13:41:25 DEBUG ==> autoloaded task poweroff lando 13:41:25 DEBUG ==> autoloaded task rebuild lando 13:41:25 DEBUG ==> autoloaded task restart lando 13:41:25 DEBUG ==> autoloaded task share lando 13:41:25 DEBUG ==> autoloaded task start lando 13:41:25 DEBUG ==> autoloaded task stop lando 13:41:25 DEBUG ==> autoloaded task version lando 13:41:25 DEBUG ==> autoloaded task init lando 13:41:25 DEBUG ==> autoloaded task ssh lando 13:41:25 DEBUG ==> emitting event post-bootstrap-tasks lando 13:41:25 VERBOSE ==> tasks bootstrap completed. lando 13:41:25 VERBOSE ==> engine bootstrap beginning... lando 13:41:25 DEBUG ==> emitting event pre-bootstrap-engine lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\plugins\lando-core\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\plugins\lando-proxy\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\plugins\lando-recipes\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\plugins\lando-services\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\plugins\lando-sharing\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\integrations\lando-acquia\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\integrations\lando-lagoon\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\integrations\lando-pantheon\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> automoved scripts from C:\snapshot\lando\build\cli\integrations\lando-platformsh\scripts to C:\Users\857141.lando\scripts and set to mode 755 lando 13:41:25 DEBUG ==> emitting event post-bootstrap-engine lando 13:41:25 VERBOSE ==> engine bootstrap completed. lando 13:41:25 VERBOSE ==> bootstrap completed. lando 13:41:25 DEBUG ==> emitting event post-bootstrap lando 13:41:25 VERBOSE ==> docker-engine exists: true lando 13:41:25 VERBOSE ==> docker-compose exists: true lando 13:41:25 DEBUG ==> emitting event cli-answers lando 13:41:25 VERBOSE ==> checking docker version compatibility... lando 13:41:25 DEBUG ==> compatibility results name=desktop, link=https://docs.docker.com/docker-for-windows/release-notes/, wants=2.1.0.0 - 3.3.99, version=3.3.3, semversion=3.3.3, semmin=2.1.0, semmax=3.3.99, dockerVersion=true, satisfied=true lando 13:41:25 DEBUG ==> emitting event cli-blt-answers lando 13:41:25 DEBUG ==> emitting event cli-run lando 13:41:25 DEBUG ==> emitting event cli-blt-run lando 13:41:25 DEBUG ==> emitting event pre-command-runner lando 13:41:25 DEBUG ==> emitting event pre-blt lando 13:41:25 DEBUG ==> process pid2 running C:\Program Files\Docker\Docker\resources\bin\docker.exe exec mylandoapp_appserver_1 /usr/bin/blt tests:phpunit:run cstdio=[inherit, pipe, pipe], silent=false, mode=attach, detached=false

In Application.php line 604:

[Symfony\Component\Console\Exception\NamespaceNotFoundException] There are no commands defined in the "tests:phpunit" namespace.

Did you mean one of these? recipes:phpunit tests tests:frontend tests:server

Exception trace: at /app/lightning/vendor/symfony/console/Application.php:604 Symfony\Component\Console\Application->findNamespace() at /app/lightning/vendor/symfony/console/Application.php:657 Symfony\Component\Console\Application->find() at /app/lightning/vendor/symfony/console/Application.php:237 Symfony\Component\Console\Application->doRun() at /app/lightning/vendor/symfony/console/Application.php:149 Symfony\Component\Console\Application->run() at /app/lightning/vendor/consolidation/robo/src/Runner.php:279 Robo\Runner->run() at /app/lightning/vendor/acquia/blt/src/Robo/Blt.php:250 Acquia\Blt\Robo\Blt->run() at /app/lightning/vendor/acquia/blt/bin/blt-robo-run.php:35 require_once() at /app/lightning/vendor/acquia/blt/bin/blt-robo.php:15 require_once() at /app/lightning/vendor/acquia/blt/bin/blt:11

22.48s total time elapsed. lando 13:42:15 DEBUG ==> process pid2 finished with exit code 1 lando 13:42:17 DEBUG ==> engine is up. lando 13:42:17 DEBUG ==> docker is running. lando 13:42:31 DEBUG ==> engine is up.

BLT doctor output | Property | Value | +---------------------------+------------------------------------------------------+ | %paths.%root | /app/lightning/docroot | | %paths.%site | sites/default | | %paths.%modules | sites/all/modules | | %paths.%themes | sites/all/themes | | %paths.%config-sync | /app/lightning/config/default | | %paths.%files | sites/default/files | | %paths.%temp | /tmp | | %paths.%private | /app/lightning/files-private/default | | admin-theme | seven | | alias-searchpaths.0 | /app/lightning/drush/sites | | blt-version | 12.8.2.0 | | bootstrap | Successful | | composer-version | Composer version 2.0.7 2020-11-13 17:31:06 | | config-sync | /app/lightning/config/default | | db-driver | mysql | | db-hostname | database | | db-name | drupal8 | | db-password | drupal8 | | db-port | 3306 | | db-status | Connected | | db-username | drupal8 | | drupal-settings-file | sites/default/settings.php | | drupal-version | 9.1.5 | | drush-cache-directory | /var/www/.drush/cache | | drush-conf.0 | /app/lightning/vendor/drush/drush/drush.yml | | drush-conf.1 | /app/lightning/drush/drush.yml | | drush-conf.2 | /app/lightning/docroot/sites/default/local.drush.yml | | drush-script | /app/lightning/vendor/drush/drush/drush | | drush-temp | /tmp | | drush-version | 10.5.0 | | files | sites/default/files | | install-profile | standard | | modules | sites/all/modules | | php-bin | /usr/local/bin/php | | php-conf.1 | false | | php-os | Linux | | private | /app/lightning/files-private/default | | root | /app/lightning/docroot | | site | sites/default | | stacks.drupal-vm.inited | false | | stacks.dev-desktop.inited | false | | temp | /tmp | | theme | bartik | | themes | sites/all/themes | | uri | http://local.blted10.com | +---------------------------+------------------------------------------------------+ +--------------------------------------+--------------------------------------------------------------+ | Check | Problem | +--------------------------------------+--------------------------------------------------------------+ | ConfigCheck:checkGitConfig | Git repositories are not defined in blt.yml. | | | Add values for git.remotes to blt.yml to enabled automated | | | deployment. | | NodeCheck:checkNodeVersionFileExists | Neither .nvmrc nor .node-version file found in repo root. | | WebUriCheck:checkUriResponse | Did not get a response from http://local.blted10.com | | | Is your *AMP stack running? | | | Is your /etc/hosts file correctly configured? | | | Is your web server configured to serve this URI from | | | /app/lightning/docroot? | | | Is options.uri set correctly in | | | /app/lightning/docroot/sites/default/local.drush.yml? | +--------------------------------------+--------------------------------------------------------------+ [error] BLT Doctor discovered one or more critical issues. For troubleshooting guidance and support, see https://docs.acquia.com/blt/support/

System information unising lando with docker.

grasmash commented 3 years ago

I ran into this too.

There are a few issues.

  1. You need to run recipes:phpunit:init, but that will fail with ACMS because ACMS uses PHPUnit 9 and the recipes:phpunit:init does not allow that version.
  2. recipes:phpunit:init does not populate blt.yml with values that allow BLT to discover the example tests. It should write:
    tests:
    phpunit:
    - # Run BLT"s example test.
      path: '${repo.root}/tests/phpunit'
      config: '${docroot}/core/phpunit.xml.dist'
  3. recipes:phpunit:init doesn't include acquia/blt-drupal-test, which is required to provide the tests:phpunit:run command. There is no easy way to discover that dependency.
mikemadison13 commented 2 years ago

all of this logic has now been moved into https://github.com/acquia/blt-drupal-test so i don't think this is still an issue for core blt.