Jade's weblog

Making git bisect play nicely with Rails

At New Relic, we use Hudson to continuously run our test suite. When something breaks, we usually know exactly who broke it, and we fix it right away.

Occasionally, however, the test is hard to fix, or the person is unavailable to fix it. Then things start piling up and it's difficult to tell when something broke.

Also, sometime you get a regression and write a new test that duplicates the failed test, and you want to find out when it initially broke.

The usual tool for finding when something broke it using git bisect. It does a binary search and finds the exact commit that broke something. And, it even can use the output of a script to automatically determine the exact commit, based on the result of a test script.

However, a big problem in Rails is that your environment gets out of sync with the codebase pretty quickly. You have to run bundle each time git bisect updates, and then migrate your database to keep it in sync. It can be quite a pain to do it manually, and these things tend to prevent you from running the automatic scripts.

I hacked together a very rough script (based loosely on this one: http://pivotallabs.com/users/jnoble/blog/articles/1678-using-git-bisect-to-find-where-something-broke) that automates everything. It's probably slower than if you did it manually, but it IS automatic, so you can go get a cup of coffee and come back with the answer to where it broke.

WARNING: This will blow away your database, AND any uncommitted work!

Here's a very early version of these scripts (I'll probably modify them as I use them more):

script/git-bisect.sh


#!/bin/bash
set -e

if [ -z "$1" ]; then
echo This script automates the process of finding what broke a particular test
echo To use it, go to the base directory of the core site project, and type:
echo
echo $0 path_to_ruby_test.rb
echo
echo note the ruby test script should not be saved in git
echo The script will use git bisect to find the initial commit that broke the test
exit
fi

echo We assume it is currently broken, and that it was okay a month ago

WEEKS_AGO=`ruby -rdate -e '(Date.today - ARGV.first.to_i).display' 31`

git bisect start
git bisect bad
git checkout `git rev-list -n 1 --before="$WEEKS_AGO" master`
git bisect good

git bisect run script/git-bisect-run-one.sh $1


script/git-bisect-run-one.sh


#!/bin/bash
set -e

if [ -z "$1" ]; then
echo usage: use git-bisect.sh, which calls this
exit
fi

git checkout .
bundle
rake db:drop
rake db:create
rake db:migrate
rake db:test:prepare
ruby -Itest $1

01:40 PM, 19 May 2011 by Jade Rubick Permalink | Comments (0)

I've created a website called Plantworking, which is a place to get answers to your questions from other people in your climate. It also acts as a collaborative garden log.

To understand the idea behind Plantworking, try and imagine if everyone on Facebook or Twitter was only posting topics that were related to gardening. Imagine the usefulness of that!

I'm actively working on the site, and I'd appreciate any feedback you might have.

http://www.plantworking.com

09:12 AM, 08 Jun 2010 by Jade Rubick Permalink | Comments (0)

Don't comment your code

If you're commenting your code, it's not clear enough.

02:25 PM, 05 May 2010 by Jade Rubick Permalink | Comments (0)

Delete the .vmss file from the Virtual Machine's Package fixes the issue.

05:55 PM, 06 Jan 2009 by Jade Rubick Permalink | Comments (0)

Hello this is 9-1-1, can I have your insurance number please?

Another reason for national health insurance is the stupid fights you have with your insurance company.

