Problem/Motivation

In order to have javascript tests at some point for core it would be nice to have phantomjs installed.

#2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary

Proposed resolution

Remaining tasks

  • Wait for containers to be rebuilt and AMI's to be updated.

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Status: Active » Needs review
FileSize
995 bytes

So is that something like a start?

dawehner’s picture

FileSize
6.5 KB

Some more work.

elachlan’s picture

elachlan’s picture

elachlan’s picture

In #2575501: [PP-2] DrupalCI should return failed for poor code style - JS they need to update the container definition to include:

  • nodejs
  • epm
  • jslint

It would make sense to update the container definition in one issue.

jslint requires npm to install. Using the command
sudo npm install -g jslint

elachlan’s picture

FileSize
6.53 KB

Some minor changes to add the packages.

Not sure how to add the npm command. Might have to be just below the package installs.

elachlan’s picture

FileSize
7.14 KB

Added the npm command and fixed some white space problems

attiks’s picture

It looks like this patch is doing more then adding phantomjs, isn't it easier to just add phantomjs, eslint to the image?

There's also a job attached, but it says PHPUnit?

  1. +++ b/containers/base/php-base/Dockerfile
    @@ -53,6 +53,10 @@ RUN apt-get clean && apt-get update && \
    +    epm \
    

    Why is epm needed?

  2. +++ b/containers/base/php-base/Dockerfile
    @@ -63,8 +67,9 @@ RUN apt-get clean && apt-get update && \
    +    npm install -g jslint
    

    We need to install eslint

  3. +++ b/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/PHPUnitFunctionalJSJob.php
    @@ -0,0 +1,83 @@
    +    'DCI_PHPVersion' => '5.4',
    

    Is a default of 5.5 not better?

elachlan’s picture

It looks like this patch is doing more then adding phantomjs, isn't it easier to just add phantomjs, eslint to the image?

Its merging in changes for #2575501: [PP-2] DrupalCI should return failed for poor code style - JS as well, since they both are changing the container. How would we go about adding them to the image?

There's also a job attached, but it says PHPUnit?

Not sure, it was in the first patch.

Why is epm needed?

I was going off what was stated in https://www.drupal.org/node/2575501#comment-10441657

1. Add nodejs / epm / jslint to DrupalCI container definitions

I epm might have been a typo?

Is a default of 5.5 not better?

I agree 5.5 is a better default.

dawehner’s picture

