[TEST] Improve ML security tests (elastic/x-pack-elasticsearch#2417)

The changes made for elastic/x-pack-elasticsearch#2369 showed that the ML security tests were seriously
weakened by the decision to grant many "minimal" privileges to all users
involved in the tests.  A better solution is to override the auth header
such that a superuser runs setup actions and assertions that work by
querying raw documents in ways that an end user wouldn't.  Then the ML
endpoints can be called with the privileges provided by the ML roles and
nothing else.

Original commit: elastic/x-pack-elasticsearch@4de42d9e54
This commit is contained in:
David Roberts 2017-09-05 10:49:41 +01:00 committed by GitHub
parent d9dce1afcd
commit 500b4ac6b9
28 changed files with 383 additions and 53 deletions

View File

@ -15,7 +15,6 @@ import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.ClusterService;
@ -133,19 +132,16 @@ public class DeleteModelSnapshotAction extends Action<DeleteModelSnapshotAction.
private final InternalClient client; private final InternalClient client;
private final JobProvider jobProvider; private final JobProvider jobProvider;
private final JobManager jobManager;
private final ClusterService clusterService; private final ClusterService clusterService;
private final Auditor auditor; private final Auditor auditor;
@Inject @Inject
public TransportAction(Settings settings, TransportService transportService, ThreadPool threadPool, public TransportAction(Settings settings, TransportService transportService, ThreadPool threadPool,
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
JobProvider jobProvider, JobManager jobManager, ClusterService clusterService, JobProvider jobProvider, ClusterService clusterService, InternalClient client, Auditor auditor) {
InternalClient client, Auditor auditor) {
super(settings, NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, Request::new); super(settings, NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, Request::new);
this.client = client; this.client = client;
this.jobProvider = jobProvider; this.jobProvider = jobProvider;
this.jobManager = jobManager;
this.clusterService = clusterService; this.clusterService = clusterService;
this.auditor = auditor; this.auditor = auditor;
} }

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: custom-all-test-1 job_id: custom-all-test-1
body: > body: >
@ -11,6 +13,8 @@ setup:
"data_description": {} "data_description": {}
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: custom-all-test-2 job_id: custom-all-test-2
body: > body: >
@ -24,6 +28,8 @@ setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-custom-all-test-1 index: .ml-anomalies-custom-all-test-1
type: doc type: doc
@ -48,6 +54,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-custom-all-test-2 index: .ml-anomalies-custom-all-test-2
type: doc type: doc
@ -62,6 +70,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: [.ml-anomalies-shared] index: [.ml-anomalies-shared]

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: datafeeds-crud-1 job_id: datafeeds-crud-1
body: > body: >
@ -17,6 +19,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: datafeeds-crud-2 job_id: datafeeds-crud-2
body: > body: >

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: force-delete-job job_id: force-delete-job
body: > body: >
@ -44,7 +46,7 @@ setup:
- match: { count: 0 } - match: { count: 0 }
--- ---
"Test can't force delete an inexistent job": "Test cannot force delete a non-existent job":
- do: - do:
catch: /resource_not_found_exception/ catch: /resource_not_found_exception/

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: delete-model-snapshot job_id: delete-model-snapshot
body: > body: >
@ -18,14 +20,20 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.open_job: xpack.ml.open_job:
job_id: delete-model-snapshot job_id: delete-model-snapshot
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.close_job: xpack.ml.close_job:
job_id: delete-model-snapshot job_id: delete-model-snapshot
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-delete-model-snapshot index: .ml-anomalies-delete-model-snapshot
type: doc type: doc
@ -42,6 +50,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -52,6 +62,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -62,6 +74,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-delete-model-snapshot index: .ml-anomalies-delete-model-snapshot
type: doc type: doc
@ -78,14 +92,20 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-state index: .ml-state
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-delete-model-snapshot index: .ml-anomalies-delete-model-snapshot
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.update_job: xpack.ml.update_job:
job_id: delete-model-snapshot job_id: delete-model-snapshot
body: > body: >
@ -115,6 +135,8 @@ setup:
- match: { count: 2 } - match: { count: 2 }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
type: doc type: doc
@ -128,10 +150,14 @@ setup:
- match: { acknowledged: true } - match: { acknowledged: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-delete-model-snapshot index: .ml-anomalies-delete-model-snapshot
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-state index: .ml-state
@ -142,6 +168,8 @@ setup:
- match: { model_snapshots.0.snapshot_id: "active-snapshot"} - match: { model_snapshots.0.snapshot_id: "active-snapshot"}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
type: doc type: doc

View File

@ -2,6 +2,8 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-meta index: .ml-meta
type: doc type: doc
@ -14,6 +16,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_filter: xpack.ml.put_filter:
filter_id: filter-foo filter_id: filter-foo
body: > body: >
@ -22,6 +26,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_filter: xpack.ml.put_filter:
filter_id: filter-foo2 filter_id: filter-foo2
body: > body: >
@ -30,6 +36,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: {} indices.refresh: {}
--- ---

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.create: indices.create:
index: index-1 index: index-1
body: body:
@ -13,6 +15,8 @@ setup:
type: date type: date
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.create: indices.create:
index: index-2 index: index-2
body: body:
@ -26,6 +30,8 @@ setup:
type: date type: date
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: get-datafeed-stats-1 job_id: get-datafeed-stats-1
body: > body: >
@ -43,6 +49,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: get-datafeed-stats-2 job_id: get-datafeed-stats-2
body: > body: >
@ -58,6 +66,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_datafeed: xpack.ml.put_datafeed:
datafeed_id: datafeed-1 datafeed_id: datafeed-1
body: > body: >
@ -68,6 +78,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_datafeed: xpack.ml.put_datafeed:
datafeed_id: datafeed-2 datafeed_id: datafeed-2
body: > body: >

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: get-datafeed-1 job_id: get-datafeed-1
body: > body: >
@ -17,6 +19,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: get-datafeed-2 job_id: get-datafeed-2
body: > body: >
@ -32,6 +36,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_datafeed: xpack.ml.put_datafeed:
datafeed_id: datafeed-1 datafeed_id: datafeed-1
body: > body: >
@ -42,6 +48,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_datafeed: xpack.ml.put_datafeed:
datafeed_id: datafeed-2 datafeed_id: datafeed-2
body: > body: >

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: get-model-snapshots job_id: get-model-snapshots
body: > body: >
@ -14,6 +16,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-get-model-snapshots index: .ml-anomalies-get-model-snapshots
type: doc type: doc
@ -27,6 +31,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-get-model-snapshots index: .ml-anomalies-get-model-snapshots
type: doc type: doc
@ -40,6 +46,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-get-model-snapshots index: .ml-anomalies-get-model-snapshots

View File

@ -85,29 +85,41 @@
- match: { closed: true } - match: { closed: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-state" index: ".ml-state"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-anomalies-index-layout-job" index: ".ml-anomalies-index-layout-job"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: {} indices.refresh: {}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
- gt: {count: 0} - gt: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- match: {count: 6} - match: {count: 6}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-index-layout-job index: .ml-anomalies-index-layout-job
body: body:
@ -120,6 +132,8 @@
- match: {count: 3} - match: {count: 3}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
body: body:
@ -132,6 +146,8 @@
- match: {count: 3} - match: {count: 3}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-index-layout-job2 index: .ml-anomalies-index-layout-job2
body: body:
@ -144,6 +160,8 @@
- match: {count: 3} - match: {count: 3}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
body: body:
@ -155,6 +173,8 @@
- match: {count: 3} - match: {count: 3}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -163,12 +183,14 @@
key: value key: value
- do: - do:
index: headers:
index: .ml-state Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
type: doc index:
id: index-layout-job2_categorizer_state#2 index: .ml-state
body: type: doc
key: value id: index-layout-job2_categorizer_state#2
body:
key: value
- do: - do:
xpack.ml.delete_job: xpack.ml.delete_job:
@ -176,16 +198,22 @@
- match: { acknowledged: true } - match: { acknowledged: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-anomalies-shared" index: ".ml-anomalies-shared"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
- match: {count: 4} - match: {count: 4}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
body: body:
@ -197,12 +225,16 @@
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- match: {count: 3} - match: {count: 3}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-index-layout-job2 index: .ml-anomalies-index-layout-job2
body: body:
@ -215,6 +247,8 @@
- match: {count: 3} - match: {count: 3}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
body: body:
@ -232,44 +266,60 @@
- match: { acknowledged: true } - match: { acknowledged: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-anomalies-shared" index: ".ml-anomalies-shared"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-anomalies-index-layout-job" index: ".ml-anomalies-index-layout-job"
- is_false: '' - is_false: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-anomalies-index-layout-job2" index: ".ml-anomalies-index-layout-job2"
- is_false: '' - is_false: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
type: doc type: doc
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
type: doc type: doc
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
type: doc type: doc
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- match: {count: 0} - match: {count: 0}
@ -309,14 +359,20 @@
{"airline":"JZA","responsetime":"990.4628","sourcetype":"farequote","time":"1403481700"} {"airline":"JZA","responsetime":"990.4628","sourcetype":"farequote","time":"1403481700"}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.create: indices.create:
index: foo index: foo
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.create: indices.create:
index: .ml-anomalies-foo index: .ml-anomalies-foo
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: foo index: foo
type: doc type: doc
@ -324,6 +380,8 @@
key: value key: value
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-foo index: .ml-anomalies-foo
type: doc type: doc
@ -331,6 +389,8 @@
key: value key: value
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-foo index: .ml-anomalies-foo
type: doc type: doc
@ -354,44 +414,62 @@
- match: { acknowledged: true } - match: { acknowledged: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-anomalies-shared" index: ".ml-anomalies-shared"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-anomalies-foo" index: ".ml-anomalies-foo"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-state" index: ".ml-state"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: "foo" index: "foo"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: {} indices.refresh: {}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: foo index: foo
- match: {count: 1} - match: {count: 1}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-foo index: .ml-anomalies-foo
- match: {count: 2} - match: {count: 2}
@ -415,6 +493,8 @@
- match: { job_id: "index-layout-quantiles-job" } - match: { job_id: "index-layout-quantiles-job" }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -423,6 +503,8 @@
state: quantile-state state: quantile-state
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: {} indices.refresh: {}
- do: - do:
@ -431,6 +513,8 @@
- match: { acknowledged: true } - match: { acknowledged: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}
@ -455,6 +539,8 @@
- match: { job_id: "index-layout-state-job" } - match: { job_id: "index-layout-state-job" }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-shared index: .ml-anomalies-shared
type: doc type: doc
@ -469,6 +555,8 @@
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -477,6 +565,8 @@
state: new-model-state state: new-model-state
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -485,6 +575,8 @@
state: more-new-model-state state: more-new-model-state
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -493,6 +585,8 @@
state: new-categorizer-state state: new-categorizer-state
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-state index: .ml-state
type: doc type: doc
@ -501,6 +595,8 @@
state: more-new-categorizer-state state: more-new-categorizer-state
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: {} indices.refresh: {}
- do: - do:
@ -509,11 +605,15 @@
- match: { acknowledged: true } - match: { acknowledged: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- match: {count: 0} - match: {count: 0}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}
@ -522,6 +622,8 @@
"Test force close does not create state": "Test force close does not create state":
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.create: indices.create:
index: .ml-state index: .ml-state
@ -560,14 +662,20 @@
- match: { closed: true } - match: { closed: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.exists: indices.exists:
index: ".ml-state" index: ".ml-state"
- is_true: '' - is_true: ''
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: {} indices.refresh: {}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
count: count:
index: .ml-state index: .ml-state
- match: {count: 0} - match: {count: 0}

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: test-job-groups-foo-1 job_id: test-job-groups-foo-1
body: > body: >
@ -12,6 +14,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: test-job-groups-foo-2 job_id: test-job-groups-foo-2
body: > body: >
@ -24,6 +28,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: test-job-groups-bar-1 job_id: test-job-groups-bar-1
body: > body: >
@ -36,6 +42,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: test-job-groups-bar-2 job_id: test-job-groups-bar-2
body: > body: >
@ -48,6 +56,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: test-job-groups-nogroup job_id: test-job-groups-nogroup
body: > body: >

View File

@ -449,6 +449,8 @@
- match: { flushed: true } - match: { flushed: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
cluster.state: cluster.state:
metric: [ metadata ] metric: [ metadata ]
filter_path: metadata.persistent_tasks filter_path: metadata.persistent_tasks
@ -460,6 +462,8 @@
- match: { closed: true } - match: { closed: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
cluster.state: cluster.state:
metric: [ metadata ] metric: [ metadata ]
filter_path: metadata.persistent_tasks filter_path: metadata.persistent_tasks
@ -665,6 +669,8 @@
- match: { flushed: true } - match: { flushed: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
cluster.state: cluster.state:
metric: [ metadata ] metric: [ metadata ]
filter_path: metadata.persistent_tasks filter_path: metadata.persistent_tasks
@ -677,6 +683,8 @@
- match: { closed: true } - match: { closed: true }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
cluster.state: cluster.state:
metric: [ metadata ] metric: [ metadata ]
filter_path: metadata.persistent_tasks filter_path: metadata.persistent_tasks

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: jobs-get-1 job_id: jobs-get-1
body: > body: >
@ -18,6 +20,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: jobs-get-2 job_id: jobs-get-2
body: > body: >

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: jobs-get-result-buckets job_id: jobs-get-result-buckets
body: > body: >
@ -14,6 +16,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-jobs-get-result-buckets index: .ml-anomalies-jobs-get-result-buckets
type: doc type: doc
@ -28,6 +32,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-jobs-get-result-buckets index: .ml-anomalies-jobs-get-result-buckets
type: doc type: doc
@ -42,6 +48,8 @@ setup:
"is_interim": true "is_interim": true
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-jobs-get-result-buckets index: .ml-anomalies-jobs-get-result-buckets
type: doc type: doc
@ -56,6 +64,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-jobs-get-result-buckets index: .ml-anomalies-jobs-get-result-buckets

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: jobs-get-result-categories job_id: jobs-get-result-categories
body: > body: >
@ -14,18 +16,24 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-jobs-get-result-categories index: .ml-anomalies-jobs-get-result-categories
type: doc type: doc
id: jobs-get-result-categories-1 id: jobs-get-result-categories-1
body: { "job_id": "jobs-get-result-categories", "category_id": 1 } body: { "job_id": "jobs-get-result-categories", "category_id": 1 }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-jobs-get-result-categories index: .ml-anomalies-jobs-get-result-categories
type: doc type: doc
id: jobs-get-result-categories-2 id: jobs-get-result-categories-2
body: { "job_id": "jobs-get-result-categories", "category_id": 2 } body: { "job_id": "jobs-get-result-categories", "category_id": 2 }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-unrelated index: .ml-anomalies-unrelated
type: doc type: doc
@ -33,6 +41,8 @@ setup:
body: { "job_id": "unrelated", "category_id": 1 } body: { "job_id": "unrelated", "category_id": 1 }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-jobs-get-result-categories index: .ml-anomalies-jobs-get-result-categories

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: get-influencers-test job_id: get-influencers-test
body: > body: >
@ -14,6 +16,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-get-influencers-test index: .ml-anomalies-get-influencers-test
type: doc type: doc
@ -30,6 +34,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-get-influencers-test index: .ml-anomalies-get-influencers-test
type: doc type: doc
@ -47,6 +53,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-get-influencers-test index: .ml-anomalies-get-influencers-test
type: doc type: doc
@ -63,6 +71,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-get-influencers-test index: .ml-anomalies-get-influencers-test

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: jobs-get-result-records job_id: jobs-get-result-records
body: > body: >
@ -14,6 +16,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-jobs-get-result-records index: .ml-anomalies-jobs-get-result-records
type: doc type: doc
@ -28,21 +32,25 @@ setup:
} }
- do: - do:
index: headers:
index: .ml-anomalies-jobs-get-result-records Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
type: doc index:
id: jobs-get-result-records_1464825600000_1_2 index: .ml-anomalies-jobs-get-result-records
body: type: doc
{ id: jobs-get-result-records_1464825600000_1_2
"job_id": "jobs-get-result-records", body:
"result_type": "record", {
"timestamp": "2016-06-02T00:00:00Z", "job_id": "jobs-get-result-records",
"record_score": 80.0, "result_type": "record",
"bucket_span": 1, "timestamp": "2016-06-02T00:00:00Z",
"is_interim": true "record_score": 80.0,
} "bucket_span": 1,
"is_interim": true
}
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-jobs-get-result-records index: .ml-anomalies-jobs-get-result-records

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: job-stats-test job_id: job-stats-test
body: > body: >
@ -18,10 +20,14 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.open_job: xpack.ml.open_job:
job_id: job-stats-test job_id: job-stats-test
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: jobs-get-stats-datafeed-job job_id: jobs-get-stats-datafeed-job
body: > body: >
@ -39,10 +45,14 @@ setup:
} }
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.open_job: xpack.ml.open_job:
job_id: jobs-get-stats-datafeed-job job_id: jobs-get-stats-datafeed-job
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_datafeed: xpack.ml.put_datafeed:
datafeed_id: datafeed-1 datafeed_id: datafeed-1
body: > body: >
@ -196,6 +206,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: {} indices.refresh: {}
# This is testing that the documents with v5.4 IDs are fetched. # This is testing that the documents with v5.4 IDs are fetched.
@ -203,6 +215,8 @@ setup:
# for another type into the single type indices. Type isn't used # for another type into the single type indices. Type isn't used
# in the query so the test is valid # in the query so the test is valid
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-shared index: .ml-anomalies-shared
type: doc type: doc
@ -225,6 +239,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-shared index: .ml-anomalies-shared
type: doc type: doc
@ -243,6 +259,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: [.ml-anomalies-shared] index: [.ml-anomalies-shared]

View File

@ -17,6 +17,8 @@
- match: { job_id: "ml-anomalies-default-mappings-job" } - match: { job_id: "ml-anomalies-default-mappings-job" }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-shared index: .ml-anomalies-shared
type: doc type: doc
@ -27,10 +29,14 @@
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.get_field_mapping: indices.get_field_mapping:
index: .ml-anomalies-shared index: .ml-anomalies-shared
type: doc type: doc
@ -56,10 +62,14 @@
- match: { job_id: "ml-anomalies-shared-mappings-job1" } - match: { job_id: "ml-anomalies-shared-mappings-job1" }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.get_mapping: indices.get_mapping:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- is_true: \.ml-anomalies-shared.mappings.doc._meta.version - is_true: \.ml-anomalies-shared.mappings.doc._meta.version
@ -80,10 +90,14 @@
- match: { job_id: "ml-anomalies-shared-mappings-job2" } - match: { job_id: "ml-anomalies-shared-mappings-job2" }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.get_mapping: indices.get_mapping:
index: .ml-anomalies-shared index: .ml-anomalies-shared
- is_true: \.ml-anomalies-shared.mappings.doc._meta.version - is_true: \.ml-anomalies-shared.mappings.doc._meta.version

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: post-data-job job_id: post-data-job
body: > body: >
@ -18,6 +20,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: post-data-closed-job job_id: post-data-closed-job
body: > body: >
@ -33,6 +37,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.open_job: xpack.ml.open_job:
job_id: post-data-job job_id: post-data-job

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: revert-model-snapshot job_id: revert-model-snapshot
body: > body: >
@ -18,14 +20,20 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.open_job: xpack.ml.open_job:
job_id: revert-model-snapshot job_id: revert-model-snapshot
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.close_job: xpack.ml.close_job:
job_id: revert-model-snapshot job_id: revert-model-snapshot
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
@ -51,6 +59,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
@ -76,6 +86,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
@ -89,6 +101,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
@ -102,6 +116,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
@ -115,7 +131,9 @@ setup:
} }
- do: - do:
index: headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
id: "revert-model-snapshot_1464825600000_1_1" id: "revert-model-snapshot_1464825600000_1_1"
@ -128,7 +146,9 @@ setup:
} }
- do: - do:
index: headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
id: "revert-model-snapshot_1462060800000_1_2" id: "revert-model-snapshot_1462060800000_1_2"
@ -141,6 +161,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
@ -156,6 +178,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
type: doc type: doc
@ -172,10 +196,14 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-state index: .ml-state
@ -228,6 +256,8 @@ setup:
delete_intervening_results: true delete_intervening_results: true
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-revert-model-snapshot index: .ml-anomalies-revert-model-snapshot

View File

@ -16,6 +16,8 @@ setup:
type: float type: float
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: start-stop-datafeed-job job_id: start-stop-datafeed-job
body: > body: >
@ -34,6 +36,8 @@ setup:
} }
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_datafeed: xpack.ml.put_datafeed:
datafeed_id: start-stop-datafeed-datafeed-1 datafeed_id: start-stop-datafeed-datafeed-1
body: > body: >

