jhu-idc / idc_defaults

MIT License
0 stars 0 forks source link

Enable tests to run via CI #3

Open emetsger opened 3 years ago

emetsger commented 3 years ago

PR #1 includes unit tests that ought to run via CI. The boilerplate necessary to run tests via CI is in PR #2.

PR #2 is cribbed from the idc_migration repository

Fixing this issue should allow the developer to check out this repository and run make test, which will invoke all the prerequisite steps (like composer install) before actually running tests using phpunit. The Github Actions will be updated to run tests via CI.

For an example how this is expected to work, check out the idc_migration repository and run make test.

The branch tests-wip is essentially #2 rebased on #1, with some revisions.

The problem is that the ConstraintTest fails to run because it can't require autoload.php:

require(/app/vendor/drupal/autoload.php): failed to open stream: No such file or directory

bootEnvironment() of KernelTestBase has this statement on line 262: $this->classLoader = require $this->root . '/autoload.php';

I have attempted to coax the generation of vendor/drupal/autoload.php using variations of the autoload and autoload-dev composer.json statements. The composer.json in the test-wip branch includes autoload statements cribbed from the Drupal 8.x branch, but none of my attempts have worked.

The full output of make clean test is below:

 make clean test                                                                                                                     Wed Jul  7 16:20:33 2021