If I understand things correctly than we actually don't need a new job because BrowserTestBase will already be executed via run-tests.sh and the testbot team actually wants to keep that wrapper, which is kinda sad, but yeah I'm curious whether setting up phantomjs + using run-tests.sh would be enough already.

  1. +++ b/containers/base/php-base/Dockerfile
    @@ -53,6 +53,10 @@ RUN apt-get clean && apt-get update && \
    +    phantomjs \
    +    nodejs \
    +    npm \
    +    epm \
    
    @@ -63,8 +67,9 @@ RUN apt-get clean && apt-get update && \
         unzip && \
    -   apt-get clean && apt-get autoremove -y && \
    -    rm /etc/cron.d/php5
    +    apt-get clean && apt-get autoremove -y && \
    +    rm /etc/cron.d/php5 && \
    +    npm install -g jslint
    

    I think we should just add what is really needed as part of this test, you know, we want to avoid changing too many things at the same time. Filing another patch is easy

  2. +++ b/containers/base/php-base/conf/scripts/start.sh
    --- /dev/null
    +++ b/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/PHPUnitFunctionalJSJob.php
    
    +++ b/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/PHPUnitFunctionalJSJob.php
    @@ -0,0 +1,83 @@
    +class PHPUnitJob extends JobBase {
    

    Oh yeah we need to rename the class

dawehner’s picture

Btw. Thanks so you much for helping on this issue!!

nod_’s picture

Status: Needs review » Needs work

npm install -g jslint

we use eslint, not jshint.

elachlan’s picture

FileSize
7.13 KB

Changed to eslint and removed epm. Kept php 5.4 because all the other files have it as the default. I think if we update it then ALL of them should be updated at the same time. That can be done in another issue.

@dawehner, not sure what to call the class. Maybe PHPJSUnitJob?

attiks’s picture

#14 or PHPUnitJSJob

elachlan’s picture

I like #15 better.

@attiks - simpletest has a default php 5.5, but phpunit has php 5.4. Do you want me to do up another issue to mark them all as php5.5 as a follow up issue?

attiks’s picture

#16 Since it is a default it really doesn't matter that much, but would be nice to change it to 5.5

elachlan’s picture

What does everyone think of the class name?

PHPJSUnitJob or PHPUnitJSJob?

dawehner’s picture

@elachlan
For now its actually enough to just keep the run-tests.sh one, as this is also running the functional tests, all we need is to have phantomjs setup for those as well.

elachlan’s picture

Ok, so what needs to be done?

elachlan’s picture

@dawehner Does that mean we really only need the dockerfile now?

dawehner’s picture

Status: Needs work » Needs review
FileSize
1.04 KB

Well I think this is all we actually need is the following ...

elachlan’s picture

@dawehner - What about the stuff required for #2575501: [PP-2] DrupalCI should return failed for poor code style - JS?

Did you want to do it in another issue?

dawehner’s picture

@dawehner - What about the stuff required for #2575501: DrupalCI should return failed for poor code style - JS?

Yeah, well, they are all technically out of scope of this issue.
Technically its not necessarily about the change, but it makes life harder for reviewers if there are unrelated changes. Rerolling a patch is easy compared to the other aspects of work on an issue.

elachlan’s picture

OK cool the patch looks ok to me then.

elachlan’s picture

Anyone else want to Review the patch? It is significantly smaller.

attiks’s picture

Status: Needs review » Reviewed & tested by the community

#22 Looks good

elachlan’s picture

The parent issue #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary says to use composer to install PhantomJS. Which would mean the version is consistent in the test environment. The way we have implemented it looks like it would install what ever is the latest version. Is this correct?

attiks’s picture

Installing phantomjs for each run will slow down all tests, AFAIK the latest stable phantomjs version for linux is 1.9.8, it's been like that for a while.

dawehner’s picture

The parent issue #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary says to use composer to install

This is just the issue summary IMHO

elachlan’s picture

Ok, just checking we were doing the right thing. Thanks for the clarification :)

isntall’s picture

Status: Reviewed & tested by the community » Needs review

I have a branch with phantomjs and moved the command to call phatomjs in the drupalci.yml file for simpletest.

  • isntall committed ddc511e on 2580007-add-phantomjs-to-the-testrunners
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
elachlan’s picture

Looks ok to me. Would be good to get another review other than me.

attiks’s picture

Status: Needs review » Reviewed & tested by the community

Looks ok to me as well

Mixologic’s picture

Yup +1. It has to go into the job. /var/www/html/vendor wont even exist until we setup the codebase.

isntall’s picture

Component: Code » DrupalCI console script

Here's a staging job i ran with code
https://dispatcher.drupalci.org/job/staging_simpletest_job/281/
(this job and output will not be here indefinitely)

elachlan’s picture

00:29:13 Executing execute:command
00:29:13 Executing on container instance d9e84a2d:
00:29:13 phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
00:29:13 Command created as exec id 634640ff
00:29:13 HTTP/1.1 200 OK
00:29:13 Content-Type: application/vnd.docker.raw-stream

Looks like it executed ok? Doesn't look like it has broken anything.

What should we be looking for?

isntall’s picture

Issue tags: +Needs deployment
isntall’s picture

Assigned: Unassigned » isntall
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs deployment

This has been merged into dev, production and is now live.

dawehner’s picture

Yeah!!
Thank you @isntall!

Wim Leers’s picture

\o/

isntall’s picture

Status: Fixed » Needs work

phantomjs is in there, and executed, but it's not working. The phantomjs program stops running.

elachlan’s picture

Could we pipe the output to a file to get some more information? Are there any logs?

elachlan’s picture

We need some help over at #2609560: Base DCI containers off official containers, which hopefully will simplify the containers and help get phantomJS working.

