cmd/jujud: fix upgrade worker error handling

If the connection to state is lost then return an error so that the machine agent will restart. For other errors, don't return the error because we want the machine agent to stay running wait for user intervention.

This change also adds tests for the handling of upgradeWorkerContext's UpgradeComplete channel. This was previously untested.
Let's not have two names -- just `var connectionIsDead = func(conn pinger) bool {...` and then we can patch it just the same.