添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
玩篮球的香槟  ·  GitHub - ...·  1 月前    · 
乖乖的感冒药  ·  mysql JSON ...·  5 月前    · 
强健的杨桃  ·  Frontiers | ...·  5 月前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello,

I'm trying to run some test on my Symfony2 software (which is private, so I can't share my sources). I have 123 tests with 360 assertions that all succeed without any issues on my local machine and on my Gitlab CI Runner.

However, as soon as I activate the code coverage, it doesn't work anymore, I've got maximum execution time of 30 seconds exceeded errors! Weirdest thing, without any updates (that I'm aware of...), 1 or 2 weeks ago, all was working fine...

On my Gitlab CI, all the tests runs succesfully and as soon as the last test is completed (like, less than 1 second after than...), the test fail with the error Fatal error: Maximum execution time of 30 seconds exceeded in /[basePath]/vendor/phpunit/php-token-stream/src/Token/Stream.php on line 363 . The line varies from one run to another.

On my local machine, it consistently crash at the same test, but with various stack (most of the time it's the ORM, but in different files each time).

I'm kind of lost in regards to what to do next to debug this to make it work. Could you please help me figure it out?

Details

  • Codeception version: 2.2.5
  • PHP Unit Version: 5.6.1
  • PHP Version: 5.6
  • Operating System: Windows & Linux
  • Installation type: phar executable with composer vendors
  • List of installed packages
  • behat/gherkin                            v4.4.4
    behat/transliterator                     v1.1.0
    brunops/select24entity-bundle            dev-master 7a7be7f
    cocur/slugify                            v2.3
    codeception/c3                           2.0.8
    codeception/codeception                  2.2.5
    doctrine/annotations                     v1.2.7
    doctrine/cache                           v1.6.0
    doctrine/collections                     v1.3.0
    doctrine/common                          v2.6.1
    doctrine/dbal                            v2.5.5
    doctrine/doctrine-bundle                 1.6.4
    doctrine/doctrine-cache-bundle           1.3.0
    doctrine/doctrine-migrations-bundle      v1.2.0
    doctrine/inflector                       v1.1.0
    doctrine/instantiator                    1.0.5
    doctrine/lexer                           v1.0.1
    doctrine/migrations                      1.4.1
    doctrine/orm                             v2.5.5
    facebook/webdriver                       1.2.0
    friendsofsymfony/user-bundle             1.3.x-dev 113cc4e
    gedmo/doctrine-extensions                v2.4.24
    guzzlehttp/guzzle                        6.2.2
    guzzlehttp/promises                      1.2.0
    guzzlehttp/psr7                          1.3.1
    incenteev/composer-parameter-handler     v2.1.2
    ircmaxell/password-compat                v1.0.4
    jdorn/sql-formatter                      v1.2.17
    jms/metadata                             1.5.1
    jms/parser-lib                           1.0.0
    jms/serializer                           1.3.1
    jms/serializer-bundle                    1.1.0
    knplabs/knp-components                   1.3.3
    knplabs/knp-menu                         2.2.0
    knplabs/knp-menu-bundle                  2.1.3
    knplabs/knp-paginator-bundle             2.5.3
    monolog/monolog                          1.21.0
    myclabs/deep-copy                        1.5.4
    npm-asset/almond                         0.3.3
    npm-asset/bootstrap                      3.3.7
    npm-asset/bootswatch                     3.3.7
    npm-asset/jquery                         1.12.4
    npm-asset/jquery-mousewheel              3.1.13
    npm-asset/jstree                         3.3.2
    npm-asset/select2                        4.0.3
    ocramius/proxy-manager                   1.0.2
    paragonie/random_compat                  v2.0.3
    phpcollection/phpcollection              0.5.0
    phpdocumentor/reflection-common          1.0
    phpdocumentor/reflection-docblock        3.1.1
    phpdocumentor/type-resolver              0.2
    phpoption/phpoption                      1.5.0
    phpspec/prophecy                         v1.6.1
    phpunit/php-code-coverage                4.0.1
    phpunit/php-file-iterator                1.4.1
    phpunit/php-text-template                1.2.1
    phpunit/php-timer                        1.0.8
    phpunit/php-token-stream                 1.4.8
    phpunit/phpunit                          5.6.1
    phpunit/phpunit-mock-objects             3.4.0
    psr/http-message                         1.0.1
    psr/log                                  1.0.2
    sebastian/code-unit-reverse-lookup       1.0.0
    sebastian/comparator                     1.2.0
    sebastian/diff                           1.4.1
    sebastian/environment                    1.3.8
    sebastian/exporter                       1.2.2
    sebastian/global-state                   1.1.1
    sebastian/object-enumerator              1.0.0
    sebastian/recursion-context              1.0.2
    sebastian/resource-operations            1.0.0
    sebastian/version                        2.0.0
    sensio/distribution-bundle               v5.0.13
    sensio/framework-extra-bundle            v3.0.16
    sensio/generator-bundle                  v3.0.11
    sensiolabs/security-checker              v4.0.0
    sonata-project/admin-bundle              3.9.0
    sonata-project/block-bundle              3.2.0
    sonata-project/cache                     1.0.7
    sonata-project/core-bundle               3.1.1
    sonata-project/datagrid-bundle           2.x-dev 6ed29d6
    sonata-project/doctrine-extensions       1.0.2
    sonata-project/doctrine-orm-admin-bundle 3.1.1
    sonata-project/easy-extends-bundle       2.1.10
    sonata-project/exporter                  1.7.0
    sonata-project/google-authenticator      1.0.2
    sonata-project/user-bundle               3.1.0
    stof/doctrine-extensions-bundle          v1.2.2
    swiftmailer/swiftmailer                  v5.4.3
    symfony/monolog-bundle                   2.11.1
    symfony/phpunit-bridge                   v2.8.12
    symfony/polyfill-apcu                    v1.2.0
    symfony/polyfill-intl-icu                v1.2.0
    symfony/polyfill-mbstring                v1.2.0
    symfony/polyfill-php54                   v1.2.0
    symfony/polyfill-php55                   v1.2.0
    symfony/polyfill-php56                   v1.2.0
    symfony/polyfill-php70                   v1.2.0
    symfony/polyfill-util                    v1.2.0
    symfony/security-acl                     v3.0.0
    symfony/swiftmailer-bundle               v2.3.11
    symfony/symfony                          v2.8.12
    twig/extensions                          v1.4.0
    twig/twig                                v1.26.1
    webmozart/assert                         1.1.0
    zendframework/zend-code                  2.6.3
    zendframework/zend-eventmanager          3.0.1
    
  • Suite configuration:
  • codeception.yml

    actor: Tester
    paths:
        tests: tests
        log: tests/_output
        data: tests/_data
        support: tests/_support
        envs: tests/_envs
    settings:
        bootstrap: _bootstrap.php
        colors: true
        memory_limit: 1024M
    extensions:
        enabled:
            - Codeception\Extension\RunFailed
    coverage:
        enabled: true
        include:
            - src/*.php
        remote_context_options:
            http:
                timeout: 90
    modules:
        config:
                dsn: 'mysql:host=mariadb;dbname=test_db'
                user: 'root'
                password: 'test_db'
                dump: tests/_data/dump.sql
                cleanup: true
                populate: true
            Symfony:
                app_path: 'app'
                environment: 'test'
            Doctrine2:
                depends: Symfony

    unit.suite.yml

    class_name: UnitTester
    modules:
        enabled:
            - Asserts
            - \Helper\Unit

    acceptance.suite.yml

    class_name: AcceptanceTester
    modules:
        enabled: [Db, Symfony, Doctrine2, PhpBrowser, \Helper\Acceptance]
        config:
            PhpBrowser:
                url: http://localhost:8000/app_test.php
                curl:
                  CURLOPT_TIMEOUT_MS: 60000

    container.suite.yml (this is my functionnal test, but it use the Symfony Container)

    class_name: ContainerTester
    modules:
        enabled: [Db, Symfony, Doctrine2, Asserts, \Helper\Unit]

    .gitlab-ci.yml

    variables:
      # Configure mysql environment variables
      MYSQL_DATABASE: test_db
      MYSQL_ROOT_PASSWORD: test_db
    before_script:
      ## Docker Configuration
      # Get program needed for the test
      - apt-get update -yqq
      - apt-get install git zip unzip wget mariadb-client -yqq
      # Copy custom php.ini
      - cp tests/parameters.yml ./app/config/parameters.yml
      - cp tests/test_php.ini /usr/local/etc/php/conf.d/test.ini
      # Install PHP extension MySQL
      - docker-php-ext-install pdo_mysql
      # Install PHP pcntl
      - docker-php-ext-install pcntl
      # Install xDebug
      - pecl install xdebug
      - docker-php-ext-enable xdebug
      ## Software Installation
      - cd /[buildPath]
      # Install composer dependencies
      - curl -sS https://getcomposer.org/installer | php
      - php composer.phar install --prefer-dist --no-progress
      # Install codeception
      - wget -q http://codeception.com/releases/2.2.5/codecept.phar
      # Build Suites
      - php codecept.phar build
      # Clear and Warmup Cache
      - php app/console cache:clear --env=prod
      - php app/console cache:clear --env=dev
      - php app/console cache:clear --env=test
      - php app/console cache:warmup --env=prod
      - php app/console cache:warmup --env=dev
      - php app/console cache:warmup --env=test
    software:TestCoverage:
      image: php:5.6
      services:
        - mariadb:10.1
      script:
        - php app/console server:start
        - php codecept.phar run --coverage --no-colors
    software:Test:
      image: php:5.6
      services:
        - mariadb:10.1
      script:
        - php app/console server:start
        - php codecept.phar run --no-colors

    However, as soon as I activate the code coverage, it doesn't work anymore, I've got maximum execution time of 30 seconds exceeded errors! Weirdest thing, without any updates (that I'm aware of...), 1 or 2 weeks ago, all was working fine...

    Yep, codecoverage may take this long to be generated for big application. I'm not an expert in this area but did you try to increase timeout limit to something more than 30 seconds?

    Oh yeah... Forgot to mention in the despair I was that, I have a php.ini that set max_execution_time = 300. Without mentionning that the php.ini mention Note: This directive is hardcoded to 0 for the CLI SAPI for this max_execution_time directive... Using the PHAR, I'm a bit lost on where Codecept is able to modify a "hardcoded" directive...

    Ok, I think I figured out that my code for the 15 tests that I added lately cause this issue. Running my 15 new tests without the code behind fail, but without time out... Maybe I've got a almost infinite loop that trigger in my tests (but it isn't when doing manual testing...). I'll close this issue for now, but the max execution time of 30 secondes is really weird, since PHP tell us it's hardcoded!