View File

@ -1,5 +1,7 @@
setup: setup:
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
xpack.ml.put_job: xpack.ml.put_job:
job_id: update-model-snapshot job_id: update-model-snapshot
body: > body: >
@ -14,6 +16,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-update-model-snapshot index: .ml-anomalies-update-model-snapshot
type: doc type: doc
@ -28,6 +32,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
index: index:
index: .ml-anomalies-update-model-snapshot index: .ml-anomalies-update-model-snapshot
type: doc type: doc
@ -43,6 +49,8 @@ setup:
} }
- do: - do:
headers:
Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser
indices.refresh: indices.refresh:
index: .ml-anomalies-update-model-snapshot index: .ml-anomalies-update-model-snapshot
@ -69,10 +77,6 @@ setup:
- match: { model.retain: false } - match: { model.retain: false }
- match: { model.description: "new_description" } - match: { model.description: "new_description" }
- do:
indices.refresh:
index: .ml-anomalies-update-model-snapshot
- do: - do:
xpack.ml.get_model_snapshots: xpack.ml.get_model_snapshots:
job_id: "update-model-snapshot" job_id: "update-model-snapshot"
@ -81,6 +85,7 @@ setup:
- match: { count: 1 } - match: { count: 1 }
- match: { model_snapshots.0.snapshot_id: "snapshot-1" } - match: { model_snapshots.0.snapshot_id: "snapshot-1" }
- match: { model_snapshots.0.timestamp: 1464825600000 } - match: { model_snapshots.0.timestamp: 1464825600000 }
- match: { model_snapshots.0.description: "new_description" }
--- ---
"Test duplicate descriptions are allowed": "Test duplicate descriptions are allowed":
@ -93,10 +98,6 @@ setup:
"description": "snapshot 2 description" "description": "snapshot 2 description"
} }
- do:
indices.refresh:
index: .ml-anomalies-update-model-snapshot
- do: - do:
xpack.ml.get_model_snapshots: xpack.ml.get_model_snapshots:
job_id: "update-model-snapshot" job_id: "update-model-snapshot"