isntall’s picture

Unfortunately getting phantomjs to stay running in back gournd and #2609560: Base DCI containers off official containers are separate issues.

In this issue even though phantomjs is set to run in the background, it does not.

Executing on container instance 5ff53162:
phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1  &
Command created as exec id f4218718
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream


ps aux
Command created as exec id dde83d46
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  3.0  0.0   4448  1592 ?        Ss   08:44   0:00 /bin/sh /usr/sb
root        26  5.0  0.2 3328168 37140 ?       S    08:44   0:00 /usr/sbin/apach
www-data    77  0.0  0.0 3328200 8796 ?        S    08:44   0:00 /usr/sbin/apach
www-data    78  0.0  0.0 3328200 8796 ?        S    08:44   0:00 /usr/sbin/apach
www-data    79  0.0  0.0 3328200 8796 ?        S    08:44   0:00 /usr/sbin/apach
www-data    80  0.0  0.0 3328200 8796 ?        S    08:44   0:00 /usr/sbin/apach
www-data    81  0.0  0.0 3328200 8796 ?        S    08:44   0:00 /usr/sbin/apach
root       170  0.0  0.0  15572  2128 ?        Rs+  08:44   0:00 ps aux
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream

And phantomjs needs to be started after patches are applied to be sure it gets the latest changes.

elachlan’s picture

isntall’s picture

@elachlan that might have been the missing piece.

i was trying to use the daemon command to run phantomjs and that wasn't working.

daemon -- nohup phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768
seems to keep phantomjs up in the background

https://dispatcher.drupalci.org/job/staging_simpletest_job/319/

00:01:05.538 daemon -- nohup phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768
00:01:05.540 Command created as exec id 857d0ac4
00:01:05.580 HTTP/1.1 200 OK
00:01:05.580 Content-Type: application/vnd.docker.raw-stream
00:01:05.580 
00:01:05.580 
00:01:05.580 ps aux -www
00:01:05.581 Command created as exec id 05b21ae2
00:01:05.691 USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
00:01:05.692 root          1  0.2  0.0   4440   708 ?        Ss   17:54   0:00 /bin/sh /usr/sbin/apache2ctl -D FOREGROUND
00:01:05.694 root         17  0.5  0.0 3328160 28448 ?       S    17:54   0:00 /usr/sbin/apache2 -D FOREGROUND
00:01:05.695 www-data     30  0.0  0.0 3328192 7368 ?        S    17:54   0:00 /usr/sbin/apache2 -D FOREGROUND
00:01:05.697 www-data     31  0.0  0.0 3328192 7368 ?        S    17:54   0:00 /usr/sbin/apache2 -D FOREGROUND
00:01:05.698 www-data     32  0.0  0.0 3328192 7368 ?        S    17:54   0:00 /usr/sbin/apache2 -D FOREGROUND
00:01:05.698 www-data     33  0.0  0.0 3328192 7368 ?        S    17:54   0:00 /usr/sbin/apache2 -D FOREGROUND
00:01:05.699 www-data     34  0.0  0.0 3328192 7368 ?        S    17:54   0:00 /usr/sbin/apache2 -D FOREGROUND
00:01:05.700 root        394  0.0  0.0  17172   384 ?        S    17:54   0:00 daemon -- nohup phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768
00:01:05.702 root        395  0.0  0.0  15564  1136 ?        Rs+  17:54   0:00 ps aux -www
00:01:05.703 root        399  0.0  0.0  57680   320 ?        D    17:54   0:00 /usr/lib/phantomjs/phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768
00:01:05.705 HTTP/1.1 200 OK
00:01:05.705 Content-Type: application/vnd.docker.raw-stream

Also, could someone tell me what i'm looking for with phantomjs and run-test.sh in the console output. I have not seen it working with run-test.sh, so i don't know what to look for.

elachlan’s picture

