7/25 Opscode Code Review


We’ve been a bit remiss in not communicating well about the importance
of testing and what we’re doing. I want to write up a wiki page but I
keep putting it off. What’s most important right now are the RSpec
tests that are in the spec/ folder of the Chef, Ohai, and some of the
smaller projects. When merging a contribution we rebase the topic
branch against master and then run the spec tests. If they fail, we
usually go back and reopen the ticket without merging to master. Once
we merge to master and push it up to github, it triggers our Jenkins
CI to run the spec tests against Ruby 1.8 and 1.9 on Linux and Ruby
1.9 on Windows. If one of these tests fail, we have a few options.
Usually we fix the tests ourselves rather than revert. Sometimes we’ll
reach out the contributor to see if they can fix it right away.

These tests got crufty recently and I just finished going back through
and getting them all passing. There are a couple failures that aren’t
occurring on our CI but sometimes do on a workstation. I think some of
them have to do with data leaking from one test to the next. You can
sometimes see this by running rspec against a single file, then all of
the unit tests, then running ‘rake spec’ which also runs some
functional tests.

If you haven’t run the spec tests before, please do so now. Throw it
off, see how it works.

The Chef unit tests are run from inside of the chef directory. Here
are a few examples:

/src/chef/chef rake spec # Runs both the functional tests and the unit tests /src/chef/chef rake spec:unit # Runs just the unit tests
/src/chef/chef rake functional # Runs just the function tests /src/chef/chef rspec -cb spec/unit/* # Runs just the unit tests,
with a nice color output and provides a full backtrace on failure
/src/chef/chef $ rspec -cb spec/unit/cookbook_loader_spec.rb # The
same as above but against a single set of tests

If you’re having trouble, make sure you’re running a recent version of
rspec. Using bundler usually helps, despite being magical duct tape.

I’ll be merging the backlog into chef/master shortly. Then we’ll be
forking an 0.10-stable branch in preparation for incoming Chef 11

These are the combined notes from a Cook review we did on Tuesday
because Joshua’s on vacation the rest of this week.

To merge:
CHEF-3301 - NameError when running chef-client as a service on
Windows Server 2008 R2
CHEF-3311 - knife bootstrap -j doesn’t work with Ubuntu 12.04 template
COOK-1382 - Trigger APT update immediately after adding a new repository
COOK-1408 - Unicorn provider in refactored application_ruby does not
use user & group set in parent application resource when creating
runit service
COOK-1420 - Template Resource’s source Cookbook is wrong
COOK-1421 - pip using old -E syntax
COOK-1422 - syncdb using --migrate option
COOK-1433 - Resolve foodcritic warnings on users cookbook
COOK-1437 - postgresql::server_redhat recipe only reloads
postgresql.conf at end of run
COOK-1442 - Missing [‘postfix’][‘domain’] Attribute causes initial
installation failure
COOK-1444 - nagios cookbook includes check_solr.rb, but doesn’t use
it anywhere
COOK-1447 - add mod_include to apache2 cookbook
COOK-1448 - add logrotate to apache2 cookbook
COOK-1449 - IIS pool regex returns true if a similar site exists
COOK-1282 - Python pip provider rescues incorrect error.
COOK-1477 - pip’s requirements.txt and “Editable Package” support in
COOK-1061 - iis_site resource doesn’t allow setting the pool
COOK-1286 - Creation of the website doesn’t allow to directly set
wich app pool to use on IIS
COOK-1285 - allow multiple host_header, port or protocol on IIS
COOK-1283 - typo on pool
COOK-1340 - wix cookbook version and location needs updating
COOK-1284 - recipe to install iis application initialization

CHEF-3164 - gem_package poor interaction with omnibus via memoized
Gem environment variables
Closed - Already merged
OHAI-326 - unable to display some values when specified from the command line
Reopened - This should case on ‘data’ not on 'a’
COOK-1435 - apt repository lwrp is not idempotent when using an http key
Reopened - Typos?
COOK-1443 - MySQL (>= 5.1.24) does not support innodb_flush_method = fdatasync
Reviewed - Needs another look to check for an update
COOK-1381 - Better handling of apt-update
Closed - Duplicate COOK-1382
COOK-1384 - mysql client needs to be omnibus-aware
Reviewed - Waiting on dependencies in COOK-1441
CHEF-2923 - Cookbook Upload Fails due to Syntax Error in unrelated
cookbook’s metadata file
Reopened - Reduce duplication, and unit tests
OHAI-390 - run_command fail if the current path doesn’t exists
Reopened - Further refinement needed on cwd for Windows.

Bryan McLellan | opscode | technical program manager, open source
© 206.607.7108 | (t) @btmspox | (b) http://blog.loftninjas.org