mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 23:35:48 +02:00
Fix flaky test testPersistentProperties
Don't sleep for a hardcoded time but wait for the actual condition. 1000 ms was often insufficient on my system.
This commit is contained in:
parent
ccdd9b2c99
commit
5f3cd7ac20
1 changed files with 7 additions and 1 deletions
|
@ -202,7 +202,6 @@ public class CProjectDescriptionSerializationTests extends TestCase {
|
||||||
coreModel.setProjectDescription(project, des);
|
coreModel.setProjectDescription(project, des);
|
||||||
Assert.assertEquals(project, des.getProject());
|
Assert.assertEquals(project, des.getProject());
|
||||||
|
|
||||||
Thread.sleep(1000); // let scanner discovery participate
|
|
||||||
try {
|
try {
|
||||||
QualifiedName pdomName = new QualifiedName(CCorePlugin.PLUGIN_ID, "pdomName");
|
QualifiedName pdomName = new QualifiedName(CCorePlugin.PLUGIN_ID, "pdomName");
|
||||||
QualifiedName activeCfg = new QualifiedName(CCorePlugin.PLUGIN_ID, "activeConfiguration");
|
QualifiedName activeCfg = new QualifiedName(CCorePlugin.PLUGIN_ID, "activeConfiguration");
|
||||||
|
@ -210,6 +209,13 @@ public class CProjectDescriptionSerializationTests extends TestCase {
|
||||||
QualifiedName discoveredScannerConfigFileName = new QualifiedName(MakeCorePlugin.PLUGIN_ID,
|
QualifiedName discoveredScannerConfigFileName = new QualifiedName(MakeCorePlugin.PLUGIN_ID,
|
||||||
"discoveredScannerConfigFileName");
|
"discoveredScannerConfigFileName");
|
||||||
|
|
||||||
|
// pdomName is set by indexer setup, which may still be postponed or not even
|
||||||
|
// scheduled yet, so we can't join the job. Just wait for the property to appear.
|
||||||
|
// (The other properties were set synchronously in setProjectDescription().)
|
||||||
|
for (int i = 0; i < 100 && !project.getPersistentProperties().containsKey(pdomName); i++) {
|
||||||
|
Thread.sleep(100);
|
||||||
|
}
|
||||||
|
|
||||||
assertTrue("pdomName", project.getPersistentProperties().containsKey(pdomName));
|
assertTrue("pdomName", project.getPersistentProperties().containsKey(pdomName));
|
||||||
assertTrue("activeCfg", project.getPersistentProperties().containsKey(activeCfg));
|
assertTrue("activeCfg", project.getPersistentProperties().containsKey(activeCfg));
|
||||||
assertTrue("discoveredScannerConfigFileName",
|
assertTrue("discoveredScannerConfigFileName",
|
||||||
|
|
Loading…
Add table
Reference in a new issue