The thing is we don't have much until its combined with #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary. Which should run tests the ToolbarIntegrationTest. At least that is what I think is supposed to happen.

  • isntall committed 15146d1 on 2580007-add-phantomjs-to-the-testrunners-01 authored by dawehner
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 4f66c90 on 2580007-add-phantomjs-to-the-testrunners-01
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
isntall’s picture

Status: Needs work » Needs review

I've something very close to 4f66c90 and it seemed to keep phantomjs running. Once has been reviewed i can commit it to dev and test it again.

dawehner’s picture

Thanks a lot isntall!

Why do we need the sleep here? Just curious

Mixologic’s picture

Why do we need the sleep here? Just curious

So that we dont start testing before the phantomjs server has had time to initialize. The daemon nohup will return immediately and start testing if its not there.

isntall’s picture

I had basic review this over my shoulder, and he said it looked good. I'm going to commit it to dev.

elachlan’s picture

Thanks isntall!

  • isntall committed 15146d1 on 2580007-disable-phantomjs-until-containers authored by dawehner
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 4f66c90 on 2580007-disable-phantomjs-until-containers
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • Mixologic committed 6e1b7c4 on 2580007-disable-phantomjs-until-containers
    Issue #2580007: Disables phantomjs execution until container rebuilds...
dawehner’s picture

Interesting, I would have expected that daemon doesn't continue until the daemonized process is ready to rock

Mixologic’s picture

The container changes have been deployed to production, so we can now rebuild the containers and the AMI. Once that is done we can uncomment this and push it up as well.

Mixologic’s picture

Status: Needs review » Needs work
dawehner’s picture

@Mixologic
So can we uncomment things now? Just being curious.

elachlan’s picture

Waiting on it being re-enabled to test the other issue.

elachlan’s picture

Status: Needs work » Needs review
FileSize
1.43 KB

When testing this it failed for me because daemon wasn't installed.

Here is the fix as well as re-enabling.

It seems to pass testing locally as well when running tests from #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary.

Edit: ToolbarIntegrationTest didn't pass. But BrowserWithJavascriptTest did.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice! Thank you @elachlan

Mixologic’s picture

Status: Reviewed & tested by the community » Needs work

@elachlan: I think you're working off of the wrong branch or something. You'll notice that its already added in this commit: http://cgit.drupalcode.org/drupalci_testbot/commit/?id=4f66c90

This needs work because there isnt a patch that can be submitted to move this forward, there is infrastructure deployments that need to happen. Once those do, we can uncomment and proceed.

dawehner’s picture

So we basically just wait?

elachlan’s picture

Issue summary: View changes

Yes I see it, sorry.

Mixologic’s picture

Status: Needs work » Reviewed & tested by the community

Okay, not closing until we know theres nothing else to do testbot wise, but we have this in production now. Give it a whirl.

dawehner’s picture

Awesome!

elachlan’s picture

Title: Add phantomjs to the testrunners » Add phantomjs2 to the testrunners
Status: Reviewed & tested by the community » Needs work

Apparently we need version 2 to be able to use BIND.

See #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary.

elachlan’s picture

FileSize
1.23 KB

This was harder than I expected.

There is no official package. So I tried using npm/nodejs/phantomjs2. But that failed.

So then I saw the npm package phantomjs2 was just installing the binary from https://github.com/bprodoehl/phantomjs/releases/

So I ended up just using that.

elachlan’s picture

Status: Needs work » Needs review
elachlan’s picture

The reason I am installing from the git repository is that PhantomJS are having issues compiling a static linux binary. Associated issue can be found at https://github.com/ariya/phantomjs/issues/12948

Once a release has been finalised, an official package will be released and we can use apt-get again.

You can track the release of phantomjs 2.0.1 at https://github.com/ariya/phantomjs/issues/12902

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

I guess some review from the CI team would be great, but it fixes the problems, yeah!!

xjm’s picture

Priority: Normal » Major

As a blocker for frontend testing, this issue is quite important.

elachlan’s picture

PhantomJS issue on github has been updated.

They are waiting until the release of phantomjs 2.1 and are using docker to build the static binaries.
https://github.com/ariya/phantomjs/issues/13822

This will mean sometime in the next few months we will have a proper package to install from.

