diff --git a/src/test/java/org/elasticsearch/license/AbstractLicensingTestBase.java b/src/test/java/org/elasticsearch/license/AbstractLicensingTestBase.java index 5ba6e75e61e..e86ca1a2a44 100644 --- a/src/test/java/org/elasticsearch/license/AbstractLicensingTestBase.java +++ b/src/test/java/org/elasticsearch/license/AbstractLicensingTestBase.java @@ -25,8 +25,8 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.TimeUnit; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt; import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween; -import static com.carrotsearch.randomizedtesting.RandomizedTest.randomRealisticUnicodeOfCodepointLengthBetween; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.ElasticsearchTestCase.randomFrom; import static org.hamcrest.MatcherAssert.assertThat; @@ -74,10 +74,10 @@ public class AbstractLicensingTestBase { long now = System.currentTimeMillis(); String issueDate = dateMathString("now", now); String expiryDate = dateMathString("now+10d/d", now); - String uid = randomRealisticUnicodeOfCodepointLengthBetween(2, 10); - String feature = randomRealisticUnicodeOfCodepointLengthBetween(5, 15); - String issuer = randomRealisticUnicodeOfCodepointLengthBetween(5, 15); - String issuedTo = randomRealisticUnicodeOfCodepointLengthBetween(5, 15); + String uid = UUID.randomUUID().toString(); + String feature = "feature__" + randomInt(); + String issuer = "issuer__" + randomInt(); + String issuedTo = "issuedTo__" + randomInt(); String type = randomFrom("subscription", "internal", "development"); String subscriptionType = randomFrom("none", "gold", "silver", "platinum"); int maxNodes = randomIntBetween(5, 100); diff --git a/src/test/java/org/elasticsearch/license/licensor/LicenseVerificationToolTests.java b/src/test/java/org/elasticsearch/license/licensor/LicenseVerificationToolTests.java index f020982b539..8e6915445cf 100644 --- a/src/test/java/org/elasticsearch/license/licensor/LicenseVerificationToolTests.java +++ b/src/test/java/org/elasticsearch/license/licensor/LicenseVerificationToolTests.java @@ -52,7 +52,7 @@ public class LicenseVerificationToolTests extends CliToolTestCase { @Test public void testParsingSimple() throws Exception { - ESLicense inputLicense = generateSignedLicense(randomRealisticUnicodeOfCodepointLengthBetween(5, 15), + ESLicense inputLicense = generateSignedLicense("feature__1", TimeValue.timeValueHours(1)); LicenseVerificationTool licenseVerificationTool = new LicenseVerificationTool(); Command command = licenseVerificationTool.parse(LicenseVerificationTool.NAME, @@ -66,7 +66,7 @@ public class LicenseVerificationToolTests extends CliToolTestCase { @Test public void testParsingLicenseFile() throws Exception { - ESLicense inputLicense = generateSignedLicense(randomRealisticUnicodeOfCodepointLengthBetween(5, 15), + ESLicense inputLicense = generateSignedLicense("feature__1", TimeValue.timeValueHours(1)); LicenseVerificationTool licenseVerificationTool = new LicenseVerificationTool(); @@ -85,7 +85,7 @@ public class LicenseVerificationToolTests extends CliToolTestCase { int n = randomIntBetween(2, 5); Map inputLicenses = new HashMap<>(); for (int i = 0; i < n; i++) { - ESLicense esLicense = generateSignedLicense(randomRealisticUnicodeOfCodepointLengthBetween(5, 15), + ESLicense esLicense = generateSignedLicense("feature__" + i, TimeValue.timeValueHours(1)); inputLicenses.put(esLicense.feature(), esLicense); } @@ -114,7 +114,7 @@ public class LicenseVerificationToolTests extends CliToolTestCase { int n = randomIntBetween(2, 5); Map inputLicenses = new HashMap<>(); for (int i = 0; i < n; i++) { - ESLicense esLicense = generateSignedLicense(randomRealisticUnicodeOfCodepointLengthBetween(5, 15), + ESLicense esLicense = generateSignedLicense("feature__" + i, TimeValue.timeValueHours(1)); inputLicenses.put(esLicense.feature(), esLicense); } @@ -132,7 +132,7 @@ public class LicenseVerificationToolTests extends CliToolTestCase { @Test public void testToolInvalidLicense() throws Exception { - ESLicense signedLicense = generateSignedLicense(randomRealisticUnicodeOfCodepointLengthBetween(5, 15) + ESLicense signedLicense = generateSignedLicense("feature__1" , TimeValue.timeValueHours(1)); ESLicense tamperedLicense = ESLicense.builder()