mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
test in a faster (and less flaky) way that unrelated folder creation doesn't lead to RootIndex rebuild
GitOrigin-RevId: 7ea55d075e7f73bf93b9e6434b67957631362ee6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
034a2eb3c1
commit
4715136e24
+9
-13
@@ -988,24 +988,20 @@ public class DirectoryIndexTest extends DirectoryIndexTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testUnrelatedDirectoriesCreationMustNotLeadToDirectoryIndexRebuildToImproveCheckoutPerformance() {
|
||||
public void testUnrelatedDirectoriesCreationMustNotLeadToDirectoryIndexRebuildToImproveCheckoutSpeed() {
|
||||
VirtualFile root = ModuleRootManager.getInstance(myModule).getContentRoots()[0];
|
||||
WriteAction.run(()->ModuleRootModificationUtil.updateModel(myModule, model -> {
|
||||
ContentEntry rootEntry = model.getContentEntries()[0];
|
||||
for (int i=0;i<10_000;i++) {
|
||||
VirtualFile src = createChildDirectory(root, "extsrc" + i);
|
||||
rootEntry.addSourceFolder(src, false);
|
||||
}
|
||||
rootEntry.addSourceFolder(createChildDirectory(root, "extsrc"), false);
|
||||
}));
|
||||
|
||||
ProjectFileIndex fileIndex = ProjectFileIndex.getInstance(getProject());
|
||||
PlatformTestUtil.startPerformanceTest("dir creation must not lead to dirindex rebuild", 30_000, ()->{
|
||||
for (int i=0; i<2_000; i++) {
|
||||
VirtualFile xxx = createChildDirectory(root, "xxx");
|
||||
assertFalse(fileIndex.isInSource(xxx));
|
||||
delete(xxx);
|
||||
}
|
||||
}).assertTiming();
|
||||
DirectoryIndexImpl dirIndex = (DirectoryIndexImpl)DirectoryIndex.getInstance(myProject);
|
||||
RootIndex rootIndex = dirIndex.getRootIndex();
|
||||
|
||||
VirtualFile xxx = createChildDirectory(root, "xxx");
|
||||
assertFalse(ProjectFileIndex.getInstance(getProject()).isInSource(xxx));
|
||||
delete(xxx);
|
||||
assertSame(rootIndex, dirIndex.getRootIndex());
|
||||
}
|
||||
|
||||
public void testSourceRootResidingUnderExcludedDirectoryMustBeIndexed() throws IOException {
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ public final class DirectoryIndexImpl extends DirectoryIndex implements Disposab
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private RootIndex getRootIndex() {
|
||||
RootIndex getRootIndex() {
|
||||
RootIndex rootIndex = myRootIndex;
|
||||
if (rootIndex == null) {
|
||||
myRootIndex = rootIndex = new RootIndex(myProject);
|
||||
|
||||
Reference in New Issue
Block a user