dawehner’s picture

Let's ping everyone again, to get some more attention again. We have a ready patch since 1,5 months now.

  • isntall committed 15146d1 on 2580007--add-phantomjs-to-the-testrunners-02 authored by dawehner
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 31f32b4 on 2580007--add-phantomjs-to-the-testrunners-02 authored by Mixologic
    Issue #2580007: re-enables phantomjs post container/ami rebuild
    
  • isntall committed 4f66c90 on 2580007--add-phantomjs-to-the-testrunners-02
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 6de5665 on 2580007--add-phantomjs-to-the-testrunners-02 authored by elachlan
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs2 to the...
  • Mixologic committed 6e1b7c4 on 2580007--add-phantomjs-to-the-testrunners-02
    Issue #2580007: Disables phantomjs execution until container rebuilds...
elachlan’s picture

Thanks for that isntall.

So phantomjs finished up on their issue, but still have sub issues and blockers for their 2.1 release. They are also trying to find a CI system reflecting their changes to use docker.

https://github.com/ariya/phantomjs/issues/13828

So if anyone could give some advice on that, it would probably be appreciated.

Mixologic’s picture

Looks to me like SemaphoreCI is stepping up to help them with their build process.

elachlan’s picture

Yes, It looks that way.

I don't see a definitive list of issues for the release. So it is not clear when an official package for ubuntu/debian will be released.

elachlan’s picture

isntall’s picture

I d not have the time to look too deep into this, but here are the results
https://dispatcher.drupalci.org/job/staging_simpletest_job/343/
latest web-5.5:dev container
https://www.drupal.org/files/issues/2469713-jtb.102.patch
drupal commit a34dfb2

elachlan’s picture

Status: Reviewed & tested by the community » Needs work

Just to keep everyone updated. The above test failed.

Someone will have to run it locally to get the actual outputted error from the tests.

dawehner’s picture

I'm looking into that.

dawehner’s picture

One interesting thing I observed is that there are more and more phantomjs processes started:

ps aux | grep "phantomjs" | wc -l
63

The next one is the following error message:

    <testcase name="testToolbarToggling" class="Drupal\Tests\toolbar\Functional\ToolbarIntegrationTest" file="/var/www/html/core/modules/toolbar/tests/src/Functional/ToolbarIntegrationTest.php" line="24" assertions="0" time="0.000000">
      <error type="PHPUnit_Framework_Exception">Drupal\Tests\toolbar\Functional\ToolbarIntegrationTest::testToolbarToggling
PHPUnit_Framework_Exception: PHP Fatal error:  Uncaught exception 'GuzzleHttp\Exception\ConnectException' with message 'cURL error 7: Failed to connect to 127.0.0.1 port 8510: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:186
Stack trace:

So we seem to have to forward port the 8510 port to the php/web container, currently in the process of figuring that out.

dawehner’s picture

So it worked temporarily when I killed all of those 63 instances and then after a while it didn't worked anymore.
Maybe a guess: we could use --name and --restart in order to ensure we just have one phantomjs instance running at a time and that one is able to use port 8510 always?

isntall’s picture

I've pushed up the changes to phantomJS to DCI so it is baked into the production containers.

(these changes shouldn't make much of a difference, but now we don't need to install daemon before the tests run)

isntall’s picture

Looking at one of the updated testrunners:

root@f4bb4521b75e:/opt/phpenv/plugins/php-build# ps aux | grep phantomjs
root        240  0.0  0.0  17172   388 ?        S    22:01   0:00 daemon -- nohup /usr/bin/phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768
root        245  0.0  0.0 2526756 31448 ?       Sl   22:01   0:00 /usr/bin/phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/html/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768
root      54601  0.0  0.0   8864   644 ?        S+   22:26   0:00 grep --color=auto phantomjs

which should be correct.

elachlan’s picture

PhantomJS have prepared the packages for 2.1.1 and are looking to release in the next couple of days.
https://github.com/ariya/phantomjs/issues/12970

elachlan’s picture

dawehner’s picture

Status: Needs work » Needs review
FileSize
5.1 KB
2.41 KB

