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.


I'm a bit suspicious that all the different possible results for these methods indicate that we're missing other tests somewhere. Progress not perfection in this CL, though, I imagine we'll be writing a *bunch* more tests around the actual database-master upgrades...