fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] Seeking advice on testing fabfile execution logic


From: John Kerbawy
Subject: [Fab-user] Seeking advice on testing fabfile execution logic
Date: Wed, 19 Sep 2012 21:34:07 -0400

Hello, Fabric users:

I'm attempting to write automated tests for an inherited 1.3.3 fabfile
and am stuck on a problem involving execute() and the env.*host*
variables.

The convoluted "top level" task adjusts the list of remote/target
hosts based on user input and then calls a number of other subtasks
via execute(). I am attempting to verify that the subtasks are
executed on the expected hosts.

It seems that both the parsing/merging of env.hosts/roles/roledefs is
done in execute() as well as the spawning of subtask processes and I'm
stumped on bypassing the spawning piece. Note that in this particular
test, I don't care what the subtasks do, just that they're executed;
their logic will be tested separately. The ideal test will also
prevent any changes to the ordering of host lists in future Fabric
releases from going unnoticed.

The best testing solution I've come up with involves replacing the
real subtasks with mocks that append their env.host to a file since
that's easily shared between processes. My sample code is at
https://gist.github.com/3753107.

Any suggestions on how I can tell what hosts execute() is about to be
called for without forking processes?

Thanks!

--



reply via email to

[Prev in Thread] Current Thread [Next in Thread]