We called an ambulance for an emergency with our daughter (it turned out fine, that's another story), and when the bill came, it turns out that THIS PARTICULAR AMBULANCE COMPANY is not freakin' covered by UNITED HEALTH CARE's stupid insurance.

Can you imagine? Like you're supposed to ask 911 when you call, "do you take United Health Care?"

%&(@ng insurance companies.

06:14 PM, 29 Aug 2008 by Jade Rubick Permalink | Comments (0)

Setting up git commit emails

We're moving Volunteer Solutions to git this week. One thing that wasn't documented well was how to set up git emails.

There is a git-notify script out there, but in contrib there is post-receive-email.

It's actually easy to set up:

cd .git/hooks
mv post-receive post-receive.bak
ln -s /path/to/post-receive-email post-receive
chmod a+x /path/to/post-receive-email
git config --add hooks.mailinglist "email@address.com"
git config hooks.emailprefix "[scms]"
emacs ../description (make first line short description, then add more later)

Note that the script seemed to only send emails when they were pushed from outside.

02:58 PM, 12 Jun 2008 by Jade Rubick Permalink | Comments (2)

Oracle external tables [orafaq.com]

Oracle has a built-in facility for accessing text files as if they were tables in the database.

This is a screaming fast way of loading data into a table, and it is easier than SQLLDR, plus you can keep your foreign key constraints etc..

I used this at United eWay to replace some pages that were taking several hours to load data from a CSV file. The new script took a second or two instead of more than 18+ hours to run (and it actually never completed).

Combined with the MERGE SQL command, this is pretty powerful stuff.

03:43 PM, 17 Sep 2007 by Jade Rubick Permalink | Comments (0)

Good overview by Tom.

10:39 AM, 26 Oct 2006 by Jade Rubick Permalink | Comments (0)

Various translation tools [labnol.blogspot.com]

Good resource.

11:49 AM, 15 Sep 2006 by Jade Rubick Permalink | Comments (0)

Useful.

06:37 PM, 22 Aug 2006 by Jade Rubick Permalink | Comments (0)

Airfare Predictions [www.farecast.com]

Tells you if airplane prices are going to go up or down...

12:45 PM, 02 Jul 2006 by Jade Rubick Permalink | Comments (0)

Look up real estate values [www.zillow.com]

.

12:45 PM, 02 Jul 2006 by Jade Rubick Permalink | Comments (0)

"BIN" Invalid objects

The invalid objects that looked something like BIN* I believe represent binary forms of triggers or other pl/sql blocks. There must be a bug in Oracle which does not drop the binary forms when dropping the original object.

The solution I've used is:

sqlplus user/pass
purge recycle bin;

then recompile invalid objects

Courtesy of MB

11:01 PM, 13 Feb 2006 by Jade Rubick Permalink | Comments (0)

Very useful.

12:17 PM, 18 Jan 2006 by Jade Rubick Permalink | Comments (0)

Where to host my virtual server next?

Need to run Debian, need 256MB memory, need lots of disk space 7GB +

Tektonic:
http://www.tektonic.net/vds.php?op=budget_plans
UM2
$28 / mo, 256 MB memory, 20 GB disk, 1.0Mbit Un-Metered
Unmetered bandwidth
Daily Backups

Spry
http://www.spry.com/webmin-vps/
Webmin VPS 200
$25-30 / mo, 256 mb memory, 10 GB disk, unmetered bandwidth
Daily backups
May I upgrade my OS? All of our VPS accounts use a shared kernel which will limit your choices when upgrading. You may be able to upgrade several user-land programs (Apache, Perl, PHP, gcc) but you will not be able to perform a complete OS upgrade.


Vinod's quest:
http://wiki.kurup.org/wiki/show/FindNewWebHost

I decided on tektonic.net, although I think either Tektonic or Spry would have been great.

05:56 PM, 13 Nov 2005 by Jade Rubick Permalink | Comments (0)

.

10:37 AM, 20 Jun 2005 by Jade Rubick Permalink | Comments (0)

.

11:21 PM, 07 May 2005 by Jade Rubick Permalink | Comments (0)

This is a pretty impressive collection of heuristics for web design.

06:57 PM, 04 Apr 2005 by Jade Rubick Permalink | Comments (0)

Getting svn to use https

.

01:54 PM, 18 Mar 2005 by Jade Rubick Permalink | Comments (0)

Firefox doesn't start up?

On Firefox, if your system crashes (or runs out of batteries and goes dead when you though you had it plugged in), it will not start back up properly.

When you start back up the system, it will bring up a "Choose User Profile" box, but won't start up with the default profile.

The fix is quite easy. Look in .mozilla/firefox/tt2k25do.default/ or something like that. Remove the lock file.

12:26 PM, 10 Mar 2005 by Jade Rubick Permalink | Comments (1)

This helped me set up the commit-email.pl script. The path isn't set up by default, I believe.

01:39 PM, 01 Feb 2005 by Jade Rubick Permalink | Comments (0)

Animal-Human Hybrids Spark Controversy [news.nationalgeographic.com]

Scientists are blending now creating GMO animals:

Scientists have begun blurring the line between human and animal by producing chimeras—a hybrid creature that's part human, part animal.

Chinese scientists at the Shanghai Second Medical University in 2003 successfully fused human cells with rabbit eggs. The embryos were reportedly the first human-animal chimeras successfully created. They were allowed to develop for several days in a laboratory dish before the scientists destroyed the embryos to harvest their stem cells.

In Minnesota last year researchers at the Mayo Clinic created pigs with human blood flowing through their bodies.

And at Stanford University in California an experiment might be done later this year to create mice with human brains.

This reminds me of a thought experiment I had about ten years ago while in college:

Humans and apes are fairly similar genetically. Yet some religious groups think that people have souls and apes do not. Given that we can now start blending the line between humans and apes, imagine doing an experiment where..

You 'create' 100 children:

  • The first child is 100% human, 0% ape.
  • The next child is 99% human, 1% ape.
  • The next child is 98% human, 1% ape.
  • Etc...
  • The last child is 100% ape, 0% human.

Now these people believe that having a soul is a binary thing. Either you have a soul or you don't. So the question is: which of these children have souls, and which do not?

(Stop and think about that before continuing. What do you think?)

The conclusion you (inevitably I think) come to is one of the following:

  • There is a gene for having a soul. Somewhere in your genetic material is a gene that makes you have a soul. Or,
  • There is no such thing as the soul. Or,
  • The soul is not a binary thing at all. There are degrees of soul.

I won't say which of those I subscribe to, but I thought it an interesting thing to think about.

11:13 AM, 27 Jan 2005 by Jade Rubick Permalink | Comments (0)

Mailman with AOLserver [mail.python.org]

It looks like it's quite possible to run Mailman on Aolserver. I've gotten it to mostly work. The main problem I seem to be having is that I can't get the cgi mapping to work. Here's what I have:

ns_section "ns/server/${server}/module/nscgi"
ns_param map "GET /mailman/ ${mailmanprefix}/cgi-bin"
ns_param map "POST /mailman/ ${mailmanprefix}/cgi-bin"

If I put a symlink from www/mailman to the /usr/local/mailman directory, it mostly works (but only mostly). But it really should work with the mapping, so I've removed the symlink, and I've tried fiddling with it in lots of ways. I'm back to the original configuration (I verified that), and am wondering if there is some trick to it.

Vinod says you have to list every directory, and I've tried that as well, although I really hope that is not the case.

Anyone have any suggestions?

11:23 AM, 23 Jan 2005 by Jade Rubick Permalink | Comments (2)

HOT AIR: Postal Experiments [www.improb.com]

Hilarious.

08:32 PM, 18 Jan 2005 by Jade Rubick Permalink | Comments (0)

Measuring code complexity [www.linuxjournal.com]

Describes some of the ways you can attempt to measure the complexity of software.

One of the flaws in open-source software is that everyone wants the software to do different things -- so users add in lots of options. This article exposes the danger of not being selective when adding new functionality in.

12:15 PM, 13 Jan 2005 by Jade Rubick Permalink | Comments (0)

Researchers at the University of Toronto have invented an infrared-sensitive material that's five times more efficient at turning the sun's power into electrical energy than current methods.

04:12 PM, 10 Jan 2005 by Jade Rubick Permalink | Comments (0)

The age of smart drugs is dawning. Modafinil is just one in an array of brain-boosting medications — some already on pharmacy shelves and others in development — that promise an era of sharper thinking through chemistry.

Would you take a drug that made you smarter?

08:00 PM, 20 Dec 2004 by Jade Rubick Permalink | Comments (0)

.

12:23 PM, 16 Dec 2004 by Jade Rubick Permalink | Comments (0)

How to manage smart people [www.uiweb.com]

An excellent essay on how to be an effective manager of smart people. My favorite part is where he suggests asking your team member: "What do you need to kick ass on this project?"

02:35 PM, 14 Dec 2004 by Jade Rubick Permalink | Comments (0)

New York Times: Year in Ideas [www.nytimes.com]

Loved this last year, loved it this year.

08:51 PM, 12 Dec 2004 by Jade Rubick Permalink | Comments (0)

Google for source code [www.koders.com]

Very interesting

01:30 PM, 10 Nov 2004 by Jade Rubick Permalink | Comments (0)

My skype id is jadeforrest.

06:58 PM, 09 Nov 2004 by Jade Rubick Permalink | Comments (0)

Canister filters discussion [www.wetwebmedia.com]

Very good reviews.

01:38 PM, 30 Oct 2004 by Jade Rubick Permalink | Comments (0)

New Apple wireless mouse issues

Work purchased me a new wireless mouse, and it's been great.

However, occasionally the mouse slows down. I applied a Bluetooth update, which seemed to help, but now the problem is back..

This is driving me nuts.

02:18 PM, 29 Oct 2004 by Jade Rubick Permalink | Comments (0)

XML

Notifications

You may request notification for Jade's weblog.

Syndication Feed

XML

Recent Comments

  1. Jade Rubick: And... yes and no
  2. Jade Rubick: Using hoptoad
  3. Jade Rubick: Much better
  4. Bodo Tasche: Link changed :)
  5. Bodo Tasche: Better commt emails. Now with color :)
  6. Jade Rubick: Filed a ticket
  7. Vinod Kurup: Wow
  8. Jade Rubick: Then what
  9. Paul Post: Percentages
  10. Paul Post: I might be an ENFJ?