Removing make state from ./.make
Removing vendored source
Removing composer.lock
Reverting .env
source .env && docker pull ghcr.io/jhu-sheridan-libraries/idc-isle-dc/idc_defaults-testing:${TEST_IMAGE_TAG}
e0cf0c5: Pulling from jhu-sheridan-libraries/idc-isle-dc/idc_defaults-testing
Digest: sha256:5b000fdd227eb41be6c4217fd725bb33e933f2810d0763a780d5ee1620f1ce73
Status: Image is up to date for ghcr.io/jhu-sheridan-libraries/idc-isle-dc/idc_defaults-testing:e0cf0c5
ghcr.io/jhu-sheridan-libraries/idc-isle-dc/idc_defaults-testing:e0cf0c5
source .env && docker run --rm -v $PWD:/app ghcr.io/jhu-sheridan-libraries/idc-isle-dc/idc_defaults-testing:${TEST_IMAGE_TAG} install --dev
You are using the deprecated option "dev". Dev packages are installed by default now.
Loading composer repositories with package information
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Updating dependencies (including require-dev)
Package operations: 153 installs, 0 updates, 0 removals
  - Installing twistor/stream-util (v1.0.1): Downloading (100%)         
  - Installing league/mime-type-detection (1.7.0): Downloading (100%)         
  - Installing league/flysystem (1.1.4): Downloading (100%)         
  - Installing twistor/flysystem-stream-wrapper (v1.0.9): Downloading (100%)         
  - Installing league/flysystem-replicate-adapter (1.0.1): Downloading (100%)         
  - Installing symfony/polyfill-php80 (v1.23.0): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.17.0): Downloading (100%)         
  - Installing symfony/polyfill-php72 (v1.17.0): Downloading (100%)         
  - Installing symfony/polyfill-intl-normalizer (v1.23.0): Downloading (100%)         
  - Installing paragonie/random_compat (v9.99.99): Downloading (100%)         
  - Installing symfony/polyfill-php70 (v1.17.0): Downloading (100%)         
  - Installing symfony/polyfill-intl-idn (v1.17.0): Downloading (100%)         
  - Installing symfony/deprecation-contracts (v2.4.0): Downloading (100%)         
  - Installing doctrine/lexer (1.0.2): Downloading (100%)         
  - Installing psr/log (1.1.3): Downloading (100%)         
  - Installing pear/pear_exception (v1.0.1): Downloading (100%)         
  - Installing pear/console_getopt (v1.4.3): Downloading (100%)         
  - Installing pear/pear-core-minimal (v1.10.10): Downloading (100%)         
  - Installing pear/archive_tar (1.4.13): Downloading (100%)         
  - Installing symfony/polyfill-ctype (v1.17.0): Downloading (100%)         
  - Installing psr/container (1.0.0): Downloading (100%)         
  - Installing symfony/polyfill-intl-grapheme (v1.23.0): Downloading (100%)         
  - Installing symfony/string (v5.3.3): Downloading (100%)         
  - Installing symfony/inflector (v5.3.0): Downloading (100%)         
  - Installing symfony/property-access (v4.4.25): Downloading (100%)         
  - Installing phpdocumentor/reflection-common (2.2.0): Downloading (100%)         
  - Installing webmozart/assert (1.10.0): Downloading (100%)         
  - Installing phpdocumentor/type-resolver (1.4.0): Downloading (100%)         
  - Installing phpdocumentor/reflection-docblock (5.2.2): Downloading (100%)         
  - Installing symfony/debug (v3.4.41): Downloading (100%)         
  - Installing symfony/polyfill-util (v1.17.0): Downloading (100%)         
  - Installing symfony/polyfill-php56 (v1.17.0): Downloading (100%)         
  - Installing symfony/http-foundation (v3.4.41): Downloading (100%)         
  - Installing symfony/event-dispatcher (v3.4.41): Downloading (100%)         
  - Installing symfony/http-kernel (v3.4.44): Downloading (100%)         
  - Installing asm89/stack-cors (1.3.0): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing laminas/laminas-zendframework-bridge (1.0.4): Downloading (100%)         
  - Installing masterminds/html5 (2.3.0): Downloading (100%)         
  - Installing egulias/email-validator (2.1.17): Downloading (100%)         
  - Installing stack/builder (v1.0.5): Downloading (100%)         
  - Installing laminas/laminas-stdlib (3.2.1): Downloading (100%)         
  - Installing laminas/laminas-escaper (2.6.1): Downloading (100%)         
  - Installing laminas/laminas-feed (2.12.2): Downloading (100%)         
  - Installing symfony/routing (v3.4.41): Downloading (100%)         
  - Installing ralouphie/getallheaders (3.0.3): Downloading (100%)         
  - Installing guzzlehttp/psr7 (1.6.1): Downloading (100%)         
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)         
  - Installing guzzlehttp/guzzle (6.5.4): Downloading (100%)         
  - Installing doctrine/annotations (v1.4.0): Downloading (100%)         
  - Installing typo3/phar-stream-wrapper (v3.1.4): Downloading (100%)         
  - Installing symfony/polyfill-iconv (v1.17.0): Downloading (100%)         
  - Installing composer/semver (1.5.1): Downloading (100%)         
  - Installing symfony/class-loader (v3.4.41): Downloading (100%)         
  - Installing laminas/laminas-diactoros (1.8.7p2): Downloading (100%)         
  - Installing symfony/psr-http-message-bridge (v1.1.2): Downloading (100%)         
  - Installing easyrdf/easyrdf (0.9.1): Downloading (100%)         
  - Installing symfony-cmf/routing (1.4.1): Downloading (100%)         
  - Installing doctrine/collections (v1.4.0): Downloading (100%)         
  - Installing doctrine/cache (v1.6.2): Downloading (100%)         
  - Installing doctrine/inflector (v1.2.0): Downloading (100%)         
  - Installing doctrine/common (v2.7.3): Downloading (100%)         
  - Installing twig/twig (v1.42.5): Downloading (100%)         
  - Installing symfony/yaml (v3.4.41): Downloading (100%)         
  - Installing symfony/process (v3.4.41): Downloading (100%)         
  - Installing symfony/translation (v3.4.41): Downloading (100%)         
  - Installing symfony/validator (v3.4.41): Downloading (100%)         
  - Installing symfony/serializer (v3.4.41): Downloading (100%)         
  - Installing symfony/dependency-injection (v3.4.41): Downloading (100%)         
  - Installing symfony/console (v3.4.41): Downloading (100%)         
  - Installing drupal/core (8.9.16): Downloading (100%)         
  - Installing drupal/flysystem (2.0.0-alpha1): Downloading (100%)         
  - Installing league/csv (9.7.1): Downloading (100%)         
  - Installing drupal/migrate_source_csv (3.4.0): Downloading (100%)         
  - Installing drupal/context (4.0.0-beta6): Downloading (100%)         
  - Installing symfony/dom-crawler (v3.4.47): Downloading (100%)         
  - Installing symfony/css-selector (v3.4.47): Downloading (100%)         
  - Installing symfony/browser-kit (v3.4.47): Downloading (100%)         
  - Installing fabpot/goutte (v3.2.3): Downloading (100%)         
  - Installing behat/mink (v1.8.1): Downloading (100%)         
  - Installing behat/mink-browserkit-driver (v1.3.4): Downloading (100%)         
  - Installing behat/mink-goutte-driver (v1.2.1): Downloading (100%)         
  - Installing mikey179/vfsstream (v1.6.8): Downloading (100%)         
  - Installing sebastian/recursion-context (3.0.1): Downloading (100%)         
  - Installing sebastian/exporter (3.1.3): Downloading (100%)         
  - Installing doctrine/instantiator (1.4.0): Downloading (100%)         
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
  - Installing drupal/file_replace (1.2.0): Downloading (100%)         
  - Installing drupal/migrate_plus (5.1.0): Downloading (100%)         
  - Installing drupal/migrate_tools (5.0.0): Downloading (100%)         
  - Installing firebase/php-jwt (v5.4.0): Downloading (100%)         
  - Installing drupal/key (1.14.0): Downloading (100%)         
  - Installing drupal/jwt (1.0.0-rc1): Downloading (100%)         
  - Installing drupal/eva (2.1.0): Downloading (100%)         
  - Installing symfony/security (v3.4.49): Downloading (100%)         
  - Installing pimple/pimple (v3.3.1): Downloading (100%)         
  - Installing silex/silex (v2.2.4): Downloading (100%)         
  - Installing monolog/monolog (1.26.1): Downloading (100%)         
  - Installing namshi/jose (7.2.3): Downloading (100%)         
  - Installing doctrine/dbal (v2.7.2): Downloading (100%)         
  - Installing ml/iri (1.1.4): Downloading (100%)         
  - Installing ml/json-ld (1.2.0): Downloading (100%)         
  - Installing islandora/chullo (dev-dev d563d5e): Cloning d563d5e48e from cache
  - Installing islandora/crayfish-commons (dev-dev 46a1f1b): Cloning 46a1f1b63b from cache
  - Installing islandora/jsonld (dev-8.x-1.x dfd99c4): Cloning dfd99c4c1b from cache
  - Installing drupal/prepopulate (2.3.0): Downloading (100%)         
  - Installing drupal/token (1.9.0): Downloading (100%)         
  - Installing drupal/search_api (1.19.0): Downloading (100%)         
  - Installing drupal/config_update (1.7.0): Downloading (100%)         
  - Installing drupal/features (3.12.0): Downloading (100%)         
  - Installing drupal/filehash (1.5.0): Downloading (100%)         
  - Installing stomp-php/stomp-php (4.6.1): Downloading (100%)         
  - Installing islandora/islandora (dev-8.x-1.x 8a28ea2): Cloning 8a28ea28e2 from cache
  - Installing drupal/core-recommended (8.9.16)
  - Installing sebastian/global-state (2.0.0): Downloading (100%)         
  - Installing drupal/workbench_access (1.0.0-beta4): Downloading (100%)         
  - Installing symfony/phpunit-bridge (v3.4.47): Downloading (100%)         
  - Installing symfony/lock (v3.4.47): Downloading (100%)         
  - Installing symfony/finder (v3.4.47): Downloading (100%)         
  - Installing symfony/filesystem (v3.4.47): Downloading (100%)         
  - Installing sebastian/version (2.0.1): Downloading (100%)         
  - Installing sebastian/resource-operations (2.0.2): Downloading (100%)         
  - Installing sebastian/object-reflector (1.1.2): Downloading (100%)         
  - Installing sebastian/object-enumerator (3.0.4): Downloading (100%)         
  - Installing sebastian/environment (4.2.4): Downloading (100%)         
  - Installing sebastian/diff (3.0.3): Downloading (100%)         
  - Installing sebastian/comparator (3.0.3): Downloading (100%)         
  - Installing phpunit/php-timer (2.1.3): Downloading (100%)         
  - Installing phpunit/php-file-iterator (2.0.3): Downloading (100%)         
  - Installing theseer/tokenizer (1.2.0): Downloading (100%)         
  - Installing sebastian/code-unit-reverse-lookup (1.0.2): Downloading (100%)         
  - Installing phpunit/php-token-stream (3.1.2): Downloading (100%)         
  - Installing phpunit/php-code-coverage (6.1.4): Downloading (100%)         
  - Installing phpspec/prophecy (1.13.0): Downloading (100%)         
  - Installing phar-io/version (2.0.1): Downloading (100%)         
  - Installing phar-io/manifest (1.0.3): Downloading (100%)         
  - Installing myclabs/deep-copy (1.10.2): Downloading (100%)         
  - Installing phpunit/phpunit (7.5.20): Downloading (100%)         
  - Installing justinrainbow/json-schema (5.2.10): Downloading (100%)         
  - Installing jcalderonzumba/gastonjs (v1.2.0): Downloading (100%)         
  - Installing jcalderonzumba/mink-phantomjs-driver (v0.3.3): Downloading (100%)         
  - Installing squizlabs/php_codesniffer (3.6.0): Downloading (100%)         
  - Installing sirbrillig/phpcs-variable-analysis (v2.11.2): Downloading (100%)         
  - Installing drupal/coder (8.3.13): Cloning d3286d571b from cache
  - Installing seld/phar-utils (1.1.1): Downloading (100%)         
  - Installing seld/jsonlint (1.8.3): Downloading (100%)         
  - Installing composer/xdebug-handler (1.4.6): Downloading (100%)         
  - Installing composer/spdx-licenses (1.5.5): Downloading (100%)         
  - Installing composer/ca-bundle (1.2.10): Downloading (100%)         
  - Installing composer/composer (1.10.22): Downloading (100%)         
  - Installing instaclick/php-webdriver (1.4.9): Downloading (100%)         
  - Installing behat/mink-selenium2-driver (v1.4.0): Downloading (100%)         
  - Installing drupal/core-dev (8.9.16)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
