Skip to content

Commit

Permalink
fix: 修复预加载计划生成时查询node超时 #2658
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlkl committed Nov 22, 2024
1 parent d940b48 commit 505a791
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import com.tencent.bkrepo.common.metadata.service.repo.RepositoryService
import com.tencent.bkrepo.common.mongo.dao.util.Pages
import com.tencent.bkrepo.repository.pojo.node.NodeDetail
import com.tencent.bkrepo.repository.pojo.node.NodeInfo
import com.tencent.bkrepo.repository.pojo.node.NodeListOption
import com.tencent.bkrepo.repository.pojo.repo.RepositoryInfo
import org.slf4j.LoggerFactory
import org.springframework.data.domain.PageRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ class NodeQueryWithoutShardingKeyTest @Autowired constructor(
nodeService.listNodeBySha256("notExistsSha256").apply { assertEquals(0, size) }

// 测试单表数据量小于limit的情况
nodeService.listNodeBySha256(sha256, 20, tillLimit = false).apply { assertEquals(18, size) }
nodeService.listNodeBySha256(sha256, 100, tillLimit = true).apply { assertEquals(20, size) }
nodeService.listNodeBySha256(sha256, 20, tillLimit = false).apply { assertEquals(6, size) }
nodeService.listNodeBySha256(sha256, 100, tillLimit = true).apply { assertEquals(18, size) }

// 测试单表数据量等于limit的页
nodeService.listNodeBySha256(sha256, 18, tillLimit = true).apply { assertEquals(18, size) }
nodeService.listNodeBySha256(sha256, 18, tillLimit = false).apply { assertEquals(18, size) }
nodeService.listNodeBySha256(sha256, 6, tillLimit = true).apply { assertEquals(6, size) }
nodeService.listNodeBySha256(sha256, 6, tillLimit = false).apply { assertEquals(6, size) }

// 测试获数据量小于pageSize的页
nodeService.listNodeBySha256(sha256, 10, tillLimit = true).apply { assertEquals(10, size) }
nodeService.listNodeBySha256(sha256, 10, tillLimit = false).apply { assertEquals(10, size) }
nodeService.listNodeBySha256(sha256, 3, tillLimit = true).apply { assertEquals(3, size) }
nodeService.listNodeBySha256(sha256, 3, tillLimit = false).apply { assertEquals(3, size) }
}

private fun generateTestData(size: Int, generateSha256Func: (Int) -> String) {
Expand Down

0 comments on commit 505a791

Please sign in to comment.