Fix expiration millis for start_basic (elastic/x-pack-elasticsearch#4124)
This is related to elastic/x-pack-elasticsearch#3877. There was a bug in the PR that introduced start_basic route. The start basic had an expiration millis that rolled over into negative numbers. This fixes that issue. Original commit: elastic/x-pack-elasticsearch@aea9a13d2b
This commit is contained in:
parent
4109f6e5b7
commit
b121262b2d
|
@ -70,7 +70,7 @@ public class StartBasicClusterTask extends ClusterStateUpdateTask {
|
|||
.maxNodes(LicenseService.SELF_GENERATED_LICENSE_MAX_NODES)
|
||||
.issueDate(issueDate)
|
||||
.type("basic")
|
||||
.expiryDate(issueDate + LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS);
|
||||
.expiryDate(LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS);
|
||||
License selfGeneratedLicense = SelfGeneratedLicense.create(specBuilder);
|
||||
if (request.isAcknowledged() == false && currentLicense != null) {
|
||||
Map<String, String[]> ackMessages = LicenseService.getAckMessages(selfGeneratedLicense, currentLicense);
|
||||
|
|
|
@ -75,6 +75,14 @@ public class StartBasicLicenseTests extends AbstractLicensesIntegrationTestCase
|
|||
assertTrue(body2.contains("\"acknowledged\":true"));
|
||||
assertTrue(body2.contains("\"basic_was_started\":true"));
|
||||
|
||||
assertBusy(() -> {
|
||||
GetLicenseResponse currentLicense = licensingClient.prepareGetLicense().get();
|
||||
assertEquals("basic", currentLicense.license().type());
|
||||
});
|
||||
|
||||
long expirationMillis = licensingClient.prepareGetLicense().get().license().expiryDate();
|
||||
assertEquals(LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS, expirationMillis);
|
||||
|
||||
Response response3 = restClient.performRequest("GET", "/_xpack/license/basic_status");
|
||||
String body3 = Streams.copyToString(new InputStreamReader(response3.getEntity().getContent(), StandardCharsets.UTF_8));
|
||||
assertEquals(200, response3.getStatusLine().getStatusCode());
|
||||
|
|
Loading…
Reference in New Issue