You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2020/04/11 16:07:11 UTC
[directory-studio] branch master updated: Re-enable tests on
windows server. Improve some flaky tests.
This is an automated email from the ASF dual-hosted git repository.
seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-studio.git
The following commit(s) were added to refs/heads/master by this push:
new 0dbb678 Re-enable tests on windows server. Improve some flaky tests.
0dbb678 is described below
commit 0dbb678a273e9146084cccffa4253db3aa20987d
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sat Apr 11 17:06:23 2020 +0200
Re-enable tests on windows server. Improve some flaky tests.
---
.../studio/test/integration/ui/BrowserTest.java | 2 +-
.../test/integration/ui/ImportExportTest.java | 36 +++++++++++++++++-----
.../studio/test/integration/ui/LdifEditorTest.java | 2 +-
.../test/integration/ui/SchemaEditorTest.java | 2 +-
.../studio/test/integration/ui/SearchTest.java | 1 -
.../test/integration/ui/SwtResourcesTest.java | 6 ++--
6 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
index 4209215..44234b0 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
@@ -608,7 +608,7 @@ public class BrowserTest extends AbstractLdapTestUnit
/*
* This test fails on Jenkins Windows Server, to be investigated...
*/
- Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
+ // Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
index 6fcad73..a395207 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
@@ -30,6 +30,7 @@ import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.List;
+import java.util.function.Supplier;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.name.Dn;
@@ -275,10 +276,9 @@ public class ImportExportTest extends AbstractLdapTestUnit
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- BotUtils.sleep( 5000L ); // TODO: wait until all entries are deleted and UI is updated
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ));
// import LDIFs
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
@@ -364,10 +364,9 @@ public class ImportExportTest extends AbstractLdapTestUnit
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- BotUtils.sleep( 5000L ); // TODO: wait until all entries are deleted and UI is updated
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ));
// import DSML
ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
@@ -385,6 +384,27 @@ public class ImportExportTest extends AbstractLdapTestUnit
}
+ private void waitAndAssert( boolean expectedResult, Supplier<Boolean> fn )
+ {
+ for ( int i = 0; i < 30; i++ )
+ {
+ if ( fn.get() == expectedResult )
+ {
+ break;
+ }
+ BotUtils.sleep( 1000L );
+ }
+ if ( expectedResult == true )
+ {
+ assertTrue( fn.get() );
+ }
+ else
+ {
+ assertFalse( fn.get() );
+ }
+ }
+
+
@Test
public void testExportWithPagedResultControl() throws Exception
{
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
index 284158f..d591c0d 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
@@ -76,7 +76,7 @@ public class LdifEditorTest extends AbstractLdapTestUnit
/*
* This test fails on Jenkins Windows Server, to be investigated...
*/
- Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
+ // Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
NewWizardBot newWizard = studioBot.openNewWizard();
newWizard.selectLdifFile();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
index 38d363e..c83e14a 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
@@ -99,7 +99,7 @@ public class SchemaEditorTest extends AbstractLdapTestUnit
/*
* This test fails on Jenkins Windows Server, to be investigated...
*/
- Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
+ // Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
createProject( "Project Search For Aliases" );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
index 2c525f2..ec23c64 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
@@ -38,7 +38,6 @@ import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.SearchDialogBot;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
index 404235a..75167ed 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
@@ -98,7 +98,7 @@ public class SwtResourcesTest extends AbstractLdapTestUnit
int beforeObjectCount = getSwtObjectCount();
// now lets run the new entry wizard it several times
- for ( int i = 1; i < 25; i++ )
+ for ( int i = 1; i <= 8; i++ )
{
createAndDeleteEntry( "testSwtResourcesDelta" + i );
}
@@ -106,9 +106,9 @@ public class SwtResourcesTest extends AbstractLdapTestUnit
// get the SWT objects after the run
int afterObjectCount = getSwtObjectCount();
- // we expect not more than 10 additional SWT objects
+ // we expect none or only very few additional SWT objects
assertTrue( "Too many SWT resources were allocated in testSwtResourcesDelta: before=" + beforeObjectCount
- + ", after=" + afterObjectCount, afterObjectCount - beforeObjectCount < 10 );
+ + ", after=" + afterObjectCount, afterObjectCount - beforeObjectCount < 5 );
}