0

So I am running my tests using Jenkins, the Pipeline script is doing all for me but the build is failing at the point where it's saying:
WebDriver::debugWebDriverLogs method has been called when webDriver is not set for each tests and at the end of the log is also saying: [Facebook\WebDriver\Exception\UnknownServerException] Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: chrome}

I have tried in changing this part:

just after I pull: sh 'docker pull selenium/standalone-chrome'

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

in to:

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

The pipeline script is this one


 node {
 stage('Pull latest Docker repo') { 
 git credentialsId: 'xxxx',
 url: '[email protected]: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: '[email protected]: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 [email protected]:my/test-app.git
 > git --version # timeout=10
 using GIT_SSH to set credentials Jenkins Portal Tests Repo
 > git fetch --tags --progress [email protected]: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 [email protected]:my/test-app.git
 # timeout=10
 Fetching upstream changes from [email protected]:app/portal-tests.git
 > git --version # timeout=10
 using GIT_SSH to set credentials Jenkins Portal Tests Repo
 > git fetch --tags --progress [email protected]: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```
asked Jun 11, 2019 at 13:03

2 Answers 2

1

I think I sorted out:

sudo netstat -tulpn | grep :4444 

That is the port that I am using and the result of it was:

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

I killed the process by doing:

sudo kill 1739

And now tests are running again.

Thank you for the help.

answered Jun 12, 2019 at 15:03

Comments

0

I think it has something to do with this part:

+ 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

But the funny thing is that I haven't touch it since the last passed build.

answered Jun 12, 2019 at 8:48

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.