[db] don't allow initial repos from fixtures to provide weight

The client was already auto-incrementing their weight anyway. But it leaked our internal weight handling into the library consumer which can cause issues like when me are making changes to how we handles repo weights as we are doing now.
This commit is contained in:
Torsten Grote
2023-11-03 11:30:44 -03:00
parent b993da8db8
commit 51a4bcec58
3 changed files with 5 additions and 4 deletions

View File

@@ -30,7 +30,6 @@ internal class RepositoryDaoTest : DbTest() {
certificate = "abcdef", // not random, because format gets checked
version = Random.nextLong(),
enabled = Random.nextBoolean(),
weight = Random.nextInt(),
)
val repoId = repoDao.insert(repo)
@@ -41,7 +40,7 @@ internal class RepositoryDaoTest : DbTest() {
assertEquals(repo.certificate, actualRepo.certificate)
assertEquals(repo.version, actualRepo.version)
assertEquals(repo.enabled, actualRepo.enabled)
assertEquals(repo.weight, actualRepo.weight)
assertEquals(Int.MAX_VALUE - 2, actualRepo.weight) // ignoring provided weight
assertEquals(-1, actualRepo.timestamp)
assertEquals(3, actualRepo.mirrors.size)
assertEquals(emptyList(), actualRepo.userMirrors)