IJPL-224359 fix tests searching for more files than expected

SearchEverywhereContributor.search searches for elementsLimit + 1, so in tests where search was expected to finish quickly after it found 1 file, it continued searching. Setting elementsLimit to 0 instead of 1 removes the issue

Space-RevId: ac6852d582b35f2ee4ae9cad71ba72159f90ab52

GitOrigin-RevId: e27d7cee7f03a0bdb084227503e8dadea1fa32c1
This commit is contained in:
Ilia Malakhov
2026-01-21 17:55:54 +00:00
committed by intellij-monorepo-bot
parent 647035e534
commit 9deaa2e1b2
@@ -105,7 +105,10 @@ open class NonIndexableFileSearchPerformanceTest {
val searchPattern = "ProjectRootEntity"
val contributor = createContributor()
Benchmark.newBenchmarkWithVariableInputSize("search \"$searchPattern\"", nonIndexableFilesCount) {
contributor.search(searchPattern, MockProgressIndicator(), 1)
// elementsLimit = 0, so when the first matching file is found, the search stops.
// Because it actually searches for `elementsLimit + 1` files
val elementsLimit = 0
contributor.search(searchPattern, MockProgressIndicator(), elementsLimit)
nonIndexableFilesCount
}.start(NonIndexableFileSearchPerformanceTest::`search for one file deep inside`.javaMethod!!, subtestName)
}
@@ -139,7 +142,10 @@ open class NonIndexableFileSearchPerformanceTest {
val filename = communityVirtualFile.getChildren(true).last().name
val contributor = createContributor()
Benchmark.newBenchmarkWithVariableInputSize("search \"$filename\"", nonIndexableFilesCount) {
contributor.search(filename, MockProgressIndicator(), 1)
// elementsLimit = 0, so when the first matching file is found, the search stops.
// Because it actually searches for `elementsLimit + 1` files
val elementsLimit = 0
contributor.search(filename, MockProgressIndicator(), elementsLimit)
nonIndexableFilesCount
}.start(NonIndexableFileSearchPerformanceTest::`search for one last root child`.javaMethod!!, subtestName)
}
@@ -173,7 +179,10 @@ open class NonIndexableFileSearchPerformanceTest {
val filename = communityVirtualFile.getChildren(true).first().name
val contributor = createContributor()
Benchmark.newBenchmark("search \"$filename\"") {
contributor.search(filename, MockProgressIndicator(), 1)
// elementsLimit = 0, so when the first matching file is found, the search stops.
// Because it actually searches for `elementsLimit + 1` files
val elementsLimit = 0
contributor.search(filename, MockProgressIndicator(), elementsLimit)
}.start(NonIndexableFileSearchPerformanceTest::`search for the first root child`.javaMethod!!, subtestName)
}