diff --git a/plugin/core/src/main/java/org/elasticsearch/license/StartBasicClusterTask.java b/plugin/core/src/main/java/org/elasticsearch/license/StartBasicClusterTask.java index ee6b0c305bd..355482872d6 100644 --- a/plugin/core/src/main/java/org/elasticsearch/license/StartBasicClusterTask.java +++ b/plugin/core/src/main/java/org/elasticsearch/license/StartBasicClusterTask.java @@ -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 ackMessages = LicenseService.getAckMessages(selfGeneratedLicense, currentLicense); diff --git a/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java b/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java index 61f95e1c310..1f0fa178a6c 100644 --- a/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java +++ b/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java @@ -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());