Sorry for the belated reply (Hadoop summit). And sorry for not explaining Shell functionality – basically you don't need to do sudo once you've created a shell under particular user. IOW, the following:
sh.exec("sudo -u hdfs hdfs dfsadmin -report");
shHDFS.exec("hdfs dfsadmin -report");
but the shell should be create like this:
static Shell shHDFS = new Shell("/bin/bash", "hdfs");
To answer your earlier question: the tests can't assume that they run on the NameNode, everything else should be fine.
At some point we might need to introduce a feature that would let us classify the tests into buckets that are potentially destructive to the environment and the safe ones. But this is an open question of how to do easy-to-use testsuite creation.