The tests now run godeps

Nate Finch nate.finch at canonical.com
Wed Aug 20 19:18:05 UTC 2014


In an effort to make sure that dependencies.tsv is actually correct, the
tests in github.com/juju/juju now run godeps -t ./... and compare its
output to dependencies.tsv.  The test looks for godeps first in the $PATH,
and then in the first $GOPATH/bin.  If it is not found, it currently skips
the test (because CI doesn't have godeps when it runs the tests).
 Eventually I'd like to make the test not skippable, since anyone running
the tests (except CI) needs godeps anyway... but to get this in sooner
rather than later, I think it's ok to let it be skipped.

Note that in submitting the PR, I actually had to fix dependencies.tsv to
get the test to pass, because it was wrong.... which is exactly why this
test exists.

You can now run go test from github.com/juju/juju and it'll tell you if
something's wonky with dependencies.tsv... it'll tell you if there are
entries in it that aren't needed, it'll tell you if you're missing entries
that should be in it, and it'll tell you if one of your branches is on the
wrong commit.

*Note:* this means you can't just willy-nilly append your latest dependency
to dependencies.tsv.  They need to be in alphabetical order.  The easiest
way to do that is just to run godeps -t ./... > dependencies.tsv from
github.com/juju/juju.  That'll produce the right output.  Obviously, check
the diff to make sure the changes it produces are the ones you expect.

This also means that we need to ensure godeps produces the right output on
all OSes.  If you have a dependency that exists only in an OS-specific
file, the godeps test will fail on OSes other than that one (e.g. if
there's a dependency in an _windows.go file, the test will fail on linux,
because godeps doesn't see the windows dependencies).  To fix this, the
easiest thing to do is import the same library in an OS-agnostic file, and
give it a name of underscore, which will prevent the unused package error,
thusly:  _ "foo.com/my/win/lib"

-Nate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20140820/104ed98b/attachment.html>


More information about the Juju-dev mailing list