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@1c79e874e5
This commit is contained in:
Jay Modi 2016-10-24 09:18:59 -04:00 committed by GitHub
parent f8ba7f6fd8
commit f3d5d79a20
4 changed files with 9 additions and 6 deletions

View File

@ -10,7 +10,12 @@ import org.apache.lucene.util.TestUtil;
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider; import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.common.io.FileSystemUtils;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.env.NodeEnvironment; 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.ESIntegTestCase;
import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.test.SecurityIntegTestCase;
import org.elasticsearch.test.VersionUtils; 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.copyIndex;
import static org.elasticsearch.test.OldIndexUtils.loadDataFilesList; 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. * 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; okToStartNode = false;
Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, importingNodeName).nodeDataPaths(); Path[] nodePaths = internalCluster().getInstance(NodeEnvironment.class, importingNodeName).nodeDataPaths();
assertEquals(1, nodePaths.length); assertEquals(1, nodePaths.length);
PutLicenseResponse putLicenseResponse = client().execute(PutLicenseAction.INSTANCE,
new PutLicenseRequest().license(TestUtils.generateSignedLicense("platinum", TimeValue.timeValueHours(24L)))).get();
assertAcked(putLicenseResponse);
} }
} }

View File

@ -5,7 +5,6 @@
*/ */
package org.elasticsearch; package org.elasticsearch;
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesArray;
@ -65,7 +64,6 @@ import static org.hamcrest.Matchers.equalTo;
* <li>This document in {@code index3}: {@code {"title": "bwc_test_user should not see this index"}}</li> * <li>This document in {@code index3}: {@code {"title": "bwc_test_user should not see this index"}}</li>
* </ul> * </ul>
**/ **/
@AwaitsFix(bugUrl="https://github.com/elastic/x-plugins/issues/3858")
public class OldSecurityIndexBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase { public class OldSecurityIndexBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase {
@Override @Override
protected boolean shouldTestVersion(Version version) { protected boolean shouldTestVersion(Version version) {

View File

@ -5,7 +5,6 @@
*/ */
package org.elasticsearch.xpack.monitoring; package org.elasticsearch.xpack.monitoring;
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
import org.elasticsearch.AbstractOldXPackIndicesBackwardsCompatibilityTestCase; import org.elasticsearch.AbstractOldXPackIndicesBackwardsCompatibilityTestCase;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; 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. * Tests for monitoring indexes created before 5.0.
*/ */
@AwaitsFix(bugUrl="https://github.com/elastic/x-plugins/issues/3858")
public class OldMonitoringIndicesBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase { public class OldMonitoringIndicesBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase {
private final boolean httpExporter = randomBoolean(); private final boolean httpExporter = randomBoolean();

View File

@ -5,7 +5,6 @@
*/ */
package org.elasticsearch.xpack.watcher; package org.elasticsearch.xpack.watcher;
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
import org.elasticsearch.AbstractOldXPackIndicesBackwardsCompatibilityTestCase; import org.elasticsearch.AbstractOldXPackIndicesBackwardsCompatibilityTestCase;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
@ -32,7 +31,6 @@ import static org.hamcrest.Matchers.not;
/** /**
* Tests for watcher indexes created before 5.0. * Tests for watcher indexes created before 5.0.
*/ */
@AwaitsFix(bugUrl="https://github.com/elastic/x-plugins/issues/3858")
public class OldWatcherIndicesBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase { public class OldWatcherIndicesBackwardsCompatibilityIT extends AbstractOldXPackIndicesBackwardsCompatibilityTestCase {
@Override @Override
public Settings nodeSettings(int ord) { public Settings nodeSettings(int ord) {