From f3d5d79a20e164663e7e0c8dd0b0337fff85d182 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Mon, 24 Oct 2016 09:18:59 -0400 Subject: [PATCH] test: install a new signed license when running index BWC tests This change now installs a signed license that has been generated at runtime so the BWC tests can run without hitting licensing issues. The x-pack BWC tests pull in the full cluster state, which contains the trial license from when the indices and state was generated. After the trial license period and grace period issues arise with the tests. Closes elastic/elasticsearch#3858 Original commit: elastic/x-pack-elasticsearch@1c79e874e5033aedac14e7913fa9d194b62f56c9 --- ...actOldXPackIndicesBackwardsCompatibilityTestCase.java | 9 +++++++++ .../OldSecurityIndexBackwardsCompatibilityIT.java | 2 -- .../OldMonitoringIndicesBackwardsCompatibilityIT.java | 2 -- .../OldWatcherIndicesBackwardsCompatibilityIT.java | 2 -- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/elasticsearch/src/test/java/org/elasticsearch/AbstractOldXPackIndicesBackwardsCompatibilityTestCase.java b/elasticsearch/src/test/java/org/elasticsearch/AbstractOldXPackIndicesBackwardsCompatibilityTestCase.java index bb2770bf834..3f66b543d19 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/AbstractOldXPackIndicesBackwardsCompatibilityTestCase.java +++ b/elasticsearch/src/test/java/org/elasticsearch/AbstractOldXPackIndicesBackwardsCompatibilityTestCase.java @@ -10,7 +10,12 @@ import org.apache.lucene.util.TestUtil; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.env.NodeEnvironment; +import org.elasticsearch.license.PutLicenseAction; +import org.elasticsearch.license.PutLicenseRequest; +import org.elasticsearch.license.PutLicenseResponse; +import org.elasticsearch.license.TestUtils; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.test.VersionUtils; @@ -29,6 +34,7 @@ import java.util.stream.Stream; import static org.elasticsearch.test.OldIndexUtils.copyIndex; import static org.elasticsearch.test.OldIndexUtils.loadDataFilesList; +import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; /** * Base class for tests against clusters coming from old versions of xpack and Elasticsearch. @@ -182,5 +188,8 @@ public abstract class AbstractOldXPackIndicesBackwardsCompatibilityTestCase exte okToStartNode = false; Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, importingNodeName).nodeDataPaths(); assertEquals(1, nodePaths.length); + PutLicenseResponse putLicenseResponse = client().execute(PutLicenseAction.INSTANCE, + new PutLicenseRequest().license(TestUtils.generateSignedLicense("platinum", TimeValue.timeValueHours(24L)))).get(); + assertAcked(putLicenseResponse); } } diff --git a/elasticsearch/src/test/java/org/elasticsearch/OldSecurityIndexBackwardsCompatibilityIT.java b/elasticsearch/src/test/java/org/elasticsearch/OldSecurityIndexBackwardsCompatibilityIT.java index a46fe66faf8..f8a6975113f 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/OldSecurityIndexBackwardsCompatibilityIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/OldSecurityIndexBackwardsCompatibilityIT.java @@ -5,7 +5,6 @@ */ package org.elasticsearch; -import org.apache.lucene.util.LuceneTestCase.AwaitsFix; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.bytes.BytesArray; @@ -65,7 +64,6 @@ import static org.hamcrest.Matchers.equalTo; *
  • This document in {@code index3}: {@code {"title": "bwc_test_user should not see this index"}}
  • * **/ -@AwaitsFix(bugUrl="https://github.com/elastic/x-plugins/issues/3858") public class OldSecurityIndexBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase { @Override protected boolean shouldTestVersion(Version version) { diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java index 21f94a6c57d..ccf05cba63c 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/OldMonitoringIndicesBackwardsCompatibilityIT.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.xpack.monitoring; -import org.apache.lucene.util.LuceneTestCase.AwaitsFix; import org.elasticsearch.AbstractOldXPackIndicesBackwardsCompatibilityTestCase; import org.elasticsearch.Version; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; @@ -43,7 +42,6 @@ import static org.hamcrest.Matchers.hasKey; /** * Tests for monitoring indexes created before 5.0. */ -@AwaitsFix(bugUrl="https://github.com/elastic/x-plugins/issues/3858") public class OldMonitoringIndicesBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase { private final boolean httpExporter = randomBoolean(); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/OldWatcherIndicesBackwardsCompatibilityIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/OldWatcherIndicesBackwardsCompatibilityIT.java index 9ea9f37b5f4..27c17c94860 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/OldWatcherIndicesBackwardsCompatibilityIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/OldWatcherIndicesBackwardsCompatibilityIT.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.xpack.watcher; -import org.apache.lucene.util.LuceneTestCase.AwaitsFix; import org.elasticsearch.AbstractOldXPackIndicesBackwardsCompatibilityTestCase; import org.elasticsearch.Version; import org.elasticsearch.action.search.SearchResponse; @@ -32,7 +31,6 @@ import static org.hamcrest.Matchers.not; /** * Tests for watcher indexes created before 5.0. */ -@AwaitsFix(bugUrl="https://github.com/elastic/x-plugins/issues/3858") public class OldWatcherIndicesBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase { @Override public Settings nodeSettings(int ord) {