Fix replication job state changing
This fixes datastore behavior that lacked test coverage and was actually broken (see failed job). Changing a replication job state to complete was broken. This fix includes refactoring the in-memory datastore to use a map for storing replication jobs. Some tests have also been cleaned up.
Edited by Paul Okstad (ex-GitLab)