LPS-34775 Tests for Staged Repositories (and fix bugs found)