[TEST] Add now required mapping for data index in datafeed test

Original commit: elastic/x-pack-elasticsearch@67cf68c5a0
This commit is contained in:
Dimitrios Athanasiou 2017-06-12 15:49:18 +01:00
parent 1d3921f581
commit 1d33fb8b8b
1 changed files with 7 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.license.License.OperationMode; import org.elasticsearch.license.License.OperationMode;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.test.junit.annotations.TestLogging;
@ -184,7 +185,8 @@ public class MachineLearningLicensingTests extends BaseMlIntegTestCase {
String datafeedId = jobId + "-datafeed"; String datafeedId = jobId + "-datafeed";
assertMLAllowed(true); assertMLAllowed(true);
String datafeedIndex = jobId + "-data"; String datafeedIndex = jobId + "-data";
createIndex(datafeedIndex); prepareCreate(datafeedIndex).addMapping("type", "{\"type\":{\"properties\":{\"time\":{\"type\":\"date\"}}}}", XContentType.JSON)
.get();
try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) { try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) {
client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress());
// put job // put job
@ -284,7 +286,8 @@ public class MachineLearningLicensingTests extends BaseMlIntegTestCase {
String datafeedId = jobId + "-datafeed"; String datafeedId = jobId + "-datafeed";
assertMLAllowed(true); assertMLAllowed(true);
String datafeedIndex = jobId + "-data"; String datafeedIndex = jobId + "-data";
createIndex(datafeedIndex); prepareCreate(datafeedIndex).addMapping("type", "{\"type\":{\"properties\":{\"time\":{\"type\":\"date\"}}}}", XContentType.JSON)
.get();
// test that license restricted apis do now work // test that license restricted apis do now work
try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) { try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) {
client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress());
@ -356,7 +359,8 @@ public class MachineLearningLicensingTests extends BaseMlIntegTestCase {
String datafeedId = jobId + "-datafeed"; String datafeedId = jobId + "-datafeed";
assertMLAllowed(true); assertMLAllowed(true);
String datafeedIndex = jobId + "-data"; String datafeedIndex = jobId + "-data";
createIndex(datafeedIndex); prepareCreate(datafeedIndex).addMapping("type", "{\"type\":{\"properties\":{\"time\":{\"type\":\"date\"}}}}", XContentType.JSON)
.get();
// test that license restricted apis do now work // test that license restricted apis do now work
try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) { try (TransportClient client = new TestXPackTransportClient(internalCluster().transportClient().settings())) {
client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress());