cmd/jujud: upgrades test refactoring

A bunch of refactoring of the tests relating to machine agent upgrades.