Behat+Selenium Webdriverで受け入れテストの自動化をやってみたで書いた方法、といっても、composerでインストールしただけだけど、Macでインストールした際に感じた事のまとめ

Composerが超遅い

何故か、composer installコマンドが超遅い。そして、zlib_decode(): data errorが出力される。

(なお、「遅い」だけであってとりあえずインストールはできている模様)

調べた

色々ネットを調べてみると、すでに最新版では対応してあるとか、ウィルススキャンがどーやこーやとか、composer clear-cacheで直ったとかあるけど、どれを試してみても無理だった

眺める

compsoer install -vvvして眺めてみる

$ composer install -vvv
Reading ./composer.json
Loading config file ./composer.json
Executing command (/Users/hoge/gitwork/behat-selenium): git describe --exact-match --tags
Executing command (/Users/hoge/gitwork/behat-selenium): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /Users/hoge/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing /Users/hoge/.composer/cache/repo/https---packagist.org/packages.json into cache
Installing dependencies (including require-dev)
Downloading http://packagist.org/p/provider-2013%247bbe9e4eb2ad99627686a1d164e727b40803efd99cbb93aa67e7dd33ec19d103.json
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Downloading http://packagist.org/p/provider-2013%247bbe9e4eb2ad99627686a1d164e727b40803efd99cbb93aa67e7dd33ec19d103.json
Downloading http://packagist.org/p/provider-2013%247bbe9e4eb2ad99627686a1d164e727b40803efd99cbb93aa67e7dd33ec19d103.json
Writing /Users/hoge/.composer/cache/repo/https---packagist.org/p-provider-2013.json into cache
Downloading http://packagist.org/p/provider-2014%2436d74b61030fe75748132bf3e7cf4d5d19d8a260088bbeb1221a10649bf9cb21.json
Downloading http://packagist.org/p/provider-2014%2436d74b61030fe75748132bf3e7cf4d5d19d8a260088bbeb1221a10649bf9cb21.json
Writing /Users/hoge/.composer/cache/repo/https---packagist.org/p-provider-2014.json into cache
Downloading http://packagist.org/p/provider-2015-01%24bc70ca5eb50623565ad00b43574be52967f4fff4a3f805ad72c4fa5982883dba.json
Writing /Users/hoge/.composer/cache/repo/https---packagist.org/p-provider-2015-01.json into cache
Reading /Users/hoge/.composer/cache/repo/https---packagist.org/p-provider-2015-04.json from cache
Downloading http://packagist.org/p/provider-2015-07%24112cb8b2342c85daa20669b337195045df0db3319ede32334ea89ffabaecb57e.json
Downloading http://packagist.org/p/provider-2015-07%24112cb8b2342c85daa20669b337195045df0db3319ede32334ea89ffabaecb57e.json
Downloading http://packagist.org/p/provider-2015-07%24112cb8b2342c85daa20669b337195045df0db3319ede32334ea89ffabaecb57e.json
Reading /Users/hoge/.composer/cache/repo/https---packagist.org/p-provider-2015-07.json from cache
zlib_decode(): data error
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Downloading http://packagist.org/p/provider-2015-10%249c2aef65ceeba9a40fedbbdb9d6e02315e27b37bd9f94665c0ad11c971ea064c.json
Downloading http://packagist.org/p/provider-2015-10%249c2aef65ceeba9a40fedbbdb9d6e02315e27b37bd9f94665c0ad11c971ea064c.json
Downloading http://packagist.org/p/provider-2015-10%249c2aef65ceeba9a40fedbbdb9d6e02315e27b37bd9f94665c0ad11c971ea064c.json



  [Composer\Repository\RepositorySecurityException]
  The contents of http://packagist.org/p/provider-2015-10%249c2aef65ceeba9a40fedbbdb9d6e02315e27b37bd9f94665c0ad11c971ea064c.json do not match its signature. This should indicate a man-in-the-middle at
  tack. Try running composer again and report this if you think it is a mistake.



Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:610
 Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:503
 Composer\Repository\ComposerRepository->loadProviderListings() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:273
 Composer\Repository\ComposerRepository->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:199
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:188
 Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:168
 Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:322
 Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php:208
 Composer\DependencyResolver\Solver->solve() at phar:///usr/local/bin/composer/src/Composer/Installer.php:523
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:232
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:134
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:838
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:189
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:167
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:120
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:98
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:25


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...

