Skip to content

Commit

Permalink
Address UUIDTests#testCompression failures. (elastic#50093)
Browse files Browse the repository at this point in the history
Those were due to codec randomization.

Closes elastic#50048
  • Loading branch information
jpountz authored Dec 11, 2019
1 parent e4b9044 commit a3482e8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/src/test/java/org/elasticsearch/common/UUIDTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.SerialMergeScheduler;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.TestUtil;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.test.ESTestCase;
Expand Down Expand Up @@ -116,7 +119,6 @@ public void testUUIDThreaded(UUIDGenerator uuidSource) {
assertEquals(count*uuids, globalSet.size());
}

@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/50048")
public void testCompression() throws Exception {
Logger logger = LogManager.getLogger(UUIDTests.class);
// Low number so that the test runs quickly, but the results are more interesting with larger numbers
Expand All @@ -135,7 +137,7 @@ private static double testCompression(int numDocs, int numDocsPerSecond, int num
random().nextBytes(macAddresses[i]);
}
UUIDGenerator generator = new TimeBasedUUIDGenerator() {
double currentTimeMillis = System.currentTimeMillis();
double currentTimeMillis = TestUtil.nextLong(random(), 0L, 10000000000L);

@Override
protected long currentTimeMillis() {
Expand All @@ -152,6 +154,7 @@ protected byte[] macAddress() {
// the quality of this test
Directory dir = newFSDirectory(createTempDir());
IndexWriterConfig config = new IndexWriterConfig()
.setCodec(Codec.forName(Lucene.LATEST_CODEC))
.setMergeScheduler(new SerialMergeScheduler()); // for reproducibility
IndexWriter w = new IndexWriter(dir, config);
Document doc = new Document();
Expand Down

0 comments on commit a3482e8

Please sign in to comment.