[db] Assert that DB transaction gets rolled back when index update fails

This commit is contained in:
Torsten Grote
2022-09-09 16:49:51 -03:00
committed by Michael Pöhn
parent f9f81dc894
commit 6b4e91ca0b

View File

@@ -130,6 +130,11 @@ internal class IndexV1UpdaterTest : DbTest() {
val result = indexUpdater.updateNewRepo(repo, "not the right fingerprint")
assertIs<IndexUpdateResult.Error>(result)
assertIs<SigningException>(result.e)
// check that the DB transaction was rolled back and the DB wasn't changed
assertEquals(repo, repoDao.getRepository(repoId) ?: fail())
assertEquals(0, appDao.countApps())
assertEquals(0, versionDao.countAppVersions())
}
@Test