Tuesday, September 9, 2014

One Yak Too Many?


Yesterday I was able to get a Jenkins server up and running on a Linode, properly secured, and checking out Dart and JavaScript code for testing. Although the test script ran, I do not yet have a successful test—mostly due to lack of additional dependencies.

I am still building this on a Debian 6 LTS Linode host. I continue working through the error messages as they occur on the server. First up:
scripts/test.sh: line 14: xvfb-run: command not found
That is easy enough:
$ sudo apt-get install xvfb
I was happy to discover xvfb-run the other day as it makes testing life easier. Since I had never used it, I thought it might be an new addition to the xvfb package, but it is even present on this old LTS system.

Next, I install Bower and Karma globally:
$ npm install -g bower karma-cli
I might be able to do away with the global bower install, but really there is no harm in having it globally. It seems like a reasonable system-wide dependency to have available on a test box.

Now if I run the Jenkins build, I get:
...
[TEST] book/code-js/angular (Bower updated).
/home/cstrom/local/node-v0.10.31/lib/node_modules/karma/node_modules/di/lib/injector.js:9
      throw error('No provider for "' + name + '"!');
            ^
Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
...
This one is a little tricky. The solution is obvious enough—I need to install the karma-jasmine NPM package. But how should this get installed?

I think the answer is that my test script should be responsible for this. The karma-jasmine plugin is technically a dependency of each individual project chapter. The testing script is already working through each project chapter, installing bower components and running Karma:
for X in book/code-js/*
do
    # Change the current working directory to a chapter's code directory:
    cd $X

    # Update bower
    bower update --quiet
    echo "(Bower updated)."

    # Run the Karma tests
    xvfb-run karma start --single-run --log-level warn
    # ...
done
On my dev box, I manually ensure that the NPM dependencies (like karma plugins) are installed with a command line npm install. I need some way to automate this on my test server. Since I am already bower installing, I might as well npm install first.

I think.

I am honestly unsure about that so, for now, I add a sed script before the test runner in Jenkins' Execute Shell entry:
#!/bin/bash -l

export PATH=/home/cstrom/local/node-v0.10.31/bin:$PATH

sed -i 's/bower update --quiet/npm install; bower update --quiet/' scripts/test.sh

scripts/test.sh
The sed script modifies the all-chapters test runner, adding npm intall before the bower install. If this works, I will ruminate on it and possibly edit the test.sh global test runner. Of course, that does not work...

After all that, I finally reach:
ERROR [launcher]:  Cannot start Chrome
 Can not find the binary google-chrome
 Please set env variable CHROME_BIN
This seems easy enough. I grab the latest stable Chrome:
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
And install it:
sudo dpkg -i google-chrome-stable_current_i386.deb                                                                   ~/Downloads
Selecting previously deselected package google-chrome-stable.
(Reading database ... 40540 files and directories currently installed.)
Unpacking google-chrome-stable (from google-chrome-stable_current_i386.deb) ...
dpkg: dependency problems prevent configuration of google-chrome-stable:
 google-chrome-stable depends on gconf-service; however:
  Package gconf-service is not installed.
 google-chrome-stable depends on libgconf-2-4 (>= 2.31.1); however:
  Package libgconf-2-4 is not installed.
 google-chrome-stable depends on libgdk-pixbuf2.0-0 (>= 2.22.0); however:
  Package libgdk-pixbuf2.0-0 is not installed.
 google-chrome-stable depends on libglib2.0-0 (>= 2.28.0); however:
  Version of libglib2.0-0 on system is 2.24.2-1.
...
And here, I may be stuck.

I do not know if it is going to be possible to install Chrome on Debian 6 because of these errors. I suppose I might try Firefox instead, but that seems more like a nice-to-have whereas Chrome is a requirement to fully test Polymer. It looks like I may need to upgrade to Debian 7. Which may be one yak too many.


Day #178

No comments:

Post a Comment