As described in #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary we want to skip using concurrency for the javascript tests.

elachlan’s picture

The URL needs to change to use the new official static compiled binary.
https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x8...

Something along the lines of this, we also won't need unzip any more!

RUN curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -o ~/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
    tar xvfj ~/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C ~/phantomjs && \
    mv ~/phantomjs/bin/phantomjs /usr/bin/phantomjs && \
    rm -f ~/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
    rm -rf ~/phantomjs && \
    chmod 755 /usr/bin/phantomjs
xjm’s picture

In a meeting with the core committers and DA infrastructure staff today, we learned that it will take a lot of resources or a long time to actually implement this on DrupalCI. A workaround was proposed for the short-term: #2663086: [meta] Determine whether run-tests.sh can trigger and report phantomjs and phpcs results

attiks’s picture

#93

a lot of resources or a long time

What does this mean, is this hours, days, months, 100$, 1000$, 10000$, ...

If we don't add - proper - js testing, how will we test issues like: #2645250: [META] Start using reactive declarative JS programming for some new core admin UIs, #2651660: Investigate where and how a frontend framework could be used

dawehner’s picture

Its super confusing why we stop working on something right before we have something actually working.

attiks’s picture

##9 Agree, would love to hear what the problem is why this cannot be done.

dawehner’s picture

Now that #2670978: Allow to run just specific types when running all tests changed its direction, we need to adapt the job types as well.

This now runs properly on my local testbot instance.

isntall’s picture

FileSize
1.85 KB

Here's the patch I've been working on that keeps everything in on Job Type.

  • Mixologic committed 04bb04b on 2580007-phantomjs-insertion authored by isntall
    Issue #2580007 by dawehner, elachlan, isntall: Add phantomjs2 to the...
  • isntall committed 15146d1 on 2580007-phantomjs-insertion authored by dawehner
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 31f32b4 on 2580007-phantomjs-insertion authored by Mixologic
    Issue #2580007: re-enables phantomjs post container/ami rebuild
    
  • isntall committed 4f66c90 on 2580007-phantomjs-insertion
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 6de5665 on 2580007-phantomjs-insertion authored by elachlan
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs2 to the...
  • Mixologic committed 6e1b7c4 on 2580007-phantomjs-insertion
    Issue #2580007: Disables phantomjs execution until container rebuilds...
  • Mixologic committed fa184ab on 2580007-phantomjs-insertion
    Issue #2580007: re-enables phantomjs post container/ami rebuild
    
Mixologic’s picture

Only the top commit is relevant in that latest barrage of commits (apparently versioncontrol comments is going to go back through history and post every one with a matching label)

So, a couple of things were discussed in IRC.

1. We cannot currently merge this in until both:
#2670978: Allow to run just specific types when running all tests and #2680057: Allow to not override the simpletest results on a new test run land in core

Those may not land in 8.0.x because nobody wants to keep adding stuff there unless its a CVE. But we cant break 8.0.x testing until 8.0.x it utterly closed, because there might be a CVE.

So, in order to get this in we need to modify this patch/branch to detect if it is running on 8.0.x, and if so, skip running the second testcommand, and set the DCI_TestGroups back to just --all:

This will need to work with both contrib modules testing against 8.0.x as well as core 8.0.x tests. If we can build in that backwards compatibility, then we can:

1. commit #2670978: Allow to run just specific types when running all tests and #2680057: Allow to not override the simpletest results on a new test run to 8.1.x
2. commit this to drupalci prod as a hotfix.
3. Test it out using #2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary

Mixologic’s picture

Status: Needs review » Postponed (maintainer needs more info)

Marking this postponed until we know for sure whether the core maintainers want to allow the previous patches into 8.0.x, or whether we should build in backwards compatibility. (or until 8.0.x is completely closed - whichever comes first)

dawehner’s picture

Status: Postponed (maintainer needs more info) » Needs review

Both will be done, as it seems to be.

isntall’s picture

Status: Needs review » Fixed

Changes to core have been committed adding the functionality for this patch to be available.
This patch has been deployed as a hotfix.

