Extract upgrade steps worker

Make the upgrade steps worker code more testable by ripping it out of the machine agent. Take advantage of this to make the upgrade tests significantly simpler and faster.

This is all in preparation for further changes around state agent synchronisation during upgrades.


hmm. isMaster seems like it doesn't use the receiver at all; and ensureMongoServer... well, it does, but I'm deeply suspicious of it. It definitely needs the ChangeConfig stuff -- but the other things it uses the agent for a deeply disturbing, like having a mongo-setup mutex on the agent... but if that's important I'd kinda expect it to be mutexed at another level, like mongo.EnsureServer itself.

Maybe best not touch all that stuff right now, it smells like a rabbit hole, but at least isMaster probably doesn't need to be on the interface.

And... wait. If we're passing an apiState in, can't we do setMachineStatus from there?

As usual, all the above may be bad (or just ill-timed) ideas.