usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject [usergrid] branch master updated: Fix failure for CollectionDeleteTest
Date Fri, 31 May 2019 06:30:35 GMT
This is an automated email from the ASF dual-hosted git repository.

keyur pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/usergrid.git


The following commit(s) were added to refs/heads/master by this push:
     new 630193c  Fix failure for CollectionDeleteTest
     new 79e37c9  Merge pull request #626 from keyurkarnik/master
630193c is described below

commit 630193c243c9a319dba9c272c5f497e91804ba2a
Author: Keyur Karnik <keyur.karnik+github@gmail.com>
AuthorDate: Thu May 30 00:28:01 2019 -0700

    Fix failure for CollectionDeleteTest
    
    The test for CollectionDelete is failing on machines with more
    processing power because the timestamp for the last to-be-deleted entry
    and the next one ends up being the same. Added a sleep and also setup
    non-boundary test scenarios and more logging.
    Updated the Jenkins build to increase timeouts
---
 stack/Jenkinsfile                                  | 11 +++----
 .../usergrid/persistence/CollectionDeleteTest.java | 38 ++++++++++++----------
 2 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/stack/Jenkinsfile b/stack/Jenkinsfile
index b82064d..023596e 100644
--- a/stack/Jenkinsfile
+++ b/stack/Jenkinsfile
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+
 pipeline {
     agent { label 'ubuntu' }
 
@@ -24,7 +25,7 @@ pipeline {
     }
 
     options {
-          timeout(time: 30, unit: 'MINUTES')
+          timeout(time: 120, unit: 'MINUTES')
       }
 
 
@@ -70,7 +71,7 @@ pipeline {
             steps {
                 git 'https://github.com/apache/usergrid.git'
                 sh '''
-                    mvn clean install -DskipTests=true -f stack/pom.xml
+                    mvn clean install -f stack/pom.xml
                 '''
             }
         }
@@ -82,7 +83,7 @@ pipeline {
             junit 'stack/**/surefire-reports/*.xml'
             sh 'ps -ef | grep cassandra'
             sh 'ps -ef | grep elastic'
-            deleteDir() /* clean up our workspace */
+            deleteDir()  /*clean up our workspace */
         }
         success {
             echo 'Usergrid build and tests succeeded'
@@ -93,7 +94,3 @@ pipeline {
 
     }
 }
-
-
-
-
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionDeleteTest.java
b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionDeleteTest.java
index c22a627..3edff3d 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionDeleteTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionDeleteTest.java
@@ -38,18 +38,16 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.codahale.metrics.MetricRegistry;
 
 
 
 public class CollectionDeleteTest extends AbstractCoreIT {
     private static final Logger logger = LoggerFactory.getLogger( CollectionDeleteTest.class
);
 
-    private static final MetricRegistry registry = new MetricRegistry();
 
 
-    private static final int ENTITIES_TO_DELETE = 1000;
-    private static final int ENTITIES_TO_ADD_AFTER_TIME = 3;
+    private static final int ENTITIES_TO_DELETE = 1100;
+    private static final int ENTITIES_TO_ADD_AFTER_TIME = 5;
 
 
     @Before
@@ -97,7 +95,7 @@ public class CollectionDeleteTest extends AbstractCoreIT {
             final Entity entity;
 
             try {
-                entityMap.put( "key", i );
+                entityMap.put( "key", i+1 );
                 entity = em.create(itemType, entityMap);
             }
             catch ( Exception ex ) {
@@ -105,35 +103,39 @@ public class CollectionDeleteTest extends AbstractCoreIT {
             }
 
             entityRefs.add( new SimpleEntityRef( entity.getType(), entity.getUuid() ) );
-            if ( i % 10 == 0 ) {
-                logger.info( "Created {} entities", i );
+            if ( (i+1) % 10 == 0 ) {
+                logger.info( "Created {} entities", i+1 );
             }
         }
 
-        logger.info("Created {} entities", ENTITIES_TO_DELETE);
 
         app.waitForQueueDrainAndRefreshIndex(10000);
 
         long timeFirstPutDone = System.currentTimeMillis();
-        logger.info("timeFirstPutDone={}", timeFirstPutDone);
+        logger.info("Finished adding first lot of entities at {}", timeFirstPutDone);
+
+        try {
+            //Wait to make sure that the time on the next entry changes
+            Thread.sleep(2000);
+        }
+        catch (Exception e) {
+        }
 
         for (int i = 0; i < ENTITIES_TO_ADD_AFTER_TIME; i++) {
 
             final Entity entity;
 
             try {
-                entityMap.put( "key", ENTITIES_TO_DELETE + i );
+                entityMap.put("key", ENTITIES_TO_DELETE + i+1);
                 entity = em.create(itemType, entityMap);
-            }
-            catch ( Exception ex ) {
-                throw new RuntimeException( "Error creating entity", ex );
+            } catch (Exception ex) {
+                throw new RuntimeException("Error creating entity", ex);
             }
 
-            entityRefs.add( new SimpleEntityRef( entity.getType(), entity.getUuid() ) );
-            logger.info( "Created {} entities after delete time created time {} ", i , entity.getCreated());
+            entityRefs.add(new SimpleEntityRef(entity.getType(), entity.getUuid()));
+            logger.info("Created {} entities after delete time with key {} and uuid {} at
{} ", i + 1, entity.getProperty("key"), entity.getUuid(), entity.getCreated());
 
         }
-        logger.info("Created {} entities after delete time", ENTITIES_TO_ADD_AFTER_TIME);
 
 
         app.waitForQueueDrainAndRefreshIndex(15000);
@@ -238,7 +240,7 @@ public class CollectionDeleteTest extends AbstractCoreIT {
                 }
                 lastEntityUUID = e.getUuid();
                 uniqueRemEnts.add(e);
-                logger.info("Found remaining entity {}", lastEntityUUID);
+                logger.info("Found remaining entity {} with key {}", lastEntityUUID, e.getProperty("key"));
             }
 
             results = em.getCollection(em.getApplicationRef(), collectionName, lastEntityUUID,
expectedEntities,
@@ -250,7 +252,7 @@ public class CollectionDeleteTest extends AbstractCoreIT {
             logger.info("Expected {} did not match actual {}", expectedEntities, uniqueRemEnts.size());
             if (uniqueRemEnts.size() < 20) {
                 for (Entity e : uniqueRemEnts) {
-                    Object key = e.getProperty("key2");
+                    Object key = e.getProperty("key");
                     logger.info("Entity key {} uuid {} created {}", key,e.getUuid(), e.getCreated());
                 }
             }


Mime
View raw message