Skip to content

USERGRID-1348 : Fix failure for CollectionDeleteTest #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions stack/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/


pipeline {
agent { label 'ubuntu' }

Expand All @@ -24,7 +25,7 @@ pipeline {
}

options {
timeout(time: 30, unit: 'MINUTES')
timeout(time: 120, unit: 'MINUTES')
}


Expand Down Expand Up @@ -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
'''
}
}
Expand All @@ -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'
Expand All @@ -93,7 +94,3 @@ pipeline {

}
}




Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@
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
Expand Down Expand Up @@ -97,43 +95,47 @@ public void clearOneCollection() throws Exception {
final Entity entity;

try {
entityMap.put( "key", i );
entityMap.put( "key", i+1 );
entity = em.create(itemType, entityMap);
}
catch ( Exception ex ) {
throw new RuntimeException( "Error creating entity", ex );
}

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);
Expand Down Expand Up @@ -238,7 +240,7 @@ private int readData(EntityManager em, String collectionName, int expectedEntiti
}
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,
Expand All @@ -250,7 +252,7 @@ private int readData(EntityManager em, String collectionName, int expectedEntiti
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());
}
}
Expand Down