Watcher: Enable with STANDARD license (elastic/elasticsearch#4838)

In order to have monitoring use alerts on cloud, we need to
enable watcher when the STANDARD license is in place. For
more information, please refer to the referenced issue.

Closes elastic/elasticsearch#4766

Original commit: elastic/x-pack-elasticsearch@9d5547274c
This commit is contained in:
Alexander Reelsen 2017-02-08 17:38:00 +01:00 committed by GitHub
parent 0e779b41de
commit 1ba5f8fb30
2 changed files with 18 additions and 8 deletions

View File

@ -285,6 +285,7 @@ public class XPackLicenseState {
* <p>
* Watcher is available if the license is active (hasn't expired) and of one of the following types:
* <ul>
* <li>{@link OperationMode#STANDARD}</li>
* <li>{@link OperationMode#PLATINUM}</li>
* <li>{@link OperationMode#GOLD}</li>
* <li>{@link OperationMode#TRIAL}</li>
@ -304,6 +305,7 @@ public class XPackLicenseState {
case TRIAL:
case GOLD:
case PLATINUM:
case STANDARD:
return true;
default:
return false;

View File

@ -208,26 +208,34 @@ public class XPackLicenseStateTests extends ESTestCase {
}
public void testMonitoringUpdateRetention() {
OperationMode mode = randomFrom(STANDARD, GOLD, PLATINUM, TRIAL);
assertAllowed(mode, true, XPackLicenseState::isUpdateRetentionAllowed, true);
assertAllowed(STANDARD, true, XPackLicenseState::isUpdateRetentionAllowed, true);
assertAllowed(GOLD, true, XPackLicenseState::isUpdateRetentionAllowed, true);
assertAllowed(PLATINUM, true, XPackLicenseState::isUpdateRetentionAllowed, true);
assertAllowed(TRIAL, true, XPackLicenseState::isUpdateRetentionAllowed, true);
assertAllowed(BASIC, true, XPackLicenseState::isUpdateRetentionAllowed, false);
assertAllowed(MISSING, false, XPackLicenseState::isUpdateRetentionAllowed, false);
}
public void testWatcherPlatinumGoldTrial() throws Exception {
assertAllowed(randomFrom(TRIAL, GOLD, PLATINUM), true, XPackLicenseState::isWatcherAllowed, true);
public void testWatcherPlatinumGoldTrialStandard() throws Exception {
assertAllowed(TRIAL, true, XPackLicenseState::isWatcherAllowed, true);
assertAllowed(GOLD, true, XPackLicenseState::isWatcherAllowed, true);
assertAllowed(PLATINUM, true, XPackLicenseState::isWatcherAllowed, true);
assertAllowed(STANDARD, true, XPackLicenseState::isWatcherAllowed, true);
}
public void testWatcherBasicStandardLicense() throws Exception {
assertAllowed(randomFrom(BASIC, STANDARD), true, XPackLicenseState::isWatcherAllowed, false);
public void testWatcherBasicLicense() throws Exception {
assertAllowed(BASIC, true, XPackLicenseState::isWatcherAllowed, false);
}
public void testWatcherInactive() {
assertAllowed(randomFrom(BASIC, STANDARD), false, XPackLicenseState::isWatcherAllowed, false);
assertAllowed(BASIC, false, XPackLicenseState::isWatcherAllowed, false);
}
public void testWatcherInactivePlatinumGoldTrial() throws Exception {
assertAllowed(randomFrom(TRIAL, GOLD, PLATINUM), false, XPackLicenseState::isWatcherAllowed, false);
assertAllowed(TRIAL, false, XPackLicenseState::isWatcherAllowed, false);
assertAllowed(GOLD, false, XPackLicenseState::isWatcherAllowed, false);
assertAllowed(PLATINUM, false, XPackLicenseState::isWatcherAllowed, false);
assertAllowed(STANDARD, false, XPackLicenseState::isWatcherAllowed, false);
}
public void testGraphPlatinumTrial() throws Exception {