View File

@ -17,10 +17,12 @@ integTestRunner {
systemProperty 'tests.rest.blacklist', [ systemProperty 'tests.rest.blacklist', [
// Remove tests that are expected to throw an exception, because we cannot then // Remove tests that are expected to throw an exception, because we cannot then
// know whether to expect an authorization exception or a validation exception // know whether to expect an authorization exception or a validation exception
'ml/custom_all_field/Test querying custom all field',
'ml/datafeeds_crud/Test delete datafeed with missing id', 'ml/datafeeds_crud/Test delete datafeed with missing id',
'ml/datafeeds_crud/Test put datafeed referring to missing job_id', 'ml/datafeeds_crud/Test put datafeed referring to missing job_id',
'ml/datafeeds_crud/Test put datafeed with invalid query', 'ml/datafeeds_crud/Test put datafeed with invalid query',
'ml/datafeeds_crud/Test update datafeed with missing id', 'ml/datafeeds_crud/Test update datafeed with missing id',
'ml/delete_job_force/Test cannot force delete a non-existent job',
'ml/delete_model_snapshot/Test delete snapshot missing snapshotId', 'ml/delete_model_snapshot/Test delete snapshot missing snapshotId',
'ml/delete_model_snapshot/Test delete snapshot missing job_id', 'ml/delete_model_snapshot/Test delete snapshot missing job_id',
'ml/delete_model_snapshot/Test delete with in-use model', 'ml/delete_model_snapshot/Test delete with in-use model',
@ -46,6 +48,11 @@ integTestRunner {
'ml/jobs_get_result_categories/Test with invalid param combinations via body', 'ml/jobs_get_result_categories/Test with invalid param combinations via body',
'ml/jobs_get_stats/Test get job stats given missing job', 'ml/jobs_get_stats/Test get job stats given missing job',
'ml/jobs_get_stats/Test no exception on get job stats with missing index', 'ml/jobs_get_stats/Test no exception on get job stats with missing index',
'ml/job_groups/Test put job with empty group',
'ml/job_groups/Test put job with group that matches an job id',
'ml/job_groups/Test put job with group that matches its id',
'ml/job_groups/Test put job with id that matches an existing group',
'ml/job_groups/Test put job with invalid group',
'ml/post_data/Test Flush data with invalid parameters', 'ml/post_data/Test Flush data with invalid parameters',
'ml/post_data/Test flushing and posting a closed job', 'ml/post_data/Test flushing and posting a closed job',
'ml/post_data/Test open and close with non-existent job id', 'ml/post_data/Test open and close with non-existent job id',
@ -68,7 +75,7 @@ integTestCluster {
plugin ':x-pack-elasticsearch:plugin' plugin ':x-pack-elasticsearch:plugin'
extraConfigFile 'x-pack/roles.yml', 'roles.yml' extraConfigFile 'x-pack/roles.yml', 'roles.yml'
setupCommand 'setupTestAdminUser', setupCommand 'setupTestAdminUser',
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser' 'bin/x-pack/users', 'useradd', 'x_pack_rest_user', '-p', 'x-pack-test-password', '-r', 'superuser'
setupCommand 'setupMlAdminUser', setupCommand 'setupMlAdminUser',
'bin/x-pack/users', 'useradd', 'ml_admin', '-p', 'x-pack-test-password', '-r', 'minimal,machine_learning_admin' 'bin/x-pack/users', 'useradd', 'ml_admin', '-p', 'x-pack-test-password', '-r', 'minimal,machine_learning_admin'
setupCommand 'setupMlUserUser', setupCommand 'setupMlUserUser',
@ -79,7 +86,7 @@ integTestCluster {
File tmpFile = new File(node.cwd, 'wait.success') File tmpFile = new File(node.cwd, 'wait.success')
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow", ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
dest: tmpFile.toString(), dest: tmpFile.toString(),
username: 'test_admin', username: 'x_pack_rest_user',
password: 'x-pack-test-password', password: 'x-pack-test-password',
ignoreerrors: true, ignoreerrors: true,
retries: 10) retries: 10)

View File

@ -1,15 +1,15 @@
minimal: minimal:
cluster: cluster:
- cluster:monitor/health # This is always required because the REST client uses it to find the version of
# Elasticsearch it's talking to
- cluster:monitor/main - cluster:monitor/main
- cluster:monitor/state
indices: indices:
- names: '*' # Give all users involved in these tests access to the indices where the data to
# be analyzed is stored, because the ML roles alone do not provide access to
# non-ML indices
- names: [ 'airline-data', 'index-foo', 'unavailable-data' ]
privileges: privileges:
- indices:admin/create - indices:admin/create
- indices:admin/exists
- indices:admin/get
- indices:admin/mapping/put
- indices:admin/refresh - indices:admin/refresh
- indices:data/read/field_caps - indices:data/read/field_caps
- indices:data/read/search - indices:data/read/search

View File

@ -13,6 +13,7 @@ import org.elasticsearch.common.CheckedFunction;
import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.test.SecuritySettingsSource;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse; import org.elasticsearch.test.rest.yaml.ClientYamlTestResponse;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
@ -36,8 +37,7 @@ import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordTok
public class MlWithSecurityIT extends ESClientYamlSuiteTestCase { public class MlWithSecurityIT extends ESClientYamlSuiteTestCase {
private static final String TEST_ADMIN_USERNAME = "test_admin"; private static final String TEST_ADMIN_USERNAME = "x_pack_rest_user";
private static final String TEST_ADMIN_PASSWORD = "x-pack-test-password";
@After @After
public void clearMlState() throws Exception { public void clearMlState() throws Exception {
@ -99,7 +99,7 @@ public class MlWithSecurityIT extends ESClientYamlSuiteTestCase {
Map<String, String> params, Map<String, String> params,
List<Map<String, Object>> bodies) throws IOException { List<Map<String, Object>> bodies) throws IOException {
Map<String, String> headers = Collections.singletonMap("Authorization", Map<String, String> headers = Collections.singletonMap("Authorization",
basicAuthHeaderValue(TEST_ADMIN_USERNAME, new SecureString(TEST_ADMIN_PASSWORD.toCharArray()))); basicAuthHeaderValue(TEST_ADMIN_USERNAME, SecuritySettingsSource.TEST_PASSWORD_SECURE_STRING));
return getAdminExecutionContext().callApi(apiName, params, bodies, headers); return getAdminExecutionContext().callApi(apiName, params, bodies, headers);
} }
@ -123,7 +123,7 @@ public class MlWithSecurityIT extends ESClientYamlSuiteTestCase {
@Override @Override
protected Settings restAdminSettings() { protected Settings restAdminSettings() {
String token = basicAuthHeaderValue(TEST_ADMIN_USERNAME, new SecureString(TEST_ADMIN_PASSWORD.toCharArray())); String token = basicAuthHeaderValue(TEST_ADMIN_USERNAME, SecuritySettingsSource.TEST_PASSWORD_SECURE_STRING);
return Settings.builder() return Settings.builder()
.put(ThreadContext.PREFIX + ".Authorization", token) .put(ThreadContext.PREFIX + ".Authorization", token)
.build(); .build();

View File

@ -28,10 +28,15 @@ public class MlWithSecurityInsufficientRoleIT extends MlWithSecurityIT {
super.test(); super.test();
fail("should have failed because of missing role"); fail("should have failed because of missing role");
} catch (AssertionError ae) { } catch (AssertionError ae) {
assertThat(ae.getMessage(), // Some tests assert on searches of wildcarded ML indices rather than on ML endpoints. For these we expect no hits.
either(containsString("action [cluster:monitor/xpack/ml")).or(containsString("action [cluster:admin/xpack/ml"))); if (ae.getMessage().contains("hits.total didn't match expected value")) {
assertThat(ae.getMessage(), containsString("returned [403 Forbidden]")); assertThat(ae.getMessage(), containsString("but was [0]"));
assertThat(ae.getMessage(), containsString("is unauthorized for user [no_ml]")); } else {
assertThat(ae.getMessage(),
either(containsString("action [cluster:monitor/xpack/ml")).or(containsString("action [cluster:admin/xpack/ml")));
assertThat(ae.getMessage(), containsString("returned [403 Forbidden]"));
assertThat(ae.getMessage(), containsString("is unauthorized for user [no_ml]"));
}
} }
} }

View File

@ -30,10 +30,11 @@ public class MlWithSecurityUserRoleIT extends MlWithSecurityIT {
try { try {
super.test(); super.test();
// We should have got here if and only if the test consisted entirely of GETs // We should have got here if and only if the only ML endpoints in the test were GETs
for (ExecutableSection section : testCandidate.getTestSection().getExecutableSections()) { for (ExecutableSection section : testCandidate.getTestSection().getExecutableSections()) {
if (section instanceof DoSection) { if (section instanceof DoSection) {
if (((DoSection) section).getApiCallSection().getApi().startsWith("xpack.ml.get_") == false) { if (((DoSection) section).getApiCallSection().getApi().startsWith("xpack.ml.") &&
((DoSection) section).getApiCallSection().getApi().startsWith("xpack.ml.get_") == false) {
fail("should have failed because of missing role"); fail("should have failed because of missing role");
} }
} }