symfony/polyfill-intl-normalizer suggests installing ext-intl (For best performance)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
pear/archive_tar suggests installing ext-bz2 (Bz2 compression support.)
pear/archive_tar suggests installing ext-xz (Lzma2 compression support.)
symfony/polyfill-intl-grapheme suggests installing ext-intl (For best performance)
symfony/property-access suggests installing psr/cache-implementation (To cache access methods.)
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/var-dumper
egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation)
laminas/laminas-feed suggests installing laminas/laminas-cache (Laminas\Cache component, for optionally caching feeds between requests)
laminas/laminas-feed suggests installing laminas/laminas-db (Laminas\Db component, for use with PubSubHubbub)
laminas/laminas-feed suggests installing laminas/laminas-http (Laminas\Http for PubSubHubbub, and optionally for use with Laminas\Feed\Reader)
laminas/laminas-feed suggests installing laminas/laminas-servicemanager (Laminas\ServiceManager component, for easily extending ExtensionManager implementations)
laminas/laminas-feed suggests installing laminas/laminas-validator (Laminas\Validator component, for validating email addresses used in Atom feeds and entries when using the Writer subcomponent)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
symfony/class-loader suggests installing symfony/polyfill-apcu (For using ApcClassLoader on HHVM)
symfony/psr-http-message-bridge suggests installing nyholm/psr7 (For a super lightweight PSR-7/17 implementation)
symfony/translation suggests installing symfony/config
symfony/validator suggests installing psr/cache-implementation (For using the metadata cache.)
symfony/validator suggests installing symfony/intl
symfony/validator suggests installing symfony/config
symfony/validator suggests installing symfony/expression-language (For using the Expression validator)
symfony/serializer suggests installing psr/cache-implementation (For using the metadata cache.)
symfony/serializer suggests installing symfony/property-info (To deserialize relations.)
symfony/serializer suggests installing symfony/config (For using the XML mapping loader.)
symfony/dependency-injection suggests installing symfony/config
symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
behat/mink suggests installing dmore/chrome-mink-driver (fast and JS-enabled driver for any app (requires chromium or google chrome))
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
drupal/migrate_plus suggests installing sainsburys/guzzle-oauth2-plugin (3.0 required for the OAuth2 authentication plugin)
drupal/migrate_plus suggests installing ext-soap (*)
drupal/migrate_tools suggests installing drush/drush (^9 || ^10)
firebase/php-jwt suggests installing paragonie/sodium_compat (Support EdDSA (Ed25519) signatures when libsodium is not present)
symfony/security suggests installing symfony/form
symfony/security suggests installing symfony/expression-language (For using the expression voter)
symfony/security suggests installing symfony/ldap (For using the LDAP user and authentication providers)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
namshi/jose suggests installing phpseclib/phpseclib (Allows to use Phpseclib as crypto engine, use version ^2.0.)
drupal/search_api suggests installing drupal/facets (Adds the ability to create faceted searches.)
drupal/search_api suggests installing drupal/search_api_autocomplete (Allows adding autocomplete suggestions to search fields.)
drupal/search_api suggests installing drupal/search_api_solr (Adds support for using Apache Solr as a backend.)
islandora/islandora suggests installing drupal/transliterate_filenames (Sanitizes filenames when they are uploaded so they don't break your repository.)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
phpunit/phpunit suggests installing ext-soap (*)
phpunit/phpunit suggests installing ext-xdebug (*)
Package symfony/inflector is abandoned, you should avoid using it. Use use `EnglishInflector` from the String component instead instead.
Package silex/silex is abandoned, you should avoid using it. Use symfony/flex instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
64 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
source .env && docker run --rm -v $PWD:/app ghcr.io/jhu-sheridan-libraries/idc-isle-dc/idc_defaults-testing:${TEST_IMAGE_TAG} check-platform-reqs
ext-curl       7.4.13      success  
ext-date       7.4.13      success  
ext-dom        20031129    success  
ext-fileinfo   7.4.13      success  
ext-filter     7.4.13      success  
ext-gd         7.4.13      success  
ext-hash       7.4.13      success  
ext-json       7.4.13      success  
ext-libxml     7.4.13      success  
ext-mbstring   7.4.13      success  
ext-openssl    7.4.13      success  
ext-pcre       7.4.13      success  
ext-PDO        7.4.13      success  
ext-Phar       7.4.13      success  
ext-session    7.4.13      success  
ext-SimpleXML  7.4.13      success  
ext-SPL        7.4.13      success  
ext-tokenizer  7.4.13      success  
ext-xml        7.4.13      success  
ext-xmlwriter  7.4.13      success  
lib-pcre       10.35       success  
php            7.4.13      success  
source .env && docker run --rm -v $PWD:/app ghcr.io/jhu-sheridan-libraries/idc-isle-dc/idc_defaults-testing:${TEST_IMAGE_TAG} vendor/bin/phpunit tests
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 600 ms, Memory: 14.48 MB

There was 1 error:

1) Drupal\Tests\idc_defaults\Kernel\ConstraintTest::testConstraint
require(/app/vendor/drupal/autoload.php): failed to open stream: No such file or directory

/app/vendor/drupal/core/tests/Drupal/KernelTests/KernelTestBase.php:262
/app/vendor/drupal/core/tests/Drupal/KernelTests/KernelTestBase.php:262
/app/vendor/drupal/core/tests/Drupal/KernelTests/KernelTestBase.php:245
/app/vendor/drupal/core/modules/node/tests/src/Kernel/NodeAccessTestBase.php:56
/app/tests/src/Kernel/ConstraintTest.php:61

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
make: *** [test] Error 2
birkland commented 3 years ago

Maybe easier to model this in testcafe