SEARCH-2117: Fix integration test approach, setting explicitly a [1..2000] txnId when checkCore is required.

This commit is contained in:
Angel Borroy
2020-02-19 14:50:41 +01:00
parent f93e979ed9
commit 92edfc5999
2 changed files with 6 additions and 5 deletions
@@ -118,6 +118,9 @@ public class AlfrescoSolrUtils
/**
* Get transaction.
* When getting an unique transaction for a test, don't use this constructors.
* As this produces a number that can be out of the range [1-2000], that is
* the one checked by the SOLR Core to find the initial transaction is right.
* @param deletes
* @param updates
* @return {@link Transaction}
@@ -127,10 +130,7 @@ public class AlfrescoSolrUtils
long txnCommitTime = System.currentTimeMillis();
Transaction transaction = new Transaction();
transaction.setCommitTimeMs(txnCommitTime);
// A safer number for a transaction Id should be in [1-2000] range,
// so this is the range accepted for the starting transaction number
// on a SOLR Core
transaction.setId(RANDOMIZER.nextInt(2000) + 1);
transaction.setId(generateId());
transaction.setDeletes(deletes);
transaction.setUpdates(updates);
return transaction;
@@ -84,7 +84,8 @@ public class DistributedAlfrescoSolrTrackerRaceIT extends AbstractAlfrescoDistri
AclReaders aclReaders = getAclReaders(aclChangeSet, acl, singletonList("joel"), singletonList("phil"), null);
AclReaders aclReaders2 = getAclReaders(aclChangeSet, acl2, singletonList("jim"), singletonList("phil"), null);
Transaction txn = getTransaction(0, 2);
// Transaction between [1-2000] is required, when greater value checking the core will fail
Transaction txn = getTransaction(0, 2, 1);
long txnCommitTimeMs = txn.getCommitTimeMs();
// Subtract from the commit time to go beyond hole retention