cmd/jujud: upgrades test refactoring

A bunch of refactoring of the tests relating to machine agent upgrades.
I'm pretty sure there isn't a problem here. fakePerformUpgrade can't be called once runUpgradeWorker has returned so there's no way attempts could be changed when it's being checked. Also, the test and the code that's being tested runs in a single goroutine...