zlib_decode関連のエラーというよりそもそも遅い問題

体感でも5分以上かかっているように感じる。そもそも通信部分でなんか問題あるんじゃなかろうか

という事でネットをうろうろしていると神がいた

やってみた

$ composer config repositories.packagist composer http://packagist.jp

// キャッシュをいったん消す
$ composer clear-cache
Clearing cache (cache-dir): /Users/hoge/.composer/cache
Clearing cache (cache-files-dir): /Users/hoge/.composer/cache/files
Clearing cache (cache-repo-dir): /Users/hoge/.composer/cache/repo
Cache directory does not exist (cache-vcs-dir):
All caches cleared.

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing kriswallsmith/buzz (v0.15)
    Downloading: 100%

  - Installing behat/sahi-client (v1.2.0)
    Downloading: 100%

  - Installing symfony/css-selector (v2.7.6)
    Downloading: 100%

  - Installing behat/mink (v1.7.0)
    Downloading: 100%

  - Installing behat/mink-sahi-driver (v1.2.0)
    Downloading: 100%

  - Installing symfony/filesystem (v2.7.6)
    Downloading: 100%

  - Installing symfony/config (v2.7.6)
    Downloading: 100%

  - Installing symfony/class-loader (v2.7.6)
    Downloading: 100%

  - Installing symfony/yaml (v2.7.6)
    Downloading: 100%

  - Installing symfony/translation (v2.7.6)
    Downloading: 100%

  - Installing symfony/event-dispatcher (v2.7.6)
    Downloading: 100%

  - Installing symfony/dependency-injection (v2.7.6)
    Downloading: 100%

  - Installing symfony/console (v2.7.6)
    Downloading: 100%

  - Installing behat/transliterator (v1.1.0)
    Downloading: 100%

  - Installing behat/gherkin (v4.4.0)
    Downloading: 100%

  - Installing behat/behat (v3.0.15)
    Downloading: 100%

  - Installing behat/mink-extension (v2.1.0)
    Downloading: 100%

  - Installing guzzlehttp/promises (1.0.3)
    Downloading: 100%

  - Installing psr/http-message (1.0)
    Downloading: 100%

  - Installing guzzlehttp/psr7 (1.2.1)
    Downloading: 100%

  - Installing guzzlehttp/guzzle (6.1.0)
    Downloading: 100%

  - Installing symfony/dom-crawler (v2.7.6)
    Downloading: 100%

  - Installing symfony/browser-kit (v2.7.6)
    Downloading: 100%

  - Installing fabpot/goutte (v3.1.2)
    Downloading: 100%

  - Installing symfony/process (v2.7.6)
    Downloading: 100%

  - Installing behat/mink-browserkit-driver (v1.3.0)
    Downloading: 100%

  - Installing behat/mink-goutte-driver (v1.2.0)
    Downloading: 100%

  - Installing instaclick/php-webdriver (1.4.3)
    Downloading: 100%

  - Installing behat/mink-selenium2-driver (v1.3.0)
    Downloading: 100%

  - Installing behat/mink-zombie-driver (v1.3.0)
    Downloading: 100%

symfony/translation suggests installing psr/log (To use logging capability in translator)
symfony/event-dispatcher suggests installing symfony/http-kernel ()
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
symfony/console suggests installing psr/log (For using the console logger)
behat/behat suggests installing behat/symfony2-extension (for integration with Symfony2 web framework)
behat/behat suggests installing behat/yii-extension (for integration with Yii web framework)
Writing lock file
Generating autoload files

速い。1分かかってない。そして、zlib_decode関連のエラーも消えた

プロダクトなんかでpackagistにあるライブラリを日常的に使ってく場合は、自前でミラーを用意してオレオレしたほうがよさそうだと感じた出来事でした