Сбой сборки Ошибка пересылки нового сеанса Пустой пул ВМ для настройки Возможности browserName: chrome - PullRequest
0 голосов
/ 11 июня 2019

Итак, я запускаю свои тесты с использованием Jenkins, скрипт Pipeline делает все для меня, но сборка завершается неудачно в тот момент, когда он говорит:
WebDriver::debugWebDriverLogs method has been called when webDriver is not set для каждого теста и в конце журнала также говорится: [Facebook\WebDriver\Exception\UnknownServerException] Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome}

Я пытался изменить эту часть:

сразу после того, как я потяну: sh 'docker pull selenium/standalone-chrome'

из этого: 'docker run -d -p 4444:4444 --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-dubnium'

в:

'docker run -d -p 4444:4444 --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-palladium'

Сценарий конвейера вот такой


    node {
       stage('Pull latest Docker repo') { 
          git credentialsId: 'xxxx',
              url: 'git@bitbucket.org:my/test-app.git'
       }
       stage('Install app') {
          sh 'docker-compose down'
          sh 'docker-compose build --no-cache mysql'
          echo "Will deploy from ${branch}";
          echo "BuildApp Param ${buildapp}";
          if (params.buildapp == true){
            sh 'docker-compose build --no-cache --build-arg BRANCH=${branch} apache'
          }
          sh 'docker-compose up -d'
       }
       stage('Set up Selenium') {
          try {
            sh 'docker rm selenium -f'
          }
          catch(exc) {
            echo 'No selenium container running'
          }
          sh 'docker pull selenium/standalone-chrome'
          sh 'docker run -d -p 4444:4444 --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-dubnium'
       }
       stage('Load tests') { 
          dir("../") {}
          git credentialsId: 'xxxx',
              url: 'git@bitbucket.org:mytests.git'
       }
       stage('Run tests') {
          sh 'composer install'
          sh 'vendor/bin/codecept --debug run --steps tests/jenkins'
       }
    }```

    Expected results: for the build to run, as it is running over weekend and on Saturday morning it was OK, passing all the tests, Sunday and Monday morning failing with those errors and since then I am trying to figure out what is happening.

    Here is the output in Jenkins:

    ```Started by user 
    Running in Durability level: MAX_SURVIVABILITY
    [Pipeline] Start of Pipeline
    [Pipeline] node
    Running on Jenkins in /var/lib/jenkins/jobs/Autotest/workspace
    [Pipeline] {
    [Pipeline] stage
    [Pipeline] { (Pull latest Docker repo)
    [Pipeline] git
    using credential xxxx
     > git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > git config remote.origin.url git@my/test-app.git
     # timeout=10
    Fetching upstream changes from git@bitbucket.org:my/test-app.git
     > git --version # timeout=10
    using GIT_SSH to set credentials Jenkins Portal Tests Repo
     > git fetch --tags --progress git@bitbucket.org:mydocker.git +refs/heads/*:refs/remotes/origin/*
     > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
     > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
    Checking out Revision 20cdc207dc87e736983d6b28b5a81853c7c37f70 (refs/remotes/origin/master)
     > git config core.sparsecheckout # timeout=10
     > git checkout -f 20cdc207dc87e736983d6b28b5a81853c7c37f70
     > git branch -a -v --no-abbrev # timeout=10
     > git branch -D master # timeout=10
     > git checkout -b master 20cdc207dc87e736983d6b28b5a81853c7c37f70
    Commit message: "Got rid of the WORKDIR"
     > git rev-list --no-walk 20cdc207dc87e736983d6b28b5a81853c7c37f70 # timeout=10
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Install app)
    [Pipeline] sh
    + docker-compose down
    Stopping workspace_apache_1 ... 
    Stopping workspace_mysql_1  ... 
    [2A[2K
    Stopping workspace_apache_1 ... [32mdone[0m
    [2B[1A[2K
    Stopping workspace_mysql_1  ... [32mdone[0m
    [1BRemoving workspace_apache_1 ... 
    Removing workspace_mysql_1  ... 
    [1A[2K
    Removing workspace_mysql_1  ... [32mdone[0m
    [1B[2A[2K
    Removing workspace_apache_1 ... [32mdone[0m
    [2BRemoving network workspace_frontend
    Removing network workspace_backend
    [Pipeline] sh
    + docker-compose build --no-cache mysql
    Building mysql
    Step 1/2 : FROM mysql:5.7.24
     ---> ba7a93aae2a8
    Step 2/2 : ADD mysql.cnf /etc/mysql/mysql.conf.d/mysql.cnf
     ---> ba3aa48cc1b5
    Successfully built ba3aa48cc1b5
    Successfully tagged workspace_mysql:latest
    [Pipeline] echo
    Will deploy from feature/jenkins-autotests
    [Pipeline] echo
    BuildApp Param false
    [Pipeline] sh
    + docker-compose up -d
    Creating network "workspace_frontend" with the default driver
    Creating network "workspace_backend" with the default driver
    Creating workspace_mysql_1 ... 
    Creating workspace_mysql_1
    [1A[2K
    Creating workspace_mysql_1 ... [32mdone[0m
    [1BCreating workspace_apache_1 ... 
    Creating workspace_apache_1
    [1A[2K
    Creating workspace_apache_1 ... [32mdone[0m
    [1B[Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Set up Selenium)
    [Pipeline] sh
    + docker rm selenium -f
    selenium
    [Pipeline] sh
    + docker pull selenium/standalone-chrome
    Using default tag: latest
    latest: Pulling from selenium/standalone-chrome
    Digest: sha256:e10140556650edfd1000bba6c58053f4c97c0826ef785858ed1afa6f82284e23
    Status: Image is up to date for selenium/standalone-chrome:latest
    [Pipeline] sh
    + docker run -d -p 4444:4444 --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-dubnium
    WARNING: Published ports are discarded when using host network mode
    3f379a0da28bfcf7f7912a05d757b6115773292c1a426199325f75cfae97988d
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Load tests)
    [Pipeline] dir
    Running in /var/lib/jenkins/jobs/Autotest
    [Pipeline] {
    [Pipeline] }
    [Pipeline] // dir
    [Pipeline] git
    using credential xxxx
     > git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository
     > git config remote.origin.url git@bitbucket.org:my/test-app.git
    # timeout=10
    Fetching upstream changes from git@bitbucket.org:app/portal-tests.git
     > git --version # timeout=10
    using GIT_SSH to set credentials Jenkins Portal Tests Repo
     > git fetch --tags --progress git@bitbucket.org:app/portal-tests.git +refs/heads/*:refs/remotes/origin/*
     > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
     > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
    Checking out Revision 1b4abdc36d9ca1339770d92efc5fad172cca3bc7 (refs/remotes/origin/master)
     > git config core.sparsecheckout # timeout=10
     > git checkout -f 1b4abdc36d9ca1339770d92efc5fad172cca3bc7
     > git branch -a -v --no-abbrev # timeout=10
     > git branch -D master # timeout=10
     > git checkout -b master 1b4abdc36d9ca1339770d92efc5fad172cca3bc7
    Commit message: "Commented out the test to not run anymore"
     > git rev-list --no-walk 1b4abdc36d9ca1339770d92efc5fad172cca3bc7 # timeout=10
    [Pipeline] }
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] { (Run tests)
    [Pipeline] sh
    + composer install
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Nothing to install or update
    Generating autoload files
    [Pipeline] sh
    + vendor/bin/codecept --debug run --steps tests/jenkins
    Codeception PHP Testing Framework v2.5.2
    Powered by PHPUnit 6.5.13 by Sebastian Bergmann and contributors.
    Running with seed: 


    [1mJenkins Tests (48) [22m-----------------------------------------
    Modules: [32mWebDriver, \Helper\Acceptance[39m
    ------------------------------------------------------------
    [35;1mtest1:[39;22m test1
    Signature: [32mtest1[39m
    Test: [32mtests/acceptance/test1.php[39m
    [33mScenario --[39m
    [36m  WebDriver::debugWebDriverLogs method has been called when webDriver is not set[39m
    [36m  WebDriver::_saveScreenshot method has been called when webDriver is not set[39m
    [36m  WebDriver::_savePageSource method has been called when webDriver is not set[39m
    [36m  Screenshot and page source were saved into '/var/lib/jenkins/jobs/Autotest/workspace/tests/_output/' dir[39m
    [31;1m ERROR [39;22m

[37;41;1m Test [39;49;22m tests/acceptance/test1.php
[37;41;1m                                                                                                                                                        [39;49;22m
[37;41;1m  [Facebook\WebDriver\Exception\UnknownServerException] Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome}  [39;49;22m
[37;41;1m                                                                                                                                                        [39;49;22m
#1  /var/lib/jenkins/jobs/Autotest/workspace/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:114
#2  /var/lib/jenkins/jobs/Autotest/workspace/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:326
#3  /var/lib/jenkins/jobs/Autotest/workspace/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
#4  /var/lib/jenkins/jobs/Autotest/workspace/vendor/symfony/event-dispatcher/EventDispatcher.php:212
#5  /var/lib/jenkins/jobs/Autotest/workspace/vendor/symfony/event-dispatcher/EventDispatcher.php:44```

Ответы [ 3 ]

0 голосов
/ 12 июня 2019

Может ли кодирование или другой пакет композитора обновиться между последним проходом и сейчас?

Находится ли узел Дженкинса в одной и той же начальной точке каждый раз?

0 голосов
/ 12 июня 2019

Я думаю, что я разобрался:

sudo netstat -tulpn | grep :4444 

Это порт, который я использую, и результат его был:

tcp6       0      0 120.0.1.1:4444          :::*                    LISTEN      1739/java

Я убил процесс, выполнив:

sudo kill 1739

И теперь тесты снова запускаются.

Спасибо за помощь.

0 голосов
/ 12 июня 2019

Я думаю, что это как-то связано с этой частью:

+ docker run -d -p 4444:4444 --name=selenium --net=host -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-dubnium
WARNING: Published ports are discarded when using host network mode

Но забавно то, что я не трогал ее с момента последней прошедшей сборки.

...