cmd/jujud: upgrades test refactoring

A bunch of refactoring of the tests relating to machine agent upgrades.
And the test and implementation run in a single goroutine.