Mixologic’s picture

Status: Fixed » Needs work

An update: So despite the nohups and the daemons, phantomjs still does not like to stay running in the container. This is currently due to some magic inside of the daemoncommand, coupled with docker, that causes the daemon process that is responsible for restarting the phantomjs service to be a child of the apache process that the container is based around.

Apache has this tendency to think every process that is a child of it must have been spawned by it, so therefore it also times some things out.

We're currently exploring ways to either get phantomjs to run as a restarting daemon, or perhaps we can figure out which apache setting could maybe be set to forever.

dawehner’s picture

Thank you @Mixologic for keeping up with the work with it!

isntall’s picture

We're currently working on a strategy to make a bash process the PID 1 and not apache2; all other processes children of that initial bash process.

  • Mixologic committed 04bb04b on 2580007-Add_phantomjs2_to_the_testrunners authored by isntall
    Issue #2580007 by dawehner, elachlan, isntall: Add phantomjs2 to the...
  • isntall committed 15146d1 on 2580007-Add_phantomjs2_to_the_testrunners authored by dawehner
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 31f32b4 on 2580007-Add_phantomjs2_to_the_testrunners authored by Mixologic
    Issue #2580007: re-enables phantomjs post container/ami rebuild
    
  • isntall committed 4f66c90 on 2580007-Add_phantomjs2_to_the_testrunners
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs to the...
  • isntall committed 6de5665 on 2580007-Add_phantomjs2_to_the_testrunners authored by elachlan
    Issue #2580007 by elachlan, dawehner, isntall: Add phantomjs2 to the...
  • Mixologic committed 6e1b7c4 on 2580007-Add_phantomjs2_to_the_testrunners
    Issue #2580007: Disables phantomjs execution until container rebuilds...
  • Mixologic committed fa184ab on 2580007-Add_phantomjs2_to_the_testrunners
    Issue #2580007: re-enables phantomjs post container/ami rebuild
    
isntall’s picture

Hmmmm...comment 107 is not showing the commit I added to 2580007-Add_phantomjs2_to_the_testrunners branch, 3e58bac788886efbb44c9101e5fcaddda173dc22; the branch is based off of production.

Here's the diff too.

Mixologic’s picture

Status: Needs work » Reviewed & tested by the community

This looks good to me. Lets see how we fare.

alexpott’s picture

So is this all deployed?

Mixologic’s picture

Docker hub is being a PITA right now.. taking a long time to rebuild the containers after the fixes, and when it does it's been having sporadic, unrelated issues. As soon as the containers rebuild, we'll be able to tag and deploy this to production.

dawehner’s picture

Thanks again @Mixologic and @isntall for the continuing work on this issue!

Wim Leers’s picture

Yay! Thanks, @Mixologic and @isntall! :)

alexpott’s picture

Any news on the deployment? Looking at the output from the latest test runs on core it does not look to be.

isntall’s picture

After a lot of builds and testing, the deployment was boring as I hoped it'd be.
All that to say phantomJS seems to be stable and running in the docker containers.

elachlan’s picture

Looks like #92 wasn't added. This would move us to using an official release.

It doesn't look like it will get added to apt-get any time soon. As there is a security issue with it listed on debian.
https://security-tracker.debian.org/tracker/CVE-2013-4549

From my understanding it can only move out of testing when it has no more security issues or something like that. So ubuntu won't get it until after its finalised in debian.

From what I can tell it seems that it won't get fixed until PhantomJS 2.2 is released.
https://github.com/ariya/phantomjs/issues/14102

Mixologic’s picture

Status: Reviewed & tested by the community » Fixed

Re: 116: I think we're fine using the fork for now. This current implementation shoves phantomjs in where it doesnt go, with the goal of unblocking core.

We should open another issue to introduce a standalone phantomjs container, as our current situation will for the time being, but the lack of parallelization and the fact that we have phantom running inside the php container isnt what we want.

Marking this as fixed and opened a new issue #2702849: Improve phantomjs infrastructure

Hooray for javascript testing!

Mixologic’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.