fleetctl: improve cachedMachineState
fleetctl: fix tests