mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[lvcs]: flaky tests fixed
* always consider test root creation as a LVCS event and always record it into the storage; * flaky reason: if somethings calls getChildren method for entire tmp test directory (async) a.e. PuppetProjectManager class, then entire test dir will be marked as All_CHILDERN_LOADED and all next child direcory creations will generate VFS events (after real file creation, during get VF for this file request); these events will be handled by subscribers (including lvcs handler);
This commit is contained in:
@@ -57,7 +57,7 @@ public class BasicsTest extends IntegrationTestCase {
|
||||
LocalHistory.getInstance().putUserLabel(myProject, "global");
|
||||
|
||||
assertEquals(3, getRevisionsFor(f).size());
|
||||
assertEquals(3, getRevisionsFor(myRoot).size());
|
||||
assertEquals(4, getRevisionsFor(myRoot).size());
|
||||
|
||||
LocalHistory.getInstance().putUserLabel(myProject, "file");
|
||||
|
||||
@@ -73,7 +73,7 @@ public class BasicsTest extends IntegrationTestCase {
|
||||
VirtualFile f = createChildData(myRoot, "file.txt");
|
||||
|
||||
assertEquals(2, getRevisionsFor(f).size());
|
||||
assertEquals(2, getRevisionsFor(myRoot).size());
|
||||
assertEquals(3, getRevisionsFor(myRoot).size());
|
||||
|
||||
LocalHistory.getInstance().putSystemLabel(myProject, "label");
|
||||
|
||||
@@ -82,7 +82,7 @@ public class BasicsTest extends IntegrationTestCase {
|
||||
assertEquals("label", rr.get(1).getLabel());
|
||||
|
||||
rr = getRevisionsFor(myRoot);
|
||||
assertEquals(3, rr.size());
|
||||
assertEquals(4, rr.size());
|
||||
assertEquals("label", rr.get(1).getLabel());
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class BasicsTest extends IntegrationTestCase {
|
||||
VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(vfile);
|
||||
assertEquals(1, jarRoot.findChild("file.txt").contentsToByteArray()[0]);
|
||||
|
||||
assertEquals(2, getRevisionsFor(myRoot).size());
|
||||
assertEquals(3, getRevisionsFor(myRoot).size());
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Object, IOException>() {
|
||||
@Override
|
||||
@@ -181,7 +181,7 @@ public class BasicsTest extends IntegrationTestCase {
|
||||
jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(vfile);
|
||||
assertEquals(2, jarRoot.findChild("file.txt").contentsToByteArray()[0]);
|
||||
|
||||
assertEquals(2, getRevisionsFor(myRoot).size());
|
||||
assertEquals(1, getRevisionsFor(jarRoot).size());
|
||||
assertEquals(3, getRevisionsFor(myRoot).size());
|
||||
assertEquals(2, getRevisionsFor(jarRoot).size());
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -167,7 +167,7 @@ public class FileListeningTest extends IntegrationTestCase {
|
||||
rename(f, "file.txt");
|
||||
assertEquals(before + 1, getRevisionsFor(myRoot).size());
|
||||
|
||||
assertEquals(2, getRevisionsFor(f).size());
|
||||
assertEquals(3, getRevisionsFor(f).size());
|
||||
}
|
||||
|
||||
public void testRenamingNonFilteredFileToFiltered() throws Exception {
|
||||
@@ -189,7 +189,7 @@ public class FileListeningTest extends IntegrationTestCase {
|
||||
rename(f, "not_filtered");
|
||||
assertEquals(before + 1, getRevisionsFor(myRoot).size());
|
||||
|
||||
assertEquals(2, getRevisionsFor(f).size());
|
||||
assertEquals(3, getRevisionsFor(f).size());
|
||||
}
|
||||
|
||||
public void testRenamingNonFilteredDirectoriesToFiltered() throws Exception {
|
||||
@@ -294,7 +294,7 @@ public class FileListeningTest extends IntegrationTestCase {
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
|
||||
List<Revision> revs = getRevisionsFor(myRoot);
|
||||
assertEquals(4, revs.size());
|
||||
assertEquals(5, revs.size());
|
||||
assertNotNull(revs.get(0).findEntry().findEntry("dir/subDir/file.txt"));
|
||||
assertNull(revs.get(1).findEntry().findEntry("dir/subDir/file.txt"));
|
||||
assertNotNull(revs.get(2).findEntry().findEntry("dir/subDir/file.txt"));
|
||||
@@ -317,7 +317,7 @@ public class FileListeningTest extends IntegrationTestCase {
|
||||
LocalFileSystem.getInstance().refresh(false);
|
||||
|
||||
List<Revision> revs = getRevisionsFor(myRoot);
|
||||
assertEquals(4, revs.size());
|
||||
assertEquals(5, revs.size());
|
||||
assertNotNull(revs.get(0).findEntry().findEntry("dir/subDir/file.txt"));
|
||||
assertNull(revs.get(1).findEntry().findEntry("dir/subDir"));
|
||||
assertNotNull(revs.get(2).findEntry().findEntry("dir/subDir/file.txt"));
|
||||
|
||||
+4
-1
@@ -37,6 +37,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -80,7 +81,9 @@ public abstract class IntegrationTestCase extends PlatformTestCase {
|
||||
}
|
||||
|
||||
protected void setUpInWriteAction() throws Exception {
|
||||
myRoot = LocalFileSystem.getInstance().findFileByIoFile(createTempDirectory());
|
||||
VirtualFile tmpTestDir =
|
||||
ObjectUtils.assertNotNull(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(FileUtil.getTempDirectory())));
|
||||
myRoot = tmpTestDir.createChildDirectory(null, "idea_test_integration");
|
||||
PsiTestUtil.addContentRoot(myModule, myRoot);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@ public class PurgingTest extends IntegrationTestCase {
|
||||
getVcs().getChangeListInTests().setIntervalBetweenActivities(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUpInWriteAction() throws Exception {
|
||||
Clock.setTime(0);
|
||||
super.setUpInWriteAction();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPurgeWithoutGapsBetweenChanges() {
|
||||
createChangesWithTimestamps(1, 2, 3);
|
||||
@@ -51,7 +57,7 @@ public class PurgingTest extends IntegrationTestCase {
|
||||
public void testPurgeNothing() {
|
||||
createChangesWithTimestamps(1, 2, 3);
|
||||
getVcs().getChangeListInTests().purgeObsolete(10);
|
||||
assertRemainedChangesTimestamps(3, 2, 1);
|
||||
assertRemainedChangesTimestamps(3, 2, 1, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-2
@@ -363,13 +363,13 @@ public class RevisionsAndDiffsTest extends IntegrationTestCase {
|
||||
createFile("bar.txt");
|
||||
LocalHistory.getInstance().putSystemLabel(myProject, "2", -1);
|
||||
|
||||
assertEquals(5, getRevisionsFor(myRoot).size());
|
||||
assertEquals(6, getRevisionsFor(myRoot).size());
|
||||
assertEquals(3, getRevisionsFor(myRoot, "*.txt").size());
|
||||
}
|
||||
|
||||
public void testFilteredRevisionsIfNothingFound() throws Exception {
|
||||
createFile("foo.txt");
|
||||
assertEquals(2, getRevisionsFor(myRoot).size());
|
||||
assertEquals(3, getRevisionsFor(myRoot).size());
|
||||
assertEquals(1, getRevisionsFor(myRoot, "xxx").size());
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class VisitingTest extends IntegrationTestCase {
|
||||
public void testSimpleVisit() throws Exception {
|
||||
createFile("f.txt");
|
||||
createFile("dir");
|
||||
assertVisitorLog("begin create end begin create end finished ");
|
||||
assertVisitorLog("begin create end begin create end begin create end finished ");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -40,7 +40,7 @@ public class VisitingTest extends IntegrationTestCase {
|
||||
createFile("dir");
|
||||
getVcs().endChangeSet(null);
|
||||
|
||||
assertVisitorLog("begin create create end finished ");
|
||||
assertVisitorLog("begin create create end begin create end finished ");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -49,7 +49,7 @@ public class VisitingTest extends IntegrationTestCase {
|
||||
createFile("f.txt");
|
||||
createFile("dir");
|
||||
|
||||
assertVisitorLog("begin create create end finished ");
|
||||
assertVisitorLog("begin create create end begin create end finished ");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -61,7 +61,7 @@ public class VisitingTest extends IntegrationTestCase {
|
||||
getVcs().beginChangeSet();
|
||||
rename(dir, "newDir");
|
||||
|
||||
assertVisitorLog("begin rename end begin create end begin create end finished ");
|
||||
assertVisitorLog("begin rename end begin create end begin create end begin create end finished ");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -104,8 +104,8 @@ public class VisitingTest extends IntegrationTestCase {
|
||||
}
|
||||
};
|
||||
|
||||
assertVisitorLog("begin create create end finished ", visitor);
|
||||
assertEquals(2, count[0]);
|
||||
assertVisitorLog("begin create create end begin create end finished ", visitor);
|
||||
assertEquals(3, count[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -122,7 +122,7 @@ public class VisitingTest extends IntegrationTestCase {
|
||||
|
||||
TestVisitor visitor = new TestVisitor();
|
||||
getVcs().accept(visitor);
|
||||
assertEquals("begin create end begin create end finished ", visitor.log);
|
||||
assertEquals("begin create end begin create end begin create end finished ", visitor.log);
|
||||
|
||||
visitor = new TestVisitor() {
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -29,8 +29,7 @@ public class DirectoryHistoryDialogPatchCreationTest extends PatchingTestCase {
|
||||
createChildDataWithContent(myRoot, "f1.txt");
|
||||
createChildDataWithContent(myRoot, "f2.txt");
|
||||
createChildDataWithContent(myRoot, "f3.txt");
|
||||
|
||||
assertSize(6, m.getRevisions());
|
||||
assertSize(7, m.getRevisions());
|
||||
|
||||
m.selectRevisions(0, 5);
|
||||
m.createPatch(patchFilePath, myProject.getBasePath(), false, Charset.defaultCharset());
|
||||
|
||||
Reference